NOTES:
- This guide had been used effectively on several Web production servers with CentOS v5.x and Red Hat v4/5, however there are some which might not be compatible.
- Although this guide is designed for a Linux i386 powered server, it might work on a 86_64 system -- (proceed at your own risk.)
- If you experience any problems installing FFmpeg and FFmpeg-Php on your server and need help, just PM me or reply in thread i'll install for you .
- Our preferred method is to use Yum on systems including Red Hat, CentOS, and Fedora Core.
- Manually, from source archives/packages --�NOT RECOMMENDED (proceed at your own risk.)
- 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
- Install rpmforge repository. Follow the instructions on CentOS Wiki
- wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
- rpm -ivh rpmforge-release-0.5.2-2.el5.rf.*.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
echo 'extension=ffmpeg.so' >> /local_path_to_your/php.ini
Final step, restart apacheservice httpd restart
OR
/etc/init.d/httpd restart
- Testing FFmpegOR
/etc/init.d/httpd restart
Verify that FFmpeg is working properly by running the following two commands:
- php -r 'phpinfo();' | grep ffmpeg
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: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
- /usr/local/bin/ffmpeg
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):
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
- 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.
- 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
- make install
- Compile and install FFmpeg
- cd /usr/local/src/ffmpeg/
- mkdir /usr/local/src/ffmpeg/tmp
- export TMPDIR=/usr/local/src/ffmpeg/tmp
- ./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
- 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
- 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
Verify that FFmpeg is working properly by running the following two commands:
- php -r 'phpinfo();' | grep ffmpeg
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: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
- /usr/local/bin/ffmpeg
Regards