Latest FFMPEG installation on CENTOS 6

October 6, 2015 at 7:31 pm

Most Linux distributions have outdated packages in their repositories so compiling software is the best solution to have the latest updates.
In this post we provide you a walk through to compile ffmpeg with all dependencies on linux CENTOS 6 distribution.

Development tools

Required to compile most of software (the GNU C and C++ compilers and other development utilities)

yum groupinstall "Development Tools" -y

yasm

Yasm is an assembler which helps to improve the conversion speed of ffmpeg when using HD codecs.
It is preferred to install the latest version by compiling its source code.

mkdir /usr/local/src
cd /usr/local/src
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar zxf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure  && make && make install

Check if installation finished successfully

yasm --version
yasm 1.2.0 (this is how the result should look)

LIBOGG

Required to support free, open standard Ogg format

cd /usr/local/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar zxvf libogg-1.3.0.tar.gz
cd /usr/local/src/libogg-1.3.0
make distclean
./configure
make install

Check if installation finished successfully

ls /usr/local/lib/libogg*

You should see something like this:

/usr/local/lib/libogg.a   /usr/local/lib/libogg.so.0
/usr/local/lib/libogg.la  /usr/local/lib/libogg.so.0.8.0

LIBVORBIS

Free open audio compression format fro such type of files like MP3, VQF, AAC.

cd /usr/local/src
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar zxvf libvorbis-1.3.3.tar.gz
cd /usr/local/src/libvorbis-1.3.3
make distclean
./configure && make clean && make && make install 

Check if installation finished successfully

ls /usr/local/lib/libvorbis*

You should see something like this:

/usr/local/lib/libvorbis.a            /usr/local/lib/libvorbisfile.so
/usr/local/lib/libvorbisenc.a         /usr/local/lib/libvorbisfile.so.3
/usr/local/lib/libvorbisenc.la        /usr/local/lib/libvorbisfile.so.3.3.5
/usr/local/lib/libvorbisenc.so        /usr/local/lib/libvorbis.la
/usr/local/lib/libvorbisenc.so.2      /usr/local/lib/libvorbis.so
/usr/local/lib/libvorbisenc.so.2.0.9  /usr/local/lib/libvorbis.so.0
/usr/local/lib/libvorbisfile.a        /usr/local/lib/libvorbis.so.0.4.6
/usr/local/lib/libvorbisfile.la

LibXvid

Xvid ivideo decoder and encoder library.

cd /usr/local/src
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz
tar zxvf xvidcore-1.3.3.tar.gz
cd xvidcore/build/generic
./configure 
make
make install

Check installation:

ls /usr/local/lib/libxvid*

Expected result:

/usr/local/lib/libxvidcore.a    /usr/local/lib/libxvidcore.so.4@
/usr/local/lib/libxvidcore.so@  /usr/local/lib/libxvidcore.so.4.3

Theora

Free and open video compression format from the Xiph.org Foundation.

cd /usr/local/src
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar zxvf libtheora-1.1.1.tar.gz
cd /usr/local/src/libtheora-1.1.1
./configure && make clean && make && make install 

Check installation:

ls /usr/local/lib/libtheora*

Expected result:

/usr/local/lib/libtheora.a            /usr/local/lib/libtheoraenc.so
/usr/local/lib/libtheoradec.a         /usr/local/lib/libtheoraenc.so.1
/usr/local/lib/libtheoradec.la        /usr/local/lib/libtheoraenc.so.1.1.2
/usr/local/lib/libtheoradec.so        /usr/local/lib/libtheora.la
/usr/local/lib/libtheoradec.so.1      /usr/local/lib/libtheora.so
/usr/local/lib/libtheoradec.so.1.1.4  /usr/local/lib/libtheora.so.0
/usr/local/lib/libtheoraenc.a         /usr/local/lib/libtheora.so.0.3.10
/usr/local/lib/libtheoraenc.la

LIBX264

Free open library for encoding video streams into the H.264/MPEG-4 AVC format.

cd /usr/local/src
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xvjf last_x264.tar.bz2
cd x264-snapshot-*
make distclean
./configure --enable-shared && make clean && make && make install

Check installation:

ls /usr/local/lib/libx264*

This should show:

/usr/local/lib/libx264.so  /usr/local/lib/libx264.so.124 

