工作中用到了ffmpeg x64。 发现编译出来x64的ffmpeg,很不容易。特记录下来。
原计划编译 静态库, 发现静态库,在vs2010调用过程中,总是出现莫名其妙的错误。 后来发现官网上 有编译好的 动态库。 在AAC解码过程,出现杂音。 应该是它的一个bug。 所以决定重新编译个。
一. 准备
编译X64的需要mingw-w64 + msys
1. 下载 mingw-w64
2. 下载 msys
3. 编辑 msys 下 /etc/fstab 加入 c:/mingw64 /mingw
(注:我的mingw64放在c:/)
4. 编辑 msys.bat. 在文件的开头 加入
call "D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
5. 应该用到 yasm 工具。 这个记不清了。 下载yasm x64位的。 如果没有,下载32位的也行。 放到 msys/bin下。
二. 编译
1. Zlib 1.2.7 1. cd zlib-1.2.7/ 2. 修改 win32/Makefile.gcc 文件: PREFIX = x86_64-w64-mingw32- (注:在/mingw/bin中,最好将所有的.exe复制一份 以x86_64-w64-mingw32-开头的文件 ) 3. make -f win32/Makefile.gcc 4. cp -iv zlib1.dll /mingw/bin 5. cp -iv zconf.h zlib.h /mingw/include 6. cp -iv libz.a /mingw/lib 2. libgsm 1.0.13-3 1. cd gsm/
2 修改Makefile, 添加 PRIFIX=x86_64-w64-mingw32- CC = ${PRIFIX}gcc -ansi -pedantic AR = ${PRIFIX}ar RANLIB = ${PRIFIX}ranlib 3. make 编译到一半的时候出现 fchmod 和 fchown 的编译错误,不管它,继续执行: 4. mkdir /mingw/include/gsm 5. cp inc/gsm.h /mingw/include/gsm 6. cp lib/libgsm.a /mingw/lib 3. LAME 3.99.5
- ./configure --prefix=/mingw --enable-expopt=full --host=x86_64-w64-mingw32 --enable-static --disable-shared
- make
- make install
4. LIBOGG 1.3.0
- ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared
- make
- make install
5. LIBVorbis 1.3.3
1. ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared 2. make 3. make install 6. LIBSpeex 1.2rc1
- ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared
- make
- make install
7. LIBTheora 1.1.1
- ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared
- make
- make install
下载源代码,http://www.audiocoding.com/downloads.html,解压后:
首先编辑 Makefile.am 文件,将第一行改为 SUBDIRS = include libfaac 然后修改configure.in文件,找到最后一段的 AC_OUTPUT, 修改为 AC_OUTPUT(libfaac/Makefile include/Makefile Makefile)
执行: 1. ./bootstrap
2. ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared 3. make 4. make install 本文9. xvidcore 1.3.2
下载 xvidcore-mingw-w64-master ,这个是针对mingw-w64的一个版本,官网上的编译不过。解压后: - cd xvidcore/build/generic
- ./configure --prefix=/mingw --host=x86_64-w64-mingw32 --enable-static --disable-shared
执行到这里后,搜索xvidcore/build/generic 目录下面所有文件中的 -mno-cygwin 这个选项, 这个选项已经不被GCC支持,全部删除后继续。- make
- make install
- cp -iv \=build/xvidcore.dll.a /mingw/lib/libxvidcore.dll.a
10. x264 snapshot-20120830-2245
- configure --prefix=/mingw --enable-win32thread --extra-cflags="-DX264_VERSION=20100422" --host=x86_64-w64-mingw32 --enable-static --disable-shared --cross-prefix=x86_64-w64-mingw32-
- make
- make install
- cp -iv x264.h x264_config.h /mingw/include
- cp -iv libx264.a /mingw/lib
- cp -iv x264.pc /mingw/lib/pkgconfig
编译ffmpeg 0.11.1
相信有耐心进行到这里的人,已经花了1-2个小时了,这是正常的速度。终于可以编译ffmpeg了. 下载源代码,http://ffmpeg.org,解压后首先配置,光这个自动配置过程也要十分钟左右。- ./configure --prefix=/mingw --enable-gpl --enable-nonfree --enable-postproc --enable-avfilter --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-bzlib --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --disable-debug --enable-shared --arch=x86_64 --host-os=win64 --extra-cflags=-I/mingw/include --extra-ldflags=-L/mingw/lib
然后 make & make install 等着编译结束吧。
注意:make 时可能会碰到:
ar.exe: libavcodec/: Permission denied 或 library.mak *** 的错误,
参考:http://stackoverflow.com/questio ... sing-mingw-and-msys
- 删掉除了.git 所有的文件
- git config --global core.autocrlf false
- git reset --hard
- vim ./configure 查看编码 :set ff? 如果是 unix,即可。dos,不行。
- make
- make install
安装到libtheora-1.1.1时出错,找不到ogg……
|