FFMPEG Installation

FFMPEG and it’s related modules Installation through Script:


All FFmpeg packages are installed from source except codecs. The main dependency for installing ffmpeg is: yum

Ffmpeg installation will only work on redhat and suse (requires yum) distributions. FFmpeg installation will work in cpanel and plesk servers.

How to run:

Wget the above script to /usr/src folder inside your server and run as root:

sh ffmpeg_installer.sh

The menu that shows up is simple and guess you will be able to take it up from here.

FFMPEG Installation(SVN checkout):

Install libx264:

Code: Select all
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20100330-2245.tar.bz2
tar -xvjf x264-snapshot-20100330-2245.tar.bz2
cd x264-snapshot-20100330-2245
./configure --enable-shared
make install

Install FFMPEG:
#svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
#cd ffmpeg

#./configure –enable-gpl –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-avfilter –enable-pthreads –enable-libxvid –enable-libmp3lame –enable-libfaac –disable-ffserver –disable-ffplay –enable-libx264
#make install

error while loading shared libraries:libavdevice.so.52: cannot open shared object file: No such file or directory

To fix this:

vi /etc/ld.so.conf.d/custom-libs.conf

Add the line :/usr/local/lib

And run ldconfig.

To check the ffmpeg


Convert commands:

video file to jpg:

ffmpeg -itsoffset -15 -i ‘file_4bac6a2edd175.wmv’ -vcodec mjpeg -vframes 1 -an -f rawvideo -s ‘320×240′ ’05.jpg’

video file to mp4:

ffmpeg -i ‘video.flv’ -acodec ‘libmp3lame’ -ab 128k -vcodec ‘libx264’ -vpre hq -crf 22 -threads 0 -f mp4 libx264_new.mp4

Install MP4Box Steps:


tar -zxf gpac-0.4.5.tar.gz
tar -zxf gpac_extra_libs-0.4.5.tar.gz
cd gpac_extra_libs
cp -r * ../gpac/extra_lib
cd ../gpac
chmod +x configure
./configure –disable-opengl –use-js=no –use-ft=no –use-jpeg=no –use-png=no –use-faad=no –use-mad=no –use-xvid=no –use-ffmpeg=no –use-ogg=no –use-vorbis=no –use-theora=no –use-openjpeg=no
make lib
make apps
make install-lib
make install
cp ./bin/gcc/libgpac.so /usr/lib/

Convert command:

MP4Box -inter 0.2 -add /var/www/vhosts/thecomeup.tv/httpdocs/new_test/file_4bbbb0a670312.mp4 /var/www/vhosts/thecomeup.tv/httpdocs/videos/file_4bbbb0a670312_conv.mp4

[root@238359-web1 new_test]# /usr/local/bin/MP4Box -inter 0.2 -add /var/www/vhosts/thecomeup.tv/httpdocs/new_test/file_4bbbb0a670312.mp4 /var/www/vhosts/thecomeup.tv/httpdocs/videos/file_4bbbb0a670312_conv.mp4
IsoMedia import – track ID 1 – Video (size 896 x 496)
IsoMedia import – track ID 2 – Audio (SR 44100 – 2 channels)
Saving to /var/www/vhosts/thecomeup.tv/httpdocs/videos/file_4bbbb0a670312_conv.mp4: 0.000 secs Interleaving

FFmpeg, FFmpeg-PHP, Lame, Libogg, Libvorbis, FLVtool2, Mplayer, Mencoder, AMR Manual Installation:

The following HOWTO will show you exactly how to install the following packages on a Debian Etch or Ubuntu 7.06 system:

* FFmpeg
* FFmpeg-PHP
* Mplayer + Mencoder
* flv2tool
* LAME MP3 Encoder
* AMR (for 3gp file conversions)
* Libogg
* Libvorbis

Do some prep-work

yum update
yum upgrade
yum install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential unzip

We need a codec directory

mkdir /usr/local/lib/codecs/

Install Ruby on Rails, subversion & ncurses

yum install subversion ruby libcurses-ruby

Run some SVN queries

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update

Copy Codecs for mplayer

mkdir /usr/local/lib/codecs
mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

We also need to secure the tmp directory

mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp

Install lame

cd /usr/local/src/lame-3.97
make && make install

Install libogg

cd /usr/local/src/libogg-1.1.3
./configure && make && make install

Install libvorbis

cd /usr/local/src/libvorbis-1.2.0
./configure && make && make install

Install flvtool2

cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Install mplayer & mencoder

cd /usr/local/src/mplayer
./configure –enable-jpeg
make && make install

Install AMR (for 3gp conversion)

cd /usr/local/src/amrnb-
make && make install
cd /usr/local/src/amrwb-
make && make install

Install libtheora (for ogg video encoding)

cd /usr/local/src/libtheora-1.0beta3
make && make install

Install ffmpeg
For Centos, Redhat, Fedora Users please use this.

#./configure –enable-gpl –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-avfilter –enable-pthreads –enable-libxvid –enable-libmp3lame –enable-libfaac –disable-ffserver –disable-ffplay –enable-libx264

Debian Etch and Ubuntu 8.04 users please use the following configure command:

cd /usr/local/src/ffmpeg/
./configure –enable-libmp3lame –enable-libvorbis –disable-mmx –enable-shared –enable-libamr-nb –enable-libamr-wb –enable-nonfree –enable-libtheora

Ubuntu 7.06 users please use the following configure command:

./configure –enable-libmp3lame –enable-libogg –enable-libvorbis –disable-mmx –enable-shared –enable-libamr-nb –enable-libtheora

Now run these commands:

make install
ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
ln -s /usr/local/lib/libavcodec.so.52 /usr/lib/libavcodec.so.52
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
ln -s /usr/local/lib/libamrnb.so.3 /usr/lib/libamrnb.so.3
ln -s /usr/local/lib/libamrwb.so.3 /usr/lib/libamrwb.so.3

Install ffmpeg-php

cd /usr/local/src/ffmpeg-php-0.5.0/
make install

You now need to add the new ffmpeg-php module to the php.ini file

vi /etc/php5/apache2/php.ini
extension=ffmpeg.so (add this line to the end of the file)

Restart the Apache

/etc/init.d/apache2 force-reload


/etc/init.d/httpd restart

FFMPEG-MPlayer-Mencoder-Flvtool2-Lame-MP4Box Installation through script:

cd /usr/local/src
tar -xvzf ffmpeginstaller.5.0.tar.gz
cd ffmpeginstaller.5.0
chmod 755 install.sh

Then start the automated installation.


This script will install the following packages in your server.
* ffmpeg
* Mplayer
* A52decoder
* Amrnb and Amrwb
* All codecs
* facc and faad2
* Ruby
* flvtool2
* ffmpeg-php
* Mplayer and Mencoder
* Lame
* Libogg
* Libvorbis
* Libtheora
* Libwmf
* opencoreamr
* vorbistools
* X264
* MP4Box
* Xvidcore

Restart httpd(apache) service.

/etc/init.d/httpd restart

Done. Cheers :)

Join us for the latest updates on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox