windows下ffmpeg源码编译
下载必备
https://www.msys2.org/
https://github.com/FFmpeg/FFmpeg.git
https://code.videolan.org/videolan/x264.git
在以下文件开头加一行数据
/etc/pacman.d/mirrorlist.mingw32
Server = 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.ucrt64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/ucrt64
/etc/pacman.d/mirrorlist.clang64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/clang64
/etc/pacman.d/mirrorlist.msys
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
安装环境
打开msys2
然后打命令
#更新包
pacman -Syu
#安装必备
pacman -S base-devel
#64位
pacman -S mingw-w64-x86_64-toolchain
#32位
pacman -S mingw-w64-i686-toolchain
#依赖
pacman -S yasm
pacman -S nasm
pacman -S make
windows下设置环境变量MSYS2_PATH_TYPE为inherit
编译安装脚本
x264
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/x264-master
pwd
./configure --host=i686-w64-mingw32 --prefix=${basepath}/x264_install --enable-static --enable-shared \
--extra-ldflags=-Wl,--output-def=libx264.def
make -j8
make install
ffmpeg
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/FFmpeg-master
#添加x264 x265 pkg路径
x264_pkg_path=/home/Administrator/x264_install/lib/pkgconfig
export PKG_CONFIG_PATH=$x264_pkg_path:$PKG_CONFIG_PATH
./configure --arch=x86 --target-os=mingw32 --prefix=${basepath}/ffmpeg_install --disable-static --enable-shared \
--enable-libx264 --enable-gpl
make -j8
make install
然后运行,完事,home的用户目录下就有了。
编译不同自行改脚本。