本次编译,源码的缓冲区加大了20倍
一、准备工具
ffmpeg源码下载
http://ffmpeg.org/download.html#releases
msys2下载
x264下载
https://www.videolan.org/developers/x264.html
二、环境搭建
首先打开msys2
开始-所有应用
命令安装mingw64编译器(友情提示:由于是国外的服务器,执行这个命令前最好使用科学上网)
pacman -S mingw-w64-x86_64-toolchain
pacman -S base-devel
三、编译
将下载的ffmpeg和x264文件解压到msys2的安装目录下的msys64\home\HelloJer(这个目录是跟你账户名相同的,每个人都不一样)
编译x264
当前目录下创建脚本build.sh
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/x264-master
pwd
./configure --prefix=${basepath}/x264-install --enable-static
make
make install
第一次执行会出现如下情况
pacman -S nasm
再次执行build.sh脚本,本次编译大概耗时15min
x264编译结果
编译ffmpeg
修改build.sh脚本
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/x264-master
pwd
#./configure --prefix=${basepath}/x264-install --enable-static
#make
#make install
#cd到你的ffmpeg源码的目录下,我的是ffmpeg-4.3.2
cd ${basepath}/ffmpeg-4.3.2
pwd
./configure --prefix=${basepath}/ffmpeg_install --enable-static --enable-shared --enable-libx264 --enable-gpl \
--extra-cflags=-I${basepath}/x264-install/include \
--extra-ldflags=-L${basepath}/x264-install/lib
执行build.sh脚本
编译耗时很久,30分钟左右...
编译完成
编译完成后的目录结构
注意编译完成后是没有dll这些文件的,本人是复制别人的进来的。。。
cmd执行一下,编译成功
已将编译好的文件放到蓝奏云了,本次编译缓冲区加大了20倍,并且编译了qsv第三方库,上面教程并没有记录qsv的打包
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/mfx_dispatch-master
pwd
#./configure --prefix=${basepath}/x264_install --enable-static
#make
#make install
#./configure --prefix=${basepath}/qsv_install --enable-static
#make
#make install
#cd到你的ffmpeg源码的目录下,我的是ffmpeg-4.3.2 --enable-static --enable-shared
cd ${basepath}/ffmpeg-4.3.2
pwd
./configure --prefix=${basepath}/ffmpeg_4.3.2 --enable-static --enable-libx264 --enable-libmfx --enable-gpl \
--extra-cflags=-I${basepath}/x264_install/include \
--extra-ldflags=-L${basepath}/x264_install/lib \
--extra-cflags=-I${basepath}/qsv_install/include \
--extra-ldflags=-L${basepath}/qsv_install/lib
make
make install
本次编译主要参考该UP主视频教程