询问有关ffmpeg编译成静态库的问题‏

liuxianguo1982 2012-03-09 05:19:48
参考了cnblog:http://www.cnblogs.com/haibindev/archive/2011/12/01/2270126.html,目前我在Ubuntu 10.04版本下,用的交叉工具链mingw-w32-bin_i686-linux_20111220.tar.bz2也编译出了动态库文件,使用的命令如下:

../ffmpeg-0.8.7/configure --enable-cross-compile --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config --target-os=mingw32 --arch=x86 --prefix=/home/liuxianguo/opensdk/ffmpeg --disable-static --enable-shared --enable-version3 --enable-gpl --enable-nonfree --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-ffplay --extra-cflags="-I/home/liuxianguo/opensdk/include -I/home/liuxianguo/studio/mingw-w64-v2.0.1/mingw-w64-headers/include" --extra-ldflags=-L/home/liuxianguo/opensdk/lib --enable-libfaac --enable-libvo-aacenc --enable-libmp3lame --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib


现在的问题是:
1.明明--enable-ffplay 了,且已经编译安装了SDL,为什么最终的编译结果里没有ffplay.exe的可执行文件呢(目前最终结果只有ffprobe.exe和ffmpeg.exe)?
2.编译成动态链接库时,很多*.dll文件出现在bin目录下,在lib目录下还有对应的*.dll.a文件,请问*.dll.a文件是否就是相当于windows平台下,与动态链接库文件对应的lib文件?
3.请问一下编译出的dll怎么在VS2005中使用呢?你能否给我写个小例子,让我看到效果的,谢谢。
4.我使用以下的配置选项试图编译出windows下可用的静态库文件*.lib,但是结果在lib目录下的静态库文件的后缀是*.a,我明明用的是交叉工具链i686-w64-mingw32啊,求解原因?
5.看网上有人说*.dll可以通过VS2005的lib.exe工具转换成*.lib,

../ffmpeg-0.8.7/configure --enable-cross-compile --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config --target-os=mingw32 --arch=x86 --prefix=/home/liuxianguo/opensdk/ffmpeg --enable-static --disable-shared --enable-version3 --enable-gpl --enable-nonfree --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-ffplay --extra-cflags="-I/home/liuxianguo/opensdk/include -I/home/liuxianguo/studio/mingw-w64-v2.0.1/mingw-w64-headers/include" --extra-ldflags=-L/home/liuxianguo/opensdk/lib --enable-libfaac --enable-libvo-aacenc --enable-libmp3lame --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib


非常感谢你的解答。
...全文
749 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuxianguo1982 2012-03-16
  • 打赏
  • 举报
回复
我的第一个问题补充:

FFplay
To build ffplay, you will need to have the SDL library. On Ubuntu, using apt.arrozcru.org, that is achieved with:
$ sudo apt-get install mingw32-libsdl
If libsdl is found by configure, it will automatically build ffplay.
我的最终解决方法:
切换到/home/liuxianguo/studio/opensource/SDL-1.2.14执行
$./configure --host=i686-w64-mingw32 --prefix=/home/liuxianguo/opensdk --enable-static --enable-shared
$make
$sudo make install
最终终于成功了,要编译成动态库,加以下环境变量:
$export PKG_CONFIG_PATH=/home/liuxianguo/opensdk/lib/pkgconfig:$PKG_CONFIG_PATH
$export LIBRARY_PATH=/home/liuxianguo/opensdk/lib
$export LD_LIBRARY_PATH=/home/liuxianguo/opensdk/lib
可以看到ffmpeg执行configure之后,config.h中的#define CONFIG_FFPLAY 1
但是编译出的ffplay不能播放。


该问题是不是由以下引起?
libx264
There is a bug in FFmpeg's configure that makes it not detect libx264 on Windows. This bug will not be fixed because FFmpeg's build system maintainer stubbornly refuses to fix it. To enable libx264, you must pass this extra parameter to configure:
--extra-libs='-lx264 -lpthread'
加了--extra-libs='-lx264 -lpthread' 参数就报错,是咋回事?
root@ubuntu:/home/liuxianguo/studio/opensource/build-ffmpeg# ../ffmpeg-0.8.7/configure --enable-cross-compile --cross-prefix=i686-w64-mingw32-
--pkg-config=pkg-config --target-os=mingw32 --arch=x86 --prefix=/home/liuxianguo/opensdk/ffmpeg --disable-static --enable-shared --enable-version3
--enable-gpl --enable-nonfree --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-ffplay
--extra-cflags="-I/home/liuxianguo/opensdk/include -I/home/liuxianguo/studio/mingw-w64-v2.0.1/mingw-w64-headers/include"
--extra-ldflags=-L/home/liuxianguo/opensdk/lib --enable-libfaac --enable-libvo-aacenc --enable-libmp3lame --enable-libopenjpeg --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-libxvid --enable-zlib
i686-w64-mingw32-gcc is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help solving the problem.
rightorwrong 2012-03-15
  • 打赏
  • 举报
回复
编出的dll库就像一般的dll那样使用
include头文件,
包含lib库,就可以调用接口了

一般只需要编出dll库就可以了

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