编译FFmpeg
<center>
编译ffmpeg
安装Msys2以及依赖
export arch=mingw-w64-x86_64
export arch=mingw-w64-ucrt-x86_64
pacman -S $arch-yasm $arch-name $arch-cmake $arch-make
$arch-clang $arch-libc++ $arch-lld $arch-clang-tools-extra $arch-lldb $arch-toolchain
pacman -S $arch-libx264 $arch-x265 $arch-libvpx $arch-libvpl $arch-lame $arch-fdk-aac $arch-rav1e $arch-svt-av1 $arch-dav1d\
$arch-SDL2 $arch-freetype $arch-harfbuzz $arch-fontconfig $arch-fribidi
依赖
libfmx官网: git clone https://github.com/lu-zero/mfx_dispatch.git
libx264官网: git clone https://code.videolan.org/videolan/x264.git
libx265官网 git clone https://bitbucket.org/multicoreware/x265_git.git
fdk-aac官网: git clone https://github.com/mstorsjo/fdk-aac.git
libmp3lame: wget https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz
libvpx官网: git clone https://github.com/webmproject/libvpx.git
Msys2编译
如果是linux平台交叉编译需要指定运行平台目标平台编译器 --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32
linux平台不用启用禁用下面的依赖 --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldexeflags= --extra-ldexeflags=-static-libgcc --disable-lzma --disable-zlib --disable-bzlib
可选av1编码器
--enable-librav1e --enable-libsvtav1 --enable-libdav1d --enable-libaom
./configure --prefix=D://libffmpeg --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-shared --enable-static --enable-sdl2 --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libfdk-aac --enable-libmfx --enable-nonfree --enable-libvpx --extra-ldflags="-static -static-libgcc -static-libstdc++" --extra-ldexeflags="-static -static-libgcc -static-libstdc++" --pkg-config-flags="--static"
可选drawtext
--enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libfribidi
linux平台编译
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-shared --enable-static --enable-sdl2 --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libfdk-aac --enable-libmfx --enable-nonfree --enable-libvpx
安卓平台
./configure \
--prefix=/home/build1 \
--enable-shared \
--enable-gpl \
--enable-neon \
--enable-hwaccels \
--enable-postproc \
--enable-jni \
--enable-small \
--enable-mediacodec \
--enable-decoder=h264_mediacodec \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffplay \
--disable-avdevice \
--disable-debug \
--disable-static \
--disable-doc \
--disable-symver \
--pkg-config=pkg-config \
--enable-cross-compile \
--cc=/home/one/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang \
--cxx=/home/one/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang++ \
--cross-prefix=/home/one/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm- \
--sysroot=/home/one/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot \
--extra-cflags="-Os -fPIC -D__ANDROID_API__=26 -DANDROID" \
--target-os=android \
--arch=aarch64 \
--cpu=armv8-a