Friday, 28 September 2012

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.
It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions.
This works well for automatically creating thumbnail images from movies.
ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...).
ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...).

wget "http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=garr"
tar xjvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install

While receving error  on complilng :

/root/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function) make: *** [ffmpeg_frame.lo] Error 1 "

do this and after make command again:

vim ffmpeg_frame.c

:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32/g

:wq

Now edit the php.ini file, by adding :

Enable ffmpeg extension module (please use the correct path)
extension_dir = "/usr/lib64/php/modules/" (path we get during FFmpeg installation)
extension=ffmpeg.so

Finally Restart Apache (service httpd restart).

You can test your installation via creating a phpinfo.php file in Public_html.

No comments:

Post a Comment