1.源码下载:
git clone https://github.com/FFmpeg/FFmpeg.git
windows :
2.编译FFmpeg
windows:
1.下载yasm并安装 : Download - The Yasm Modular Assembler Project
下载后复制到c:/windows
2.下载SDL
3.下载H264/265源码
git clone https://code.videolan.org/videolan/x264.git
4.开始编译FFmpeg源码:
打开MSYS-MinGW-64控制台,进入FFmpeg源码目录,输入./configure
配置完成如下:
编译中...
编译成功:
生成的EXE文件如下
安装: make install 会安装到/usr/local目录下
linux编译FFmpeg源码:
安装依赖包:
sudo apt-get install autoconf automake cmake git libass-dev libfreetype6-dev libgnutls28-dev libmp3lame-dev libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev meson ninja-build pkg-config texinfo wget yasm zlib1g-dev
sudo apt install libunistring-dev libaom-dev libdav1d-dev
安装nasm:
sudo apt-get install nasm
安装libx264:
sudo apt-get install libx264-dev
安装libx265:
sudo apt-get install libx265-dev libnuma-dev
安装V8/V9编解码器:
sudo apt-get install libvpx-dev
安装AAC音频编码器:
sudo apt-get install libfdk-aac-dev
安装OPUS音频编解码器:
sudo apt-get install libopus-dev
安装AV1 视频编解码器:
- sudo apt-get install libaom-dev
- sudo apt-get install libsvtav1-dev
- sudo apt-get install libdav1d-dev
sudo apt-get install python3-pip && pip3 install --user meson
编译SVT-AV1编码器:
配置:
- ./configure \
- --prefix="$HOME/ffmpeg_build" \
- --pkg-config-flags="--static" \
- --extra-cflags="-I$HOME/ffmpeg_build/include" \
- --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
- --extra-libs="-lpthread -lm" \
- --ld="g++" \
- --bindir="$HOME/bin" \
- --enable-gpl \
- --enable-gnutls \
- --enable-libaom \
- --enable-libass \
- --enable-libfdk-aac \
- --enable-libfreetype \
- --enable-libmp3lame \
- --enable-libopus \
- --enable-libdav1d \
- --enable-libvorbis \
- --enable-libvpx \
- --enable-libx264 \
- --enable-libx265 \
- --enable-nonfree
编译: make
安装: make install
生成成功
生成位置:
支持H264/H265
macOS编译FFmpeg:
1.安装Xcode与brew
2.安装xcode命令行工具:
xcode-select --install
3.使用brew安装依赖库:
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 x265 xvid nasm
依赖安装成功
配置GCC:
配置:
- ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass
- --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
- --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid
- --samples=fate-suite
编译: make
安装: sudo make install