Windows下 ffmpeg+X264 编译
【X64环境编译】
1、打开 “适用于 VS 2017 的 x86_x64 兼容工具命令提示” ,并运行 “D:\msys64\msys2_shell.cmd -mingw64”
2、下载x264源码,解压并编译
CC=cl ./configure --disable-cli --enable-shared --extra-cflags="-DNO_PREFIX"
make && make install
mv /usr/local/lib/libx264.dll.lib /usr/local/lib/libx264.lib
3、下载ffmpeg源码,解压并编译
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib/
export C_INCLUDE_PATH=/usr/local/include/
echo $PKG_CONFIG_PATH && echo $LD_LIBRARY_PATH && echo $C_INCLUDE_PATH
./configure --prefix=./build --toolchain=msvc --arch=x86_64 --enable-shared --disable-static --enable-avresample --enable-libx264 --enable-gpl --extra-cflags="-I/usr/local/include/"
make && make install
=======================================
【X86环境编译】
1、打开 “x86 Native Tools Command Prompt for VS 2017” ,并运行 “D:\msys64\msys2_shell.cmd -mingw32”
2、下载x264源码,解压并编译
CC=cl ./configure --disable-cli --enable-shared --extra-cflags="-DNO_PREFIX"
make && make install
mv /usr/local/lib/libx264.dll.lib /usr/local/lib/libx264.lib
3、下载ffmpeg源码,解压并编译
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib/
export C_INCLUDE_PATH=/usr/local/include/
echo $PKG_CONFIG_PATH && echo $LD_LIBRARY_PATH && echo $C_INCLUDE_PATH
./configure --prefix=./build --toolchain=msvc --arch=x86 --enable-shared --disable-static --enable-avresample --enable-libx264 --enable-gpl --extra-cflags="-I/usr/local/include/"
make && make install
=======================================
MSYS2配置记录
1、下载并安装msys2;
2、进行安装目录并修改D:\msys64\msys2_shell.cmd文件,将释掉rem set MSYS2_PATH_TYPE=inherit改成set MSYS2_PATH_TYPE=inherit,这是为了将vs的环境继承给MSYS2;
3、重命名msys64/usr/bin/link.exe 为msys64/usr/bin/link.bak, 避免和MSVC 的link.exe抵触;
4、下载YASM,并将下载回来的yasm-1.3.0-win64.exe 改名为yasm.exe,并放置于 MSYS2 安装目录D:/msys64/usr/bin/ 中;
5、检查 which cl link yasm cpp 看看返回的结果是否正确;