最近因项目需要,又搞了一次ffmpeg的编译工作,其中坑爹之事特别多,在这里做个记录,方便以后使用
首先下载编译工具和所需要的源码
MinGW+MSys http://sourceforge.net/projects/mingw/files/
SDLhttp://www.libsdl.org/download-2.0.php
yasmhttp://yasm.tortall.net/Download.html
ffmpeg http://www.ffmpeg.org/download.html
pthreadgc2.dll
http://www.dll-files.com/dllindex/dll-files.shtml?pthreadgc2
faac http://sourceforge.net/projects/faac/files/faac-src/faac-1.28/
x264
http://www.videolan.org/developers/x264.html
libmp3lame
http://lame.sourceforge.net/
以上文件的版本,尽可能下载最新版本
MinGW安装注意事项:下载回
mpeg4ip_win32.h:70: warning: unused variable '_TRUNCATE'
mpeg4ip_win32.h:70: warning: unused variable 'vsnprintf_s'
In file included from mp4common.h:32, from 3gp.cpp:28:
mp4util.h: In function `void Indent(FILE*, u_int8_t)':
mp4util.h:82: error: `fprintf_s' was not declared in this scope
mp4util.h:82: warning: unused variable 'fprintf_s'
make[3]: *** [3gp.o] Error 1
make[3]: Leaving directory `/d/faac-1.28/common/mp4v2'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/d/faac-1.28/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/d/faac-1.28'
make: *** [all] Error 2
mingw-get-setup.exe后主要
选择mingw-developer-toolkit、mingw32-base、mingw32-gcc-g++、msys-base这几项进行安装
MinGW的修改:
include/windows.h : line 93 #include<winsock.h> -----> #include <winsock2.h>
否则会报:#error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
在SDL , yasm , x264 ,faac , libmp3lame 编译命令后追加
-perfix="生成文件的存放路径" 在安装后会到指定位置,否则默认会装在
MSYS 对应的安装目录下
编译faac库
在编译faac-1.28时,可能会遇到如下错误
mpeg4ip_win32.h:70: error: `_TRUNCATE' was not declared in this scope
mpeg4ip_win32.h:70: error: `vsnprintf_s' was not declared in this scope
mpeg4ip_win32.h:70: warning: unused variable '_TRUNCATE'
mpeg4ip_win32.h:70: warning: unused variable 'vsnprintf_s'
In file included from mp4common.h:32, from 3gp.cpp:28:
mp4util.h: In function `void Indent(FILE*, u_int8_t)':
mp4util.h:82: error: `fprintf_s' was not declared in this scope
mp4util.h:82: warning: unused variable 'fprintf_s'
make[3]: *** [3gp.o] Error 1
make[3]: Leaving directory `/d/faac-1.28/common/mp4v2'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/d/faac-1.28/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/d/faac-1.28'
make: *** [all] Error 2
文件并执行path -p1 < faac-1.28.diff
然后执行
./bootstrap
./configure --with-mp4v2 --prefix=/home
两个命令