1、安装msys2环境
msys2可以兼容32位和64位。因此需要配置–host=i686-w64-mingw32或者–host=i686-w64-mingw32,否则会提示no working c compiler found。
修改msys2安装路径下面etc/fstab文件,指向qt的mingw路径
运行mingw32.exe,安装automake等一些基本的编译环境base-devel,输入which mingw32-make,可以看到已经正确识别了qt自带的编译器。
如果需要使用64位的编译器,方法基本类似,可以参考响应资料。
2、编译x264
./configure --host=i686-w64-mingw32 --prefix=$(pwd)/install --enable-shared --enable-static --disable-opencl
make -j8
//此时如果提示gcc.exe no input files那么输入gcc -v
gcc -v
make -j8
make install
3、编译qsv编解码库
autoreconf -i
./configure --prefix=$(pwd)/install --host=i686-w64-mingw32
make -j8
gcc -v
make -j8
make install
4、编译x265的库
使用cmake生成Makefile,然后使用mingw32-make 编译。需要注意环境变量设置正确。
5、编译ffmpeg
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/cygdrive/e/softdev/transit/QtPro/mfx_dispatch-master/install/lib/pkgconfig/:/cygdrive/e/softdev/transit/QtPro/x264-master/install/lib/pkgconfig/:/cygdrive/e/softdev/transit/QtPro/x265-master/build/mingw_qt-5.14.2/install/lib/pkgconfig/
./configure --enable-shared --enable-static --enable-gpl --enable-libx264 --enable-libx265 --enable-libmfx --enable-decoder=h264 --enable-encoder=h264 --enable-decoder=h264_qsv --enable-encoder=h264_qsv --enable-encoder=h265 --enable-decoder=h265 --prefix=$(pwd)/install --enable-encoder=h264 --enable-encoder=h264_qsv --enable-encoder=h265 --target-os=mingw32 --disable-opencl --extra-cflags='-I/cygdrive/e/softdev/transit/QtPro/x264-master/install/include/ -I/cygdrive/e/softdev/transit/QtPro/mfx_dispatch-master/install/include/ -I/cygdrive/e/softdev/transit/QtPro/mfx_dispatch-master/install/include/mfx -I/cygdrive/e/softdev/transit/QtPro/x265-master/build/mingw_qt-5.14.2/install/include/' --extra-ldflags='-L/cygdrive/e/softdev/transit/QtPro/x264-master/install/lib/ -L/cygdrive/e/softdev/transit/QtPro/mfx_dispatch-master/install/lib/ -L/cygdrive/e/softdev/transit/QtPro/x265-master/build/mingw_qt-5.14.2/install/lib/' --enable-protocol=tcp --enable-demuxer=rtsp --enable-network
//上面的配置需要根据具体情况有所差异
make -j8
make install
//注意不能使用mingw32-make
版权声明:本文为eastgeneral原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。