先为了提高下载速度,将下载源换成中科大的:
sed -i "s#mirror.msys2.org/#mirrors.ustc.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*
pacman -Sy
pacman -S mingw-w64-x86_64-toolchain # mingw64编译工具链,win下的gcc
pacman -S base-devel # 一些基本的编译工具
pacman -S yasm nasm # 汇编器
git clone https://code.videolan.org/videolan/x264.git
build-x264.sh
#!/bin/sh
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/x264-src # 根据路径名称自行修改
pwd
./configure --prefix=${basepath}/x264_install --enable-shared
make -j8
make install
build-ffmpeg.sh
#!/bin/sh
basepath=$(cd `dirname $0`;pwd)
echo ${basepath}
cd ${basepath}/ffmpeg-5.1.2-src
pwd
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/d/repos/ffmpeg/x264_install/lib/pkgconfig
echo ${PKG_CONFIG_PATH}
./configure --prefix=${basepath}/ffmpeg_5.2.1_install \
--enable-gpl --enable-libx264 --disable-static --enable-shared \
--extra-cflags=-l${basepath}/x264_install/include --extra-ldflags=-L${basepath}/x264_install/lib
make -j8
make install