From white Wolf Stack: Check out the original
Ffmpeg installation, some people may have to agonize for a long time, or even for a week, the basic reason is the compilation and installation caused by the disaster.
We provide four installation methods, the most complicated being compiled and installed on Centos7.
- Ffmpeg static library download installation
- Install FFMPEG on your MAC
- Compile and install ffmpeg on centos7
- Install FFMPEG using Docker
You can install it according to your preference.
Why is ffMPEG the most complicated to compile and install on Linux? Because we install many extension libraries before compiling, the codecs to be installed are more or less different for each person’s environment.
Install ffmpeg under Linux, we take centos7 compilation and installation as an example.
Let’s take a look at the system environment
[root@localhost vagrant]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
Copy the code
1. Install dependencies
yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel
Copy the code
If the following error is reported during the dependency installation process
File "/bin/yum", line 30
except KeyboardInterrupt, e:
Copy the code
or
Updates | 2.9 kB 00:00:00 File "/ usr/libexec/urlgrabber - ext - down", line 28 except OSError, e:Copy the code
First check whether the default python is 2.x or 3.x. If 3.x is recommended, change to 2.x and try again.
1) Compile nasM, X264 dependent assembly optimization library
CD/opt/ffmpeg curl https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 - O - L tar XJVF Nasm-2.15.05.tar. bz2 CD nasm-2.15.05. /autogen.sh./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install ln -s /opt/ffmpeg/nasm /usr/bin/nasmCopy the code
2) Compile YASM, which can be understood as ffMPEG dependent assembly optimized library
CD/opt/ffmpeg curl https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz - O - L tar XZVF yasm - 1.3.0. Tar. Gz CD Yasm-1.3.0./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install ln -s / opt/ffmpeg/yasm - 1.3.0 / yasm/usr/bin/yasmCopy the code
3) Compile libx264
cd /opt/ffmpeg
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
Copy the code
Some of you compiling x264, Error Found no assembler, Minimum version is nasM-2.13, If you really want to compile without ASM, Configure with –disable-asm. This means that there is another NASM on your computer that is too old, or nasM that you created in step 1 that you did not add to the environment variable. Make sure that nasM-v is the package that you installed in step 1. Once set up, x264 can proceed from the./configure installation.
4) Compile libx265
cd /opt/ffmpeg git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git cd cd x265_git/build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off .. /.. /source make make installCopy the code
5) Compile liBFDk_aac
cd /opt/ffmpeg
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
Copy the code
6) Compile libmp3lame
CD/opt/ffmpeg curl https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz - O - L tar XZVF Gz CD lame-3.100. /configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm make make installCopy the code
7) Compile libopus
CD/opt/ffmpeg curl https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz - O - L tar XZVF opus - 1.3.1. Tar. Gz CD Opus-1.3.1./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make installCopy the code
8) Compile libvpx
cd /opt/ffmpeg
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install
Copy the code
If the libvpx code doesn’t pull down, try this, all else unchanged
Wget https://github.com/webmproject/libvpx/archive/refs/tags/v1.10.0.tar.gz tar ZXVF v1.10.0. Tar. Gz CD libvpx - 1.10.0Copy the code
Compiling is a long process, and we are halfway there. Now let’s compile and install ffmPEG, today’s main character
Download the latest stability package and start compiling and installing ffMPEG
cd /opt/ffmpeg curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./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 \ --extra-libs=-lm \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libfdk_aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-nonfree make make install hash -d ffmpeg ln -s /opt/ffmpeg/ffmpeg/ffmpeg /usr/bin/ffmpegCopy the code
Finally verify whether the installation is successful
$FFMPEG-Version FFmPEG Version N-102343-G4D3474432F Copyright (C) 2000-2021 The FFMPEG developers built with GCC 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) Configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/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.0.100/59.0.100 libavformat 59.0.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.100Copy the code