First you need to install the Dag Repository:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Follow this guide to set up yum-priorities: http://wiki.centos.org/PackageManagement/Yum/Priorities
Then you need to install ffmpeg, ffmpeg-devel, and ffmpeg-libpostproc.
yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc mencoder
Method #1: Using yum
First, make sure the following binary packages are installed on your server:
gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion
for gmake install centos
yum groupinstall 'Development Tools'
yum install gcc*
/scripts/installruby
f any of these packages are missing, install them using Yum . For example:
yum install PACKAGE
Install RPMForge Respository
rpm -Uhv ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Install ffmpeg, mplayer, mencoder with all supported libraries/modules
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
Manually, install FFmpeg-Php
cd /usr/local/src
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install
If FFmpeg-Php is compiled successfully, an ffmpeg.so module will be generated and copied into the default Php directory. Next, run the following command to enable FFmpeg-Php. By running this command you will be adding ffmpeg.so module into the php.ini file:
echo 'extension=ffmpeg.so' >> /local_path_to_your/php.ini
Final step, restart apache
service httpd restart
OR
/etc/init.d/httpd restart
- Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:
php -r 'phpinfo();' | grep ffmpeg
You will get a few lines similar to the following:
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April 15 2010 15:31:45
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0
This is the second command to make sure that FFmpeg is working properly:
/usr/local/bin/ffmpeg
If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, and FLV2tool are working properly on your server. CONGRATULATIONS!
Method #1: Source archives/packages
*** Caution
You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
Follow these steps (in that order):
First, make sure the following binary packages are installed on your server:
gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion
If any of these packages are missing, install them using Yum . For example:
yum install PACKAGE
*** Caution
The following source packages are always updated with newer versions. You might experience technical issues if you download and install a newer/older version of any of these applications.
You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
To install FFmpeg from source, execute the following commands (in that order).
Let's create a directory to do our work in:
mkdir /usr/local/src
cd /usr/local/src
Download source packages
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-ppc-20071007.tar.bz2
wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2
wget http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
wget http://biznetnetworks.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.2.tar.gz
wget http://downloads.sourceforge.net/project/re2c/re2c/0.13.5/re2c-0.13.5.tar.gz
wget http://download.m0k.org/handbrake/contrib/xvidcore-1.1.3.tar.gz
wget http://downloads.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080324-2245.tar.bz2
Extract source packages
tar xzf a52dec-0.7.4.tar.gz
tar jxvf amrnb-7.0.0.2.tar.bz2
tar jxvf amrwb-7.0.0.2.tar.bz2
tar jxvf essential-ppc-20071007.tar.bz2
tar jxvf faac-1.28.tar.bz2
tar xzf faad2-2.7.tar.gz
tar jxvf ffmpeg-php-0.6.0.tbz2
tar zxvf flvtool2-1.0.6.tgz
tar xzf lame-3.98.4.tar.gz
tar xzf libogg-1.1.4.tar.gz
tar jxvf libtheora-1.1.1.tar.bz2
tar xzf libvorbis-1.2.2.tar.gz
tar xzf re2c-0.13.5.tar.gz
tar xzf xvidcore-1.1.3.tar.gz
tar jxvf x264-snapshot-20080324-2245.tar.bz2
Create the codecs directory & export files
mkdir /usr/local/lib/codecs
mv /usr/local/src/essential-ppc-20071007/* /usr/local/lib/codecs
chmod -R 755 /usr/local/lib/codecs
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
Install SVN and Ruby (for RedHat/CentOS v5.x)
yum install subversion
yum install ruby
OR (if you are using the cPanel control panel )
/scripts/installruby
/usr/local/cpanel/bin/ror_setup
yum install ncurses-devel
Compile and install FLVtool2
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
Compile and install LAME
cd /usr/local/src/lame-3.98.4
./configure
make
make install
Compile and install libOGG
cd /usr/local/src/libogg-1.1.4
./configure
make
make install
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Compile and install LibVorbis
cd /usr/local/src/libvorbis-1.2.2
./configure
make
make install
Compile and install Libtheora
cd /usr/local/src/libtheora-1.1.1
./configure --with-ogg-libraries=/usr/local/lib/
make
make install
Compile and install amrNB
cd /usr/local/src/amrnb-7.0.0.2
./configure
make
make install
Compile and install amrWB
cd /usr/local/src/amrwb-7.0.0.2
./configure
make
make install
Compile and install Liba52
cd /usr/local/src/a52dec-0.7.4
./bootstrap
ARCh='arch'
./configure --enable-shared
make
make install
Compile and install FAAC
cd /usr/local/src/faac-1.28
./bootstrap
./configure --with-mp4v2
make
make install
Compile and install FAAD
cd /usr/local/src/faad2-2.7
./configure --with-mpeg4ip
make
make install
Compile and install XVIDCore
cd /usr/local/src/xvidcore/build/generic/
./configure
make
make install
Compile and Install X264 Snapshot
cd /usr/local/src/x264-snapshot-20080324-2245
./configure --enable-shared
make
make install
Compile and install RE2C
cd /usr/local/src/re2c-0.13.5
./configure
make
make install
cp -aP /usr/local/bin/re2c /usr/bin/
Download the latest release for FFmpeg and MPlayer from svn.mplayerhq.hu
cd /usr/local/src
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg -r 15594
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
svn update
Compile and install MPlayer
cd /usr/local/src/mplayer
./configure
make
(STOP here.) Make sure MPlayer has been compiled successfully with NO errors. Do NOT proceed any further unless the MPlayer package has been compiled successfully.
make install
Compile and install FFmpeg
cd /usr/local/src/ffmpeg/
mkdir /usr/local/src/ffmpeg/tmp
export TMPDIR=/usr/local/src/ffmpeg/tmp
(The following ./configure command is one single line)
./configure --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-liba52 --enable-libamr-nb --enable-libamr-wb --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-cross-compile
make
(STOP here.) Make sure FFmpeg has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg package has been compiled successfully.
make install
export LD_LIBRARY_PATH=/usr/local/lib/
Finalize the codec setups:
(Create symbolic links for the following modules. FYI: the number which comes after the extension *.so might differ from one server to another. The X's represent numbers. The number after *.so.5 must match the number after the *.so.5 at the end of the line.)
ln -s /usr/local/lib/libavformat.so.5X.XX.0 /usr/lib/libavformat.so.5X
ln -s /usr/local/lib/libavcodec.so.5X.XX.0 /usr/lib/libavcodec.so.5X
ln -s /usr/local/lib/libavutil.so.49.X.0 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
/sbin/ldconfig
Compile and install FFmpeg-Php
cd /usr/local/src/ffmpeg-php-0.6.0/
/usr/bin/phpize
./configure
make
(STOP here.) Make sure FFmpeg-Php has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg-Php package has been compiled successfully.
make install
Verify that ffmpeg-php module is saved in the Php extensions directory by running:
ls -al /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
Add FFmpeg-Php module directive in php.ini file: (make sure the local path to your php.ini is correct.)
echo 'extension=ffmpeg.so' >> /usr/local/lib/php.ini
Restart Apache to load FFmpeg-Php (for RedHat/CentOS v5.x)
service httpd restart
- Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:
php -r 'phpinfo();' | grep ffmpeg
You will get a few lines similar to the following:
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April 15 2010 15:31:45
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0
- 2 Users Found This Useful