
Complete FFMPEG + FLVtool2 + mplayer + a52 + FADD2 + FAAC + LAME + YASM + x264 + Xvid + Opencore AMR + installation on Cent os 5.x and Red Hat
I hope this tutorial will help to those who are struggling to figure out how to get FFMPEG to install and to have it work with as many input video formats as possible. This tutorial covers up multiple video format conversion including 3GP conversions for mobile phones.
I have decided to split this article in 2 parts. In first part we will learn ways and methods to install FFMPEG newest version up-to the date and in next article we will see some basic FFMPEG conversions on the fly with Cent OS 5.x and Red Hat server environment.
There are a couple of different ways to install FFMpeg and the required libraries. Lets see easy method of installation Method 1 but personally I recommended Method 2 because it retrieves most updated source files as compare to Method 1.
Method 1:
nstall the additional repo
rpm -Uhv http: //apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Update repository
yum -y update
Install all necessary packages
yum install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel yum install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel yum install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel yum install libid3tag libogg-devel libvorbis-devel mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel xvidcore xvidcore-devel zlib-devel yum install amrnb-devel amrwb-devel yum install libtheora libtheora-devel yum install glibc gcc gcc-c++ autoconf automake libtool yum install subversion yum install ncurses-devel yum install libdc1394 libdc1394-devel yum install yasm nasm
Install the essential codecs from FFmepg
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2 bunzip2 all-20071007.tar.bz2; tar xvf all-20071007.tar mkdir /usr/local/lib/codecs/ mkdir /usr/local/lib64/codecs/ cp all-20071007/* /usr/local/lib/codecs/ cp all-20071007/* /usr/local/lib64/codecs/ chmod -R 755 /usr/local/lib/codecs/ chmod -R 755 /usr/local/lib64/codecs/
Grab FFmpeg
svn checkout -r 20525 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
Grab the x264 library
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20091031-2245.tar.bz2 bunzip2 x264-snapshot-20091031-2245.tar.bz2; tar xvf x264-snapshot-20091031-2245.tar Make sure x264 has not been installed yum erase x264* Compile x264 cd x264 ./configure --enable-shared --prefix=/usr make make install
Compile FFmpeg (the configure options have to be on one line)
cd ffmpeg ./configure --enable-gpl --enable-nonfree --enable-postproc --enable-libfaad --enable-avfilter --enable-pthreads \ --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libfaac --disable-ffserver --disable-ffplay \ --enable-libtheora --enable-libvorbis --disable-ffplay --enable-shared --enable-avfilter-lavf --arch=x86_64 make make install
(The –arch=x86_64 option should only be used if you are on a 64Bit System!)
Edit ld.so.conf
vi /etc/ld.so.conf
add this new line
/usr/local/lib
Activate the shared libraries
ldconfig
That’s it. This should give you a full functional FFMpeg installation. Test it now with;
ffmpeg
This should give you the following back (yours might vary a bit);
FFmpeg version SVN-r20525, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --enable-gpl --enable-nonfree --enable-postproc --enable-libfaad --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libfaac --disable-ffserver --disable-ffplay --enable-libamr-nb --enable-libamr-wb --enable-libtheora --enable-libvorbis --disable-ffplay --enable-shared libavutil 50. 4. 0 / 50. 4. 0 libavcodec 52.39. 0 / 52.39. 0 libavformat 52.39. 2 / 52.39. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1. 8. 0 / 1. 8. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0
Try to convert a movie with;
ffmpeg -i movie.mov -vcodec libx264 -vpre hq -acodec libfaac movie.mp4
Method 2:
This is a manual installation method. Be careful while installing using this method.
If you don’t already have the epel repository
note: several install guides suggest adding other repositories – this procedure attempts a manual compilation of ffmpeg specifically to avoid adding extra repositories that may cause other problems with CentOS – thus only the epel and centos repos are assumed here.
wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uvh epel-release-5*.rpm
If you already have epel start here:
First Download all required libraries
git clone git://git.videolan.org/ffmpeg.git ffmpeg wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz wget http://downloads.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz wget http://downloads.sourceforge.net/project/libdc1394/libdc1394-2/2.1.2/libdc1394-2.1.2.tar.gz wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz yum install yasm nasm yum install php-devel yum install libvpx* yum install git git clone git://git.videolan.org/x264.git
Extract above packages
tar -zxf lame-3.98.4.tar.gz tar -zxf xvidcore-1.2.2.tar.gz tar -jxf ffmpeg-php-0.6.0.tbz2 tar -zxf a52dec-0.7.4.tar.gz tar -zxf faad2-2.7.tar.gz tar -zxf faac-1.28.tar.gz tar -zxf libraw1394-2.0.5.tar.gz tar -zxf libdc1394-2.1.2.tar.gz tar -zxf opencore-amr-0.1.2.tar.gz tar -jxf essential-20071007.tar.bz2 tar -jxf libtheora-1.1.1.tar.bz2 tar -zxf libogg-1.1.4.tar.gz tar -zxf libvorbis-1.2.3.tar.gz
Make directory for codec Note that this is for 32-bit OS.
mkdir /usr/local/lib/codecs/ cp ./essential-20071007/* /usr/local/lib/codecs/ <a href="http://en.wikipedia.org/wiki/Chmod">chmod</a> -R 755 /usr/local/lib/codecs/
Alternatively For 62 Bit OS
mkdir /usr/local/lib64/codecs/ cp ./essential-20071007/* /usr/local/lib64/codecs/ chmod -R 755 /usr/local/lib64/codecs/
Now lets start actual configuration and installation. We will now go inside each extracted directory and install modules.
cd <a href="http://en.wikipedia.org/wiki/X264">x264</a> ./configure --enable-shared make make install cd .. cd xvidcore/build/generic ./configure make make install cd ../../../ cd lame-3.98.4 ./configure make make install cd .. cd a52dec-0.7.4 ./configure --enable-shared=PKGS make make install cd .. cd faad2-2.7 autoreconf -vif ./configure make make install cd .. cd faac-1.28 ./bootstrap ./configure make make install cd .. cd libraw1394-2.0.5 ./bootstrap ./configure make make install cd .. cd libdc1394-2.1.2 ./configure make make install cd .. cd opencore-amr-0.1.2 ./configure make make install cd .. cd libogg-1.1.4 ./configure make make install cd .. cd <a href="http://en.wikipedia.org/wiki/Vorbis">libvorbis</a>-1.2.3 ./configure make make install cd .. cd libtheora-1.1.1 ./configure make make install cd ..
Now export new library path so that your OS can understand path for codecs and modules at the time of real conversion.
export LD_LIBRARY_PATH=/usr/local/lib/ echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf ldconfig
Now install FFMPEG and enable Modules for that.
cd ffmpeg ./configure --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --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 --extra-cflags=-fPIC make make install cd .. ldconfig
Many video sharing scripts require FFMPEG-PHP. Following is to add ffmpeg-php if you need that.
cd ffmpeg-php-0.6.0
For version 0.6.0 fix a typo in the framer function:
Copy & Paste each line seperately
vi ffmpeg_frame.c :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32 :wq
phpize ./configure make make install cd ..
Locate your php.ini
locate php.ini
Note: Your php.ini file location may be different according to the server setup and control panel or some addons like suPHP. The easyest way to find your loaded php.ini file is run php code into blank php file eg. info.php as
<?php phpinfo(); ?>
Generally php.info can be seen at /etc/into php.ini
Now, Lets edit php.ini to inform web server that ffmpeg is installed.
vi /etc/into php.ini # add the line: extension=ffmpeg.so :wq
Finally we restart our HTTP server for changes to take effect.
/etc/rc.d/init.d/httpd restart
T hats it, Your FFMPEG is now configured and ready to use.
Feel free to comments, Ask Questions and Give Suggestions.