You are here

FFmpeg 4.4

Webpage

https://www.ffmpeg.org/

Version

4.4

Build Environment

(CentOS-7/RHEL7 system environment)

Files Required

  • ffmpeg-4.4.tar.bz2

Build Procedure

#!/bin/sh

VERSION=4.4

INSTALLDIR=/local/apl/lx/ffmpeg-${VERSION}
TARBALL=/home/users/${USER}/Software/FFmpeg/${VERSION}/ffmpeg-${VERSION}.tar.bz2
WORKDIR=/work/users/${USER}

# external
NASMVER=2.15.05
NASMURL=https://www.nasm.us/pub/nasm/releasebuilds/${NASMVER}/nasm-${NASMVER}.tar.bz2

YASMVER=1.3.0
YASMURL=https://www.tortall.net/projects/yasm/releases/yasm-${YASMVER}.tar.gz

X264GIT=https://code.videolan.org/videolan/x264.git
X265GIT=https://bitbucket.org/multicoreware/x265_git

#FDKAACGIT=https://github.com/mstorsjo/fdk-aac

MP3LAMEVER=3.100
MP3LAMEURL=https://downloads.sourceforge.net/project/lame/lame/${MP3LAMEVER}/lame-${MP3LAMEVER}.tar.gz

OPUSVER=1.3.1
OPUSURL=https://archive.mozilla.org/pub/opus/opus-${OPUSVER}.tar.gz

VPXGIT=https://chromium.googlesource.com/webm/libvpx.git

PARALLEL=12
export LANG=C

#--------------------------------------------------------------------------
umask 0022
ulimit -s unlimited

cd ${WORKDIR}
if [ -d ffmpeg-${VERSION} ]; then
  mv ffmpeg-${VERSION} ffmpeg-erase
  rm -rf ffmpeg-erase &
fi

# remember this directory
FFMPEG_WORKDIR=${WORKDIR}/ffmpeg-${VERSION}
export PATH="${INSTALLDIR}/bin:${PATH}"
export PKG_CONFIG_PATH="${INSTALLDIR}/lib/pkgconfig"

tar jxf ${TARBALL}

# build NASM
cd ${FFMPEG_WORKDIR}
curl -O -L ${NASMURL}
tar xjf nasm-${NASMVER}.tar.bz2
cd nasm-${NASMVER}
./autogen.sh
./configure --prefix=${INSTALLDIR}
make
make install

# build Yasm
cd ${FFMPEG_WORKDIR}
curl -O -L ${YASMURL}
tar zxf yasm-${YASMVER}.tar.gz
cd yasm-${YASMVER}
./configure --prefix=${INSTALLDIR}
make
make install

# build libx264
cd ${FFMPEG_WORKDIR}
git clone --branch stable --depth 1 ${X264GIT}
cd x264
PKG_CONFIG_PATH="${INSTALLDIR}/lib/pkgconfig" ./configure --prefix=${INSTALLDIR} --enable-static
make
make install

# build libx265
cd ${FFMPEG_WORKDIR}
git clone --branch stable --depth 2 ${X265GIT}
cd x265_git/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${INSTALLDIR} -DENABLE_SHARED:bool=off ../../source
make
make install

## build libfdk_aac
#cd ${FFMPEG_WORKDIR}
#git clone --depth 1 ${FDKAACGIT}
#cd fdk-aac
#autoreconf -fiv
#./configure --prefix=${INSTALLDIR} --disable-shared
#make
#make install

# build libmp3lame
cd ${FFMPEG_WORKDIR}
curl -O -L ${MP3LAMEURL}
tar xzf lame-${MP3LAMEVER}.tar.gz
cd lame-${MP3LAMEVER}
./configure --prefix=${INSTALLDIR} --disable-shared --enable-nasm
make
make install

# build libopus
cd ${FFMPEG_WORKDIR}
curl -O -L ${OPUSURL}
tar zxf opus-${OPUSVER}.tar.gz
cd opus-${OPUSVER}
./configure --prefix=${INSTALLDIR} --disable-shared
make
make install

# build libvpx
cd ${FFMPEG_WORKDIR}
git clone --depth 1 ${VPXGIT}
cd libvpx
./configure --prefix=${INSTALLDIR} --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install

# ffmpeg
cd ${FFMPEG_WORKDIR}
./configure --prefix=${INSTALLDIR} \
            --pkg-config-flags="--static" \
            --extra-cflags="-I${INSTALLDIR}/include" \
            --extra-ldflags="-L${INSTALLDIR}/lib" \
            --extra-libs=-lpthread \
            --extra-libs=-lm \
            --bindir="${INSTALLDIR}/bin" \
            --enable-gpl \
            --enable-libfreetype \
            --enable-libmp3lame \
            --enable-libopus \
            --enable-libvpx \
            --enable-libx264 \
            --enable-libx265
            #--enable-libfdk_aac \
make
make install

Notes

  • The official procedure is available at https://trac.ffmpeg.org/wiki/CompilationGuide/Centos.
  • Nonfree, not redistributable packages are skipped. (You can enable them upon configure of ffmpeg by adding --enable-nonfree option.)
    • To avoid the potential license issue, libfdk_aac is disabled.