Install FFMPEG on CentOS/Fedora/RHEL : Easy Steps

Install FFMPEG
FFmpeg is a collection of different projects for handling multimedia files. This article will help you to know how to install FFMPEG on CentOS/Fedora/RHEL.

This is my installation guide to install FFMPEG and all the latest apps, and you can blind follow it, and at the end, you will get an FFMPEG server with all related apps.

 

As you know, the new FFMPEG versions like Angel, Happiness, or Freedom don’t have ffmpeg-php module support. So to be on the safe side, we will be installing the SVN version “SVN-r26402”.

FFMPEG official download site here ( You can see the latest versions here, but as I said before, we will be installing – “SVN-r26402” )

Atomic Repo ( Because you are going to install a bunch of apps and modules, and your default repo probably don’t have it at all )

wget -q -O - http://www.atomicorp.com/installers/atomic | sh

 

Install git ( We will need it for installing the “x264” library )

# Add the repository

rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

 

# Install the latest version of git

yum install --enablerepo=webtatic git-all

 

if not working, try the below ( If you are installing it under the cPanel system. You will get some dependency error, and that is because cPanel, by default, have some packages in the “yum exclude” list )

yum --disableexcludes=main --enablerepo=webtatic install git-all

 

Make our system ready

Yes, before you install FFMPEG, we need to make your system ready for this. So let’s install some required libraries and compilation tools.

yum install pkgconfig nasm gcc.x86_64 gcc-c++.x86_64 php-gd.x86_64 ruby php-devel.x86_64

 

Note: If your system is 32bit. Remove that “.x86_64” from the above packages.

Let’s start the installation

mkdir /opt/FFMPEG; cd /opt/FFMPEG

 

Download the packages given below. If some links are not working, the developers may change the path or they stopped that version. Sourceforge uses to change the URL frequently. Common, you have Google and ask where you can find that app ?

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
or
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
wget http://nchc.dl.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
wget http://nchc.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
wget http://nchc.dl.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz
wget http://voxel.dl.sourceforge.net/project/libdc1394/libdc1394-2/2.2.0/libdc1394-2.2.0.tar.gz
wget http://nchc.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc4.tar.gz
wget http://openjpeg.googlecode.com/files/openjpeg-1.5.0.tar.gz

 

Download x264

git clone git://source.ffmpeg.org/x264.git

 

do not try unless git doesn’t work out >> ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 git clone

http://git.chromium.org/webm/libvpx.git

 

Untar the packages

tar -xvf *.bz2&& tar -xvf *.tbz2&& tar -xvf *.bz2

 

Configure the supporting modules and applications

Install Yasam

cd yasm-1.2.0
./configure
make
make install

 

Setting up Mplayer codec

cd ..
mkdir /usr/local/lib/codecs
cp ./essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

 

For 64 Bit Systems ALSO do this:

mkdir /usr/local/lib64/codecs/
cp ./essential-20071007/* /usr/local/lib64/codecs/
chmod -R 755 /usr/local/lib64/codecs/

 

Configure x264

cd x264 
./configure --enable-shared 
make 
make install 
cd ..

 

( if git not working. download this and compile >> wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080630-2245.tar.bz2

 

Configure xvidcore

cd xvidcore/build/generic 
./configure
make
make install
cd ../../../

 

Configure Lame

cd lame-3.99.5
./configure
make
make install
cd ..

 

Configure a52dec

cd a52dec-0.7.4
./configure --enable-shared=PKGS
make
make install
cd ..

 

Configure Faad

cd faad2-2.7
./configure
make
make install
cd ..

 

Configure Faac

cd faac-1.28
./configure
make
make install
cd ..

 

Configure Libraw

cd libraw1394-2.0.5
./configure
make
make install
cd ..

 

Configure Libdc

cd libdc1394-2.2.0
./configure
make
make install
cd ..

 

Configure OpencoreAMR

cd opencore-amr-0.1.3
./configure
make
make install
cd ..

 

Configure Libogg

cd libogg-1.3.0
./configure
make
make install
cd ..
echo /usr/local/lib >> /etc/ld.so.conf; ldconfig

 

Configure Libvorbis

cd libvorbis-1.3.3
./configure
make
make install
cd ..

 

Configure Libtheora

cd libtheora-1.1.1
./configure
make
make install
cd ..

 

Configure Flvtools

cd flvtool2-1.0.6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

 

Configure OPenJPEG

cd openjpeg-1.5.0
./configure
make
make install
cd ..

 

Configure MP4box

yum install freetype-devel.x86_64 SDL-devel.x86_64 freeglut-devel.x86_64

 

Note: If your system is 32bit. Remove that “.x86_64” from the above packages.

export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
ldconfig

 

Configure ffmpeg ( Yes. At last let’s configure and install FFmpeg )

cd ffmpeg
./configure --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --disable-ffplay --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libopenjpeg

 

( When configuring if you get some errors regarding unsupported features, remove that from the above and recompile. Also so let me know the error and we will find a solution )

make 
make install

 

Configure FFMPEG-PHP module

cd ffmpeg-php-0.6.0

 

For version 0.6.0 copy & paste each line given below separately to fix a typo in the framer function:

vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:wq

 

Now continue with the compilation.

phpize 
./configure 
make 
make install 
cd ..

 

Add the module details in the php.ini file

your php.ini maybe somewhere else

Find it by running the below command.

php -i | grep php.ini
vim php.ini

 

Add the line:

extension=ffmpeg.so

 

Restart Apache.

/etc/init.d/httpd restart

 

Install Mplayer

./configure 
make 
make install

 

Verify the working

ffmpeg
php -i | grep ffmpeg
php -m | grep ffmpeg
which ffmpeg
which lame
which mencoder
which mplayer
which faac
which faad
which x264
which a52dec
which flvtool2

 

So this is how you install FFMPEG and all related apps.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Linux Management Services

Focus on your business, and let us take care of your Linux Servers!
From what you are reading, it seems you are interested in Linux and related technologies. If you have a moment to spare, please take a look at our Linux Management Services plan, which might interest you even more!
Linux Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

ServerHealers uses cookies.