2008年12月2日星期二

编译FFmpeg

MinGW: A collection of freely available and freely distributable Windows specific header files and import libraries, augmenting the GNU Compiler Collection, (GCC), and its associated tools, (GNU binutils). MinGW provides a complete Open Source programming tool set which is suitable for the development of native Windows programs that do not depend on any 3rd-party C runtime DLLs.
MSYS: A Minimal SYStem providing a POSIX compatible Bourne shell environment, with a small collection of UNIX command line tools. Primarily developed as a means to execute the configure scripts and Makefiles used to build Open Source software, but also useful as a general purpose command line interface to replace Windows cmd.exe.

详细请见:FFmpeg编译指南
http://donaldtc.blogspot.com/2007/05/ffmpeg_22.html

准备MSys+MinGW系统 -->获取FFmpeg (不用SVN方式的到直接下载一个ffmpeg-export-snapshot.tar: bare sources) --> 编译(启动MSys --> "cd /C/ffmpeg" --> ./configure --enable-memalign-hack --> make --> ... ... ) --> 也可加入对第三方库的支持, 重复编译步骤,只是加入更多的东东 ./configure --enable-static --enable-shared --enable-bla bla --enable-bla bla bla 然后 make ... ... --> 在Qt+MinGW链接,配置的工作和以前配置SDL时一样 --> ... ...

# ./configure \
'--prefix=/usr' \
'--enable-gpl' \
'--enable-shared' \
'--enable-mp3lame' \

... ...
'--disable-ffserver'
# make
# make install

在configure 不要加 --disable-ffplay 就会同时安装ffplay。
典型的 Desktop (PC) 使用 - ffplay + SDL

附加:
如何uilding ffmpeg for Windows with MSYS and MinGW(在windows里构件ffmpeg用MSYS和MinGW)。
1.先下载最新的MinGW:
http://sourceforge.net/project/showfiles.php?group_id=2435
2.下载MSYS和它的bash
3.下载最新的ffmpeg
  1. 安装 MinGW (choose “MinGW base tools” and “MinGW make”) 到 c:\mingw
  2. 安装 MSYS 到 c:\msys\1.0
  3. 在MSYS安装后,回答一下几个问题:
    Do you wish to continue with the post install? [yn ] -> y
    Do you have MinGW installed? [yn ] -> y
    Where is your MinGW installation? -> C:/mingw
  4. 将 bash-2.05b-MSYS.tar.bz2 拷到 c:\msys\1.0 and 并解压缩 (bash.exe 和 sh.exe必须放到 C:\MSYS\1.0\bin里).
    我们要这么做是因为ffmpeg’s configure script不能在MSYS自配的bash 2.0.4下工作。
  5. 解压ffmpeg
然后使用MSYS进入ffmpeg目录,执行./configure 并做一些设定,一切OK,执行make。

-->其实更本不用那么麻烦,直接下载FFMPEG的SDK就可以使用了,很方便,编译太麻烦,如果搞不定,还很浪费时间呢。
http://www.ffmpeg.com.cn/index.php/SDK_Download