Article directory
Appendix 2 Compiling FFmpeg under Linux
1 Install dependencies
yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel
2 NASM
NASM is the name of an assembler, the full name is Netwide Assembler, and supports x86 and x64 architecture CPUs (note that ARM architecture is not supported).
wget --no-check-certificate https://www.nasm.us/pub/nasm/releasebuilds/2.15/nasm-2.15.tar.gz
tar -xvf nasm-2.15.tar.gz
cd nasm-2.15/
./configure
make && sudo make install
3 Yasm
YASM is an assembler under the windows platform.
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && sudo make install
4 libx264
The x264 encoding library libx264 implements real video encoding and decoding. The encoding and decoding algorithm is based on block-based hybrid encoding technology, that is, intra-frame/inter-frame prediction, then transforming and quantizing the predicted value, and finally entropy encoding. The types of encoded frames are divided into I frames (x264_type_i), P frames (x264_type_p), and B frames (x264_type_b), which are called image slices in H264.
It is required to configure ffmpeg as --enable-gpl --enable-libx264.
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-shared --enable-static
make && make install
5 libx265
H.265/HEVC video encoder.
It is required to configure ffmpeg as --enable-gpl --enable-libx265.
git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git
cd x265_git/source
cmake ../source
make && make install
6 libfdk_aac
Requires ffmpeg to be configured with --enable-libfdk_aac (and --enable-nonfree if you also included --enable-gpl).
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --disable-shared
make
make install
7 libmp3lame
MP3 audio encoder.
Requires ffmpeg to be configured with --enable-libmp3lame.
wget --no-check-certificate https://sourceforge.net/projects/lame/files/latest/download/lame-3.100.tar.gz
tar xf lame-3.100.tar.gz
cd lame-3.100
./configure --disable-shared --enable-static
make && make install
8 bottles
Opus audio decoder and encoder.
Requires ffmpeg to be configured as --enable-libopus.
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar xzvf opus-1.3.1.tar.gz
cd opus-1.3.1
./configure --disable-shared
make
make install
9 libvpx
The P8/VP9 video encoder and decoder
require ffmpeg to be configured with --enable-libvpx.
git clone https://github.com/webmproject/libvpx.git
cd libvpx
./configure --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install
10 FFmpeg
wget http://www.ffmpeg.org/releases/ffmpeg-5.1.tar.gz
tar xf ffmpeg-5.1.tar.gz
cd ffmpeg
./configure --prefix="/usr/local/ffmpeg" --pkg-config-flags="--static" --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
make
make install