Amr

Used to for encoding to 3GP format, a simplified version of the MPEG-4

cd /usr/local/src
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar zxf opencore-amr-0.1.3.tar.gz
cd /usr/local/src/opencore-amr-0.1.3
make distclean
./configure && make clean && make && make install

Test installation:

ls /usr/local/lib/libopencore*

You should see:

/usr/local/lib/libopencore-amrnb.a
/usr/local/lib/libopencore-amrnb.la
/usr/local/lib/libopencore-amrnb.so
/usr/local/lib/libopencore-amrnb.so.0
/usr/local/lib/libopencore-amrnb.so.0.0.3
/usr/local/lib/libopencore-amrwb.a
/usr/local/lib/libopencore-amrwb.la
/usr/local/lib/libopencore-amrwb.so
/usr/local/lib/libopencore-amrwb.so.0
/usr/local/lib/libopencore-amrwb.so.0.0.3 

libfaac

MPEG-4 and MPEG-2 AAC encoder to encode audio stream using the AAC codec

cd /usr/local/src
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar zxvf faac-1.28.tar.gz
cd /usr/local/src/faac-1.28
./configure && make clean && make && make install

Verify installation:

ls /usr/local/lib/libfaac*

You should see this:

/usr/local/lib/libfaac.a   /usr/local/lib/libfaac.so    /usr/local/lib/libfaac.so.0.0.0
/usr/local/lib/libfaac.la  /usr/local/lib/libfaac.so.0

If compilation of libfaac fails, try to edit the file /usr/local/src/faac-1.28/common/mp4v2/mpeg4ip.h and delete the following line (around line 126)

char *strcasestr(const char *haystack, const char *needle);

And repeat compilation:

make clean && ./configure && make && make install

libfdk-aac

The Fraunhofer FDK AAC codec library, the highest-quality AAC encoder available

yum install unzip
cd /usr/local/src
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure
make
make install
make distclean

Verify installation:

ls /usr/local/lib/libfdk-aac*

You should see:

/usr/local/lib/libfdk-aac.a  /usr/local/lib/libfdk-aac.la*  /usr/local/lib/libfdk-aac.so@  /usr/local/lib/libfdk-aac.so.1@  /usr/local/lib/libfdk-aac.so.1.0.0*

LAME

MP3 format audio encoder

cd /usr/local/src
wget downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
make distclean
./configure && make clean && make && make install

Check installation:

ls /usr/local/lib/libmp3lame*

And you should see:

/usr/local/lib/libmp3lame.a   /usr/local/lib/libmp3lame.so.0
/usr/local/lib/libmp3lame.la  /usr/local/lib/libmp3lame.so.0.0.0
/usr/local/lib/libmp3lame.so

libopus

Open free audio codec for interactive speech and music transmission over the Internet

cd /usr/local/src
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar zxvf opus-1.1.tar.gz
cd opus-1.1
./configure --enable-static --enable-shared
make
make install
ldconfig

Test installation:

ls /usr/local/lib/libopus*

You should see:

/usr/local/lib/libopus.a  /usr/local/lib/libopus.la*  /usr/local/lib/libopus.so@  /usr/local/lib/libopus.so.0@  /usr/local/lib/libopus.so.0.5.0*

libvpx

Enables VP8 and VP9 compression for high picture quality at lower bitrate

cd /usr/local/src
wget https://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
tar xvjf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
./configure --disable-examples --enable-shared && make && make install && ldconfig

Check installation:

ls /usr/local/lib/libvpx*

You should see this:

/usr/local/lib/libvpx.a /usr/local/lib/libvpx.so.1 /usr/local/lib/libvpx.so.1.1.0
/usr/local/lib/libvpx.so /usr/local/lib/libvpx.so.1.1

FFMPEG

Finally ffmpeg, a command line tool that is composed of a collection of free software / open source libraries to record, convert and stream digital audio and video in numerous formats.

cd /usr/local/src
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
wget https://www.ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
tar xjf ffmpeg-snapshot-git.tar.bz2
cd ffmpeg
make distclean
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --disable-static --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvpx --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libtheora --enable-libxvid --enable-libfdk_aac --enable-libopus --enable-libfreetype
make clean && make && make install
make tools/qt-faststart
cp tools/qt-faststart /usr/local/bin/
ldconfig