centos7环境下二进制编译安装ffmpeg
mkdir -p /usr/local/src/ffmpeg_sources
cd /usr/local/src/ffmpeg_sources
# 安装 nasm
cd /usr/local/src/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2
tar xjvf nasm-2.15.05.tar.bz2
cd nasm-2.15.05
./autogen.sh
./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin"
make -j 4
make install
# 安装 Yasm
cd /usr/local/src/ffmpeg_sources
curl -O -L https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin"
make -j 8
make install
# 安装 freetype-2
yum install -y bzip2
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2
tar -jxvf freetype-2.10.0.tar.bz2
cd freetype-2.10.0
./configure --prefix="/usr/local/ffmpeg_build" --disable-shared
make -j 8
make install
# 安装 libx264
cd /usr/local/src/ffmpeg_sources
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
PKG_CONFIG_PATH="/usr/local/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin" --enable-static
make -j 8
make install
# 安装 libx265
cd /usr/local/src/ffmpeg_sources
git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git
cd /usr/local/src/ffmpeg_sources/x265_git/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make -j 8
make install
# 安装 libfdk_aac
cd /usr/local/src/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg_build" --disable-shared
make -j 8
make install
# 安装 libmp3lame
cd /usr/local/src/ffmpeg_sources
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
tar xzvf lame-3.100.tar.gz
cd lame-3.100
./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin" --disable-shared --enable-nasm
make -j 8
make install
# 安装 libopus
cd /usr/local/src/ffmpeg_sources
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 --prefix="/usr/local/ffmpeg_build" --disable-shared
make -j 8
make install
# 安装 libvpx
cd /usr/local/src/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="/usr/local/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make -j 8
make install
# 安装 FFmpeg
cd /usr/local/src/ffmpeg_sources
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="/usr/local/bin:$PATH" PKG_CONFIG_PATH="/usr/local/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="/usr/local/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I/usr/local/ffmpeg_build/include" \
--extra-ldflags="-L/usr/local/ffmpeg_build/lib" \
--extra-libs=-lpthread \
--extra-libs=-lm \
--bindir="/usr/local/bin" \
--enable-gpl \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree
make -j 8
make install
[root@eus-video-collaboration-file01:~]# ffmpeg -version
ffmpeg version N-102519-gdcb285d2b7 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
configuration: --prefix=/usr/local/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/usr/local/ffmpeg_build/include --extra-ldflags=-L/usr/local/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/usr/local/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 1.100 / 59. 1.100
libavformat 59. 2.100 / 59. 2.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.101 / 8. 0.101
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100