FFmpeg is a free software project that produces libraries and programs for handling multimedia data. This tutorial will help you to install FFMPEG on cPanel / CensOS server.

Install FFMPEG

Update rpmforge

for 32 bit OS versions:

 
wget http://downloads.naulinux.ru/pub/SLCE/6x/i386/CyrEd/RPMS//rpmforge-release-0.5.2-2.1.el6.i686.rpm
rpm -ivh rpmforge-release-0.5.2-2.1.el6.i686.rpm

for 64 bit OS versions:

 
wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Please click on the button to see how to install rpmforge on other CentOS versions: Here

Install utilities

RedHat/Centos:

 
yum groupinstall -y "Development Tools"

or

 
yum install zlib-devel automake autoconf gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran gcc-c++ mesa-libGL-devel mesa-libGLU-devel libXi-devel libXmu-devel freeglut-devel freeglut libtool ncurses-devel

Debian/Ubuntu:

 
apt-get install build-essential

Add below entry in /etc/ld.so.conf

 
vim /etc/ld.so.conf

add the following:

 
/usr/local/lib
/usr/lib
 
ldconfig

libogg

libogg contains necessary functionality to create, decode, and work with Ogg bitstreams. Ogg is a free, open container format maintained by the Xiph.Org Foundation.

 
cd /usr/local/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
tar zxvf libogg-1.2.2.tar.gz
cd /usr/local/src/libogg-1.2.2
./configure && make clean && make && make install
ldconfig

libvorbis

Libvorbis is the reference implementation of the Vorbis codec. It is the lowest-level interface to the Vorbis encoder and decoder, working with packets directly.

 
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 libvorbis-1.3.3
./configure && make clean && make && make install

Yasm

Yasm is an assembler and disassembler for the Intel x86 architecture. It can be used to write 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs.

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

libx264

x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format, and is released under the terms of the GNU GPL.

 
cd /usr/local/src
wget https://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2
tar jxf last_stable_x264.tar.bz2
cd x264-*
./configure --enable-shared && make clean && make && make install

amr

The Adaptive Multi-Rate (AMR or AMR-NB or GSM-AMR) audio codec is an audio compression format optimized for speech coding. AMR speech codec consists of a multi-rate narrowband speech codec that encodes narrowband (200–3400 Hz) signals at variable bit rates ranging from 4.75 to 12.2 kbit/s with toll quality speech starting at 7.4 kbit/s.

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

neroAacEnc

neroAacEnc is Improved multichannel encoding and Multipass encoding, Solved issue with very long files and -2pass.

 
cd /usr/local/src
wget wget http://ftp6.nero.com/tools/NeroAACCodec-1.5.1.zip
unzip -j NeroAACCodec-1.5.1.zip
install -m 0755 neroAacEnc /usr/bin/
yum -y install gpac

mediainfo

MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files.

 
cd /usr/local/src
wget http://downloads.sourceforge.net/zenlib/libzen0-0.4.29-1.x86_64.CentOS_6.rpm
rpm -ivh libzen0-0.4.29-1.x86_64.CentOS_6.rpm
wget http://sourceforge.net/projects/mediainfo/files/binary/libmediainfo0/0.7.64/libmediainfo0-0.7.64-1.x86_64.CentOS_6.rpm
rpm -ivh libmediainfo0-0.7.64-1.x86_64.CentOS_6.rpm
wget http://sourceforge.net/projects/mediainfo/files/binary/mediainfo/0.7.64/mediainfo-0.7.64-1.x86_64.CentOS_6.rpm
rpm -ivh mediainfo-0.7.64-1.x86_64.CentOS_6.rpm

faac

FAAC or Freeware Advanced Audio Coder is a software project which includes the AAC encoder FAAC and decoder FAAD2. It supports MPEG-2 AAC as well as MPEG-4 AAC.

 
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

Please note that you may receive an error like below:

mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’
/usr/include/string.h:369: error: ambiguates old declaration ‘const char* strcasestr(const char*, const char*)’
make[3]: *** [3gp.o] Error 1
make[3]: Leaving directory `/usr/local/src/faac-1.28/common/mp4v2′
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/faac-1.28/common’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/faac-1.28′
make: *** [all] Error 2

You can resolve it by removing the content “char *strcasestr(const char *haystack, const char *needle);” in the file /usr/local/src/faac-1.28/common/mp4v2/mpeg4ip.h from line 126. Then you need to run the following command again.

 
./configure && make && make install

lame

LAME is a program which can be used to create compressed audio files. (Lame ain’t an MP3 encoder). These audio files can be played back by popular MP3 players such as mpg123 or madplay.

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

flvtool2

FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV).

 
cd /usr/local/src
wget ftp://mirror.xmission.com/salix/x86_64/extra-14.2/source/multimedia/flvtool2/flvtool2-1.0.6.tgz
tar -zxvf flvtool2-1.0.6.tgz
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config && ruby setup.rb setup && ruby setup.rb install

If you have not installed ruby on your server, please run following command.

 
/scripts/installruby (For cPanel)

yamdi

yamdi stands for Yet Another MetaData Injector. It adds the onMetaData event to your FLV files.

 
cd /usr/local/src
wget http://iweb.dl.sourceforge.net/project/yamdi/yamdi/1.9/yamdi-1.9.tar.gz
tar zxvf yamdi-1.9.tar.gz
cd yamdi-1.9
gcc yamdi.c -o yamdi -O2 -Wall -D_FILE_OFFSET_BITS=647
cp yamdi /usr/bin/

Install FFmpeg

FFMPEG is a command line tool that is composed of a collection of free software / open source libraries. It includes libavcodec, an audio/video codec library used by several other projects, and libavformat, an audio/video container mux and demux library.

 
cd /usr/local/src
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
wget http://ffmpeg.org/releases/ffmpeg-0.7.11.tar.gz
tar xzf ffmpeg-0.7.11.tar.gz
cd ffmpeg-0.7.11
make distclean
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libfaac
make clean && make && make install
make tools/qt-faststart
cp tools/qt-faststart /usr/local/bin/
ldconfig

MPLAYER (MENCODER)

MENCODER is a free command line video decoding, encoding and filtering tool released under the GNU General Public License.

 
cd /usr/local/src
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2
tar jxvf all-20110131.tar.bz2
mv /usr/local/src/all-20110131 /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc4.tar.bz2
tar jxf MPlayer-1.0rc4.tar.bz2
cd MPlayer-1.0rc4
make clean
./configure && make && make install && ldconfig

Install FFMPEG -PHP

FFMPEG-PHP is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files.

 
cd /usr/local/src
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
tar jxf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
sed -i 's#PIX_FMT_RGBA32#PIX_FMT_RGB32#' ./ffmpeg_frame.c
phpize
./configure && make clean && make && make install

If you are getting the error “make: *** [ffmpeg_movie.lo] Error 1”, you need to change the following on the file “ffmpeg_movie.c”

row 311: list_entry *le; to zend_rsrc_list_entry *le;
row 346: list_entry new_le; to zend_rsrc_list_entry new_le;
row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), to hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

Then run the following commands again.

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

Add extension of ffmpeg in php.ini file.

 
vim /usr/local/lib/php.ini

add the following.

 
extension=ffmpeg.so

The last step is to check all installed modules.

 
php -m | grep ffmpeg
which php ffmpeg mplayer mencoder flvtool2 yamdi MP4Box neroAacEnc mediainfo

 

Was this answer helpful? 0 Users Found This Useful (1 Votes)