Activities

February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

How Do I enable ffmpeg extension, flvtool2 and Mplayer + Mencoder

I’m using PHP 5.2.9 on Centos5.3 server where php is installed from the source compilation.

First I added the diag repository on my yum path,

#rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum clean all
#yum update
#yum install ffmpeg ffmpeg-devel
#yum install mplayer mencoder

1. How to test ffmpeg is installed ?

[root@rc-149 ffmpeg-php-0.6.0]# ffmpeg
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab
libavutil     49.15. 0 / 49.15. 0
libavcodec    52.20. 0 / 52.20. 0
libavformat   52.31. 0 / 52.31. 0
libavdevice   52. 1. 0 / 52. 1. 0
libswscale     0. 7. 1 /  0. 7. 1
libpostproc   51. 2. 0 / 51. 2. 0
built on Nov  6 2009 19:05:03, gcc: 4.1.2 20080704 (Red Hat 4.1.2-46)
At least one output file must be specified
[root@rc-149 ffmpeg-php-0.6.0]#

2. Then install flvtool2

#yum install flvtool2

Then I download the latest from php-ffmpeg package from sourceforge.

#wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=nchc
tar -xjf ffmpeg-0.5.2.1.tbz2
#phpize
#./configure
#make
#make install

If you hit back with an error during the php-ffmpeg compilation timeĀ  “php ffmpeg error In function ‘_php_convert_frame'”Try to download the latest php-ffmpeg

[root@rc-111 ffmpeg-php-0.6.0]# wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download

Then that error will disappear.

Now I’m going to edit the php.ini (/etc/php.ini) and add/modify the following lines on it,
extension_dir = “/usr/lib/extensions/no-debug-non-zts-20060613/”
extension=ffmpeg.so

[root@rc-040 ~]# php -r 'phpinfo();'| grep "ffmpeg"
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Feb 26 2010 07:25:02
ffmpeg-php gd support  => disabled
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
[root@rc-040 ~]#

See how this module visible in phpinfo page as shown below,

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>