Compile FFMPEG source code under CentOS7

Compile FFMPEG source code under CentOS7###

1. Compile FFMpeg related materials under CentOs7##

Found an article about compiling FFMPEG source code under CentOS7, the address is: Compile FFmpeg on CentOS

You can follow along if necessary. In addition, the download of some decoding libraries x264, x265, libvpx and other software source code packages required to compile ffmpeg source code can be downloaded directly from www.linuxfromscratch.org, as shown in the following figure:

When installing software using source code in Linux, sometimes it is necessary to install the corresponding dependencies. It is very convenient to download the corresponding software source code from http://www.linuxfromscratch.org/blfs/view/svn/index.html.

2. Scripts to compile and install ffmpeg and related dependent libraries under CentOS7##

1、 Ready to work###

Before compiling and installing ffmpeg and related dependencies, you need to ensure that the following compilation tools are installed:

yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

2、 One-click Shell compilation script build_ffmpeg_all.sh

The compilation script is as follows:

# install required software package
# yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

mkdir ~/ffmpeg_sources

INSTALL_PATH=/usr/local

# build and install nasm
# An assembler used by some libraries. Highly recommended or your resulting build may be very slow.
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar xjvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02./autogen.sh
. /configure --prefix="$INSTALL_PATH"--bindir="$INSTALL_PATH/bin"
make
make install

# build and install Yasm
# An assembler used by some libraries. Highly recommended or your resulting build may be very slow.
cd ~/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="$INSTALL_PATH"--bindir="$INSTALL_PATH/bin"
make
make install

# build and install libx264
# H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples.
# Requires ffmpeg to be configured with--enable-gpl --enable-libx264.
cd ~/ffmpeg_sources
git clone --depth 1 https://code.videolan.org/videolan/x264.git
curl -O -L http://anduin.linuxfromscratch.org/BLFS/x264/x264-20200819.tar.xz
xz -d x264-20200819.tar.xz
tar -xvf x264-20200819.tar
mv x264-20200819 x264
cd x264
PKG_CONFIG_PATH="$INSTALL_PATH/lib/pkgconfig"./configure --prefix="$INSTALL_PATH"--bindir="$INSTALL_PATH/bin"--enable-static
make
make install

# build and install libx265
# H.265/HEVC video encoder. See the H.265 Encoding Guide for more information and usage examples.
# Requires ffmpeg to be configured with--enable-gpl --enable-libx265.
cd ~/ffmpeg_sources
# hg clone https://bitbucket.org/multicoreware/x265
curl -O -L http://anduin.linuxfromscratch.org/BLFS/x265/x265_3.4.tar.gz
tar -xzvf x265_3.4.tar.gz
mv x265_3.4 x265
cd ~/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles"-DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"-DENABLE_SHARED:bool=off ../../source
make
make install

# build and install libfdk_aac
# AAC audio encoder. See the AAC Audio Encoding Guide for more information and usage examples.
# Requires ffmpeg to be configured with--enable-libfdk_aac(and --enable-nonfree if you also included --enable-gpl).
cd ~/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
. /configure --prefix="$INSTALL_PATH"--disable-shared
make
make install

# build and install libmp3lame
# MP3 audio encoder.
# Requires ffmpeg to be configured with--enable-libmp3lame.
cd ~/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="$INSTALL_PATH"--bindir="$INSTALL_PATH/bin"--disable-shared --enable-nasm
make
make install

# build and install libopus
# Opus audio decoder and encoder.
# Requires ffmpeg to be configured with--enable-libopus.
cd ~/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="$INSTALL_PATH"--disable-shared
make
make install

# libvpx
# VP8/VP9 video encoder and decoder. See the VP9 Video Encoding Guide for more information and usage examples.
# Requires ffmpeg to be configured with--enable-libvpx.
cd ~/ffmpeg_sources
# git clone --depth 1 https://github.com/webmproject/libvpx.git
curl -O -L https://github.com/webmproject/libvpx/archive/v1.9.0/libvpx-1.9.0.tar.gz
tar xzvf libvpx-1.9.0.tar.gz
cd libvpx-1.9.0./configure --prefix="$INSTALL_PATH"--disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install

# build and install FFmpeg
cd ~/ffmpeg_sources
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$INSTALL_PATH/bin:$PATH" PKG_CONFIG_PATH="$INSTALL_PATH/lib/pkgconfig"./configure \
 - - prefix="$INSTALL_PATH" \
 - - pkg-config-flags="--static" \
 - - extra-cflags="-I$INSTALL_PATH/include" \
 - - extra-ldflags="-L$INSTALL_PATH/lib" \
 - - extra-libs=-lpthread \
 - - extra-libs=-lm \
 - - bindir="$INSTALL_PATH/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

3、 Execute the script build_ffmpeg_all.sh

Before executing the script, you need to ensure that you use the root account or super account permissions, and then add executable permissions to build_ffmpeg_all.sh:

chmod +x build_ffmpeg_all.sh

Finally, execute the script

sh build_ffmpeg_all.sh

Three, reference materials##

Recommended Posts

Compile FFMPEG source code under CentOS7
Centos compile JDK8 source code
CentOS7.5 source code compile and install mysql5.7.29
Ubuntu 18.04 source code compile and install ffmpeg4.1
CentOS7.4 source code compile and install MySQL8.0
Install MySQL 8.x from source code under CentOS7
Compile and install OpenJDK8 from source code under Ubuntu 18.04.1
Compile and install LAMP under Centos 5.2
FFmpeg environment deployment record under centos7
Compile and install libmodbus library under CentOS7
Deploy GitBook under CentOS7
Install mysql5.7 under CentOS7
Install FFmpeg on CentOS 8
Centos source installation Python3
Install CentOS under VMware
Deploy JDK+Tomcat8 under CentOS
Install mysql under Centos 7
Configure lamp under centos6.8
Install Jenkins under Centos 7
Redis3 installation under Centos7
Install MariaDB under MariaDB Centos7
Install mysql5.1 under CentOS6.5
Compile and install Lnmp shell script under Linux centos
CentOS 5 to CentOS 5.8 YUM source
Compile and install the open source EDA tool-Surelog on CentOS8
Deploy the open source continuous integration tool Jenkins under CentOS7
Xen virtualization combat under CentOS 6.6
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Build docker environment under Centos6.5
Build OpenV** Server under CentOS7
CentOs7.3 compile and install Nginx 1.9.9
Redis cluster installation under CentOS
Centos compile and install Git
Configure static IP under CentOS 7
3 partitioning tools under CentOS Linux
Install MySQL under Linux (CentOS 7)
Root password cracking under CentOS 7
Install Java JDK8 under CentOS6
Centos7 compile and install ntp-4.2.8p11
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
Install MongoDB database under CentOS7
CentOS 6.8 under linux install mongodb
Set static IP under Centos
Install Mesos tutorial under CentOS7