Registracija Domena
http://www.

Baza znanja

Install ffmpeg, flvtool2, mplayer, mencoder and ffmpeg-php in Cpanel/CentOS

Install ffmpeg, flvtool2, mplayer, mencoder and ffmpeg-php in Cpanel/CentOS

This guide is aimed to help you install ffmpeg and a few other audio/video processing tools on a Cpanel/CentOS server. This installation works on a non-cpanel CentOS server and should work on RHEL even though I have not tested on RHEL.

 

Following are the tools going to be installed:

  • FFmpeg audio/video converter and ffmpeg-php PHP extension
  • MPlayer multimedia player and MEncoder movie encoder
  • FLVTool2 flash video manipulation tool
  • SWFTools for manipulating SWF files
  • LAME mp3 encoder
  • Libogg multimedia container library
  • Libvorbis audio compression codec
  • Libtheora video compression codec
  • AMR NarrowBand and WideBand speech codecs
  • Transcode video stream processing utility
  • X264 utility/encoder for H264/AVC video streams

The CentOS rpm packages of ffmpeg, flvtool2, mplayer, mencoder, swftools, amrnb, amrwb and transcode are available on rpmforge repository. So, first of all, enable rpmforge repo by installing the appropriate rpm package available on https://rpmrepo.org/RPMforge/Using/. For instance, rpmforge-release-0.3.6-1.el5.rf.i386.rpm is for 32 bit CentOS.

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Install ffmpeg, flvtool2, mplayer, mencoder and other packages using yum.

yum install ffmpeg ffmpeg-devel flvtool2 mplayer mencoder lame libogg libvorbis libtheora swftools amrnb amrwb transcode x264

Note: You may have to temporarily disable the exclude setting in /etc/yum.conf. Otherwise, the above command may fail. Also, make sure that you re-enable exclude setting after the installation.

Install MPlayer Binary Codec Packages.

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar xjf essential-20071007.tar.bz2
mv essential-20071007 /usr/lib/codec

Since there is no proper rpm for ffmpeg-php, we are going to compile and install it from source. During compilation, ffmpeg-php looks in /usr/local/include/ffmpeg/ for the required header files, but the rpm package of ffmpeg-devel installs these headers in /usr/include/. Also, the required folder structure is a bit different. These problems can be overcome by issuing following commands which creates /usr/local/include/ffmpeg/ in the required format.

mkdir /usr/local/include/ffmpeg/
cp -par /usr/include/lib{avcodec,avdevice,avformat,avutil,swscale} /usr/local/include/ffmpeg/
cp -pa /usr/include/lib{avcodec,avdevice,avformat,avutil,swscale}/*.h /usr/local/include/ffmpeg/

In case above commands fail and you find that ffmpeg-devel installed the files in /usr/include/ffmpeg/, you can use following commands:

cp -par /usr/include/ffmpeg/* /usr/local/include/ffmpeg/
cp -pa /usr/include/ffmpeg/*/*.h /usr/local/include/ffmpeg/

Now download ffmpeg-php source from http://ffmpeg-php.sourceforge.net/, compile and install the ffmpeg php extension.

wget http://downloads.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure && make
make install

From the output of ‘make install’, note the directory in which ffmpeg php shared extension was installed.

Update php.ini to use the extension. For that, edit the system php.ini file and make sure extension_dir is set to the directory in which ffmpeg extension was installed. Then add following line below the extension_dir line:

extension=”ffmpeg.so”

Now restart apache.

service httpd restart
For cpanel,
/scripts/restartsrv_httpd

You can verify ffmpeg php extension on a phpinfo web page or from the output of the command php -i (command line phpinfo).

[root@server ~]# php -i | grep ffmpeg
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Jul 21 2009 18:39:39
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc52.20.0
ffmpeg libavformat version => Lavf52.31.0
ffmpeg swscaler version => SwS0.7.1
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

You may create a php info file(say info.php) with following code, put it in the document root and access it.

<?php phpinfo(); ?>

There should be a section called ‘ffmpeg’ on php info page with settings equivalent to the command line output as above.

Following are the file system paths of various programs got installed on the server:

ffmpeg: /usr/bin/ffmpeg

mencoder: /usr/bin/mencoder

flvtool2: /usr/bin/flvtool2

swftools: /usr/bin/font2swf
/usr/bin/gif2swf
/usr/bin/jpeg2swf
/usr/bin/pdf2swf
/usr/bin/png2swf
/usr/bin/swfbbox
/usr/bin/swfc
/usr/bin/swfcombine
/usr/bin/swfdump
/usr/bin/swfextract
/usr/bin/swfstrings
/usr/bin/wav2swf

mencoder: /usr/bin/mencoder

transcode: /usr/bin/transcode

Now you can start using these programs.

Enjoy



Da li Vam je ovaj odgovor pomogao?

Dodaj u Favourites Dodaj u Favourites

Štampaj Štampaj