mingw+vs2013静态编译最新ffmpeg与x264


声明:本文转载自https://my.oschina.net/u/1988725/blog/1548926,转载目的在于传递更多信息,仅供学习交流之用。如有侵权行为,请联系我,我会及时删除。

一、 源码包下载

1、 Ffmpeg

$ git clone https://git.ffmpeg.org/ffmpeg.git 

2、 x264

$ git clone http://git.videolan.org/git/x264.git 

ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 下载

二、 编译工具

1、 mingw https://sourceforge.net/projects/mingw/ 在线安装最新版本

2、 yasm http://yasm.tortall.net/Download.html

3、 nasm http://www.nasm.us/pub/nasm/releasebuilds/

4、 pkg-config, mingw中默认没有 http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config-0.23-2.zip

http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib_2.18.4-1_win32.zip只需要用到其中的libglib-2.0-0.dll文件

三、 mingw/msys环境设置

1、 复制 D:\MinGW\msys\1.0\ msys.bat 为 D:\MinGW\msys\1.0\ msys-vs2013.bat,打开文件,在最前面加上:call "D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" 保存文件

2、 将yasm.exe与nasm.exe放置到d:/MinGW/msys/1.0/bin/中

3、 将pkg-config-0.23-2.zip解压pkg-config.exe与glib_2.18.4-1_win32.zip中的 libglib-2.0-0.dll至d:/MinGW/msys/1.0/bin中

4、 重命名 d:/MinGW/msys/1.0/bin/link.exe 为link_renamed.exe ,这一步是防止这个link.exe与vc的link.exe发生冲突,编译完成之后记得修改回来

四、 编译x264 1、 运行msys-vs2013.bat

$ cd x264 $ CC=cl ./configure --enable-static --prefix=$PWD/build_vs2013  $ make;make install $ export PKG_CONFIG_PATH="$PWD/build_vs2013/lib/pkgconfig" 

五、 编译ffmpeg 1、 运行msys-vs2013.bat

$ cd ffmpeg $ ./configure --toolchain=msvc --prefix=$PWD/build_vs2013 --enable-static --enable-gpl --enable-libx264 --pkg-config=pkg-config 

提示错误:

出现以上现象原因有: a、 x264不是用vs2013 cl编译的,编译x264 执行./configure 前要加 CC=cl b、 mingw中缺少pkg-config.exe

$ make distclean $ ./configure --toolchain=msvc --prefix=$PWD/build_vs2013 --enable-static --enable-gpl --enable-libx264 --pkg-config=pkg-config  $ make;make install 

出错:

解决:

$ vi ffmpeg.c 在文件前面添加: #ifndef WIN32_LEAN_AND_MEAN  #define WIN32_LEAN_AND_MEAN  #endif   #include <windows.h>  #include <winsock2.h> 保存退出 $ make;make install 

六、 恢复d:/MinGW/msys/1.0/bin/link.exe

将d:/MinGW/msys/1.0/bin/link_renamed.exe改为d:/MinGW/msys/1.0/bin/link.exe

七、 参考

1、 http://blog.csdn.net/sweetloverft/article/details/38422201 2、 http://blog.csdn.net/wangjia184/article/details/7931164 3、 http://www.cnblogs.com/xylc/p/3683203.html 4、 http://www.cnblogs.com/lulu/p/5634550.html 5、 http://blog.163.com/lys_19850716/blog/static/84129044201611653736905/

本文发表于2017年10月11日 12:34
(c)注:本文转载自https://my.oschina.net/u/1988725/blog/1548926,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如有侵权行为,请联系我们,我们会及时删除.

阅读 2541 讨论 0 喜欢 0

抢先体验

扫码体验
趣味小程序
文字表情生成器

闪念胶囊

你要过得好哇,这样我才能恨你啊,你要是过得不好,我都不知道该恨你还是拥抱你啊。

直抵黄龙府,与诸君痛饮尔。

那时陪伴我的人啊,你们如今在何方。

不出意外的话,我们再也不会见了,祝你前程似锦。

这世界真好,吃野东西也要留出这条命来看看

快捷链接
网站地图
提交友链
Copyright © 2016 - 2021 Cion.
All Rights Reserved.
京ICP备2021004668号-1