-
下载安装msys2
http://msys2.github.io/ 或 https://github.com/msys2 下载并安装 -
更改msys2国内源
/etc/pacman.d/mirrorlist.mingw32Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686
/etc/pacman.d/mirrorlist.mingw64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64
/etc/pacman.d/mirrorlist.msys
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
-
设置msys2环境变量
编辑目录下的msys2_shell.cmd,将set MSYS2_PATH_TYPE=inherit注释打开即可 -
msys2下安装基本工具
双击运行msys2_shell.cmd
1、安装yasmpacman -S make yasm diffutils pkg-config
2、安装GCC
pacman -S mingw-w64-i686-gcc pacman -S mingw-w64-x86_64-gcc
-
编译前操作
1、编辑msys2_shell.cmd, 在@echo off后面加入:call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
2、将D:\msys2\usr\bin\link.exe改一下名,因为会和vc的link.exe重名
-
编译ffmpeg
1、将ffmpeg代码拷贝到home目录下,
2、双击运行msys2_shell.cmd,cd到ffmpeg目录下。
3、输入编译命令行# ./configure --disable-asm --enable-avdevice --enable-doc --disable-programs --enable-avresample --disable-shared --enable-static --disable-bzlib --enable-gray --disable-libopenjpeg --disable-iconv --disable-zlib --prefix=./vs2019_build --toolchain=msvc --arch=x86 --enable-debug # make # make install
4、如果要编译 ffplay,则:
不需要加 --enalbe-debug,不然进不了ffmpeg内部
–toolchain=msvc 可以生成 pdb文件# make clean # ./configure --enable-shared --prefix=./vs2019_ffplay --toolchain=msvc # make # make install
国内源转载于:https://my.oschina.net/CandyMi/blog/745557
其他参考:https://blog.csdn.net/Tui_GuiGe/article/details/90320224