Windows10上通过MSYS2编译FFmpeg 6.1.1源码操作步骤

      1.从github上clone代码,并切换到n6.1.1版本:clone到D:\DownLoad目录下

git clone https://github.com/FFmpeg/FFmpeg.git
git checkout n6.1.1

      2.安装MSYS2并编译FFmpeg源码:
      (1).从https://www.msys2.org/ 下载msys2-x86_64-20240113.exe ;
      (2).双击安装,安装到C:\msys64目录下;
      (3).双击C:\msys64目录下的mingw64.exe,安装必要的包:

pacman -S make
pacman -S diffutils
pacman -S yasm
pacman -S pkg-config
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-SDL2 # ffplayer.exe

      (4).cd到D:\DownLoad\FFmpeg目录下;
      (5).编译FFmpeg源码,执行如下命令:

      debug:

./configure --prefix=/opt/ffmpeg_debug --enable-debug=3 --disable-optimizations --enable-shared --disable-static
make -j8
make install

      release:

./configure --prefix=/opt/ffmpeg_release --enable-shared --disable-static
make -j8
make install

      3.make install后会将相关文件存放到C:\msys64\opt目录下。将C:\msys64\mingw64\bin目录下的libiconv-2.dll、libwinpthread-1.dll、SDL2.dll动态库分别拷贝到存放ffmpeg.exe的目录下,三个可执行文件即可正常执行,结果如下图所示:

Windows10上通过MSYS2编译FFmpeg 6.1.1源码操作步骤_第1张图片

      GitHub:https://github.com/fengbingchun/OpenCV_Test

你可能感兴趣的:(ffmpeg)