The ffmpeg-php is a php extension used for accessing and
retrieving information from media files both audio and vedio. Now
ffmpeg-php which is Rarely used in web applications. This php extension
is used for creating thumbnail images from movie files. If you want to
enable “ffmpeg-php” in the server, you have to manually download
“ffmpeg-php” source files and compile it. For enabling “ffmpeg-php” the
server needs to have “
ffmpeg“, “GD” enabled and php version needs to be grater than 4.3.
The “ffmpeg-php” source files can be downloaded from the link http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/
You have to make sure your server is enabled with “ffmpeg” and “gd” before proceeding with below steps.
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=biznetnetworks
tar -jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
yum install php-devel gcc gcc-c++
/usr/bin/phpize
Replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32 in
ffmpeg_frame.c file in order to prevent compilation error like
“ffmpeg_frame.c:421: error”. Follow the below steps.
perl -pi -e “s/PIX_FMT_RGBA32/PIX_FMT_RGB32/” ffmpeg_frame.c
./configure
make
make install
echo “extension=ffmpeg.so” >> /etc/php.ini
service httpd restart
php -i | grep -i ffmpeg
Sometimes you can also met with the error “make: ***
[ffmpeg_movie.lo] Error 1″ while proceeding with compilation as below,
you have to make changes accordingly in “ffmpeg_movie.c” file as
described below.
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_open_movie_file’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:258: warning:
‘av_open_input_file’ is deprecated (declared at
/usr/local/include/libavformat/avformat.h:1170)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie___construct’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:311: error: ‘list_entry’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:311: error: (Each undeclared identifier is reported only once
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:311: error: for each function it appears in.)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:311: error: ‘le’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:346: error: expected ‘;’ before ‘new_le’
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:356: error: ‘new_le’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getComment’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:531: warning: ‘comment’
is deprecated (declared at
/usr/local/include/libavformat/avformat.h:745)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:531: warning: ‘comment’
is deprecated (declared at
/usr/local/include/libavformat/avformat.h:745)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getTitle’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:546: warning: ‘title’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:742)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:546: warning: ‘title’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:742)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAuthor’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:561: warning: ‘author’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:743)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:561: warning: ‘author’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:743)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getCopyright’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:575: warning: ‘copyright’
is deprecated (declared at
/usr/local/include/libavformat/avformat.h:744)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:575: warning: ‘copyright’
is deprecated (declared at
/usr/local/include/libavformat/avformat.h:744)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAlbum’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:590: warning: ‘album’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:746)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:590: warning: ‘album’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:746)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getGenre’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:604: warning: ‘genre’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:749)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:604: warning: ‘genre’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:749)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getTrackNumber’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:619: warning: ‘track’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:748)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getYear’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:632: warning: ‘year’ is
deprecated (declared at /usr/local/include/libavformat/avformat.h:747)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getPixelFormat’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:868: warning:
‘avcodec_get_pix_fmt_name’ is deprecated (declared at
/usr/local/include/libavcodec/avcodec.h:3467)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_read_av_frame’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1215: warning:
‘avcodec_decode_video’ is deprecated (declared at
/usr/local/include/libavcodec/avcodec.h:3930)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_av_frame’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1282: warning: ‘hurry_up’
is deprecated (declared at
/usr/local/include/libavcodec/avcodec.h:1389)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1284: warning: ‘hurry_up’
is deprecated (declared at
/usr/local/include/libavcodec/avcodec.h:1389)
make: *** [ffmpeg_movie.lo] Error 1
Make changes in ffmpeg_movie.c file as below and try again:
row 311: list_entry *le; TO zend_rsrc_list_entry *le;
row 346: list_entry new_le; TO zend_rsrc_list_entry new_le;
row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry),
TO hashkey_length+1, (void
*)&new_le,sizeof(zend_rsrc_list_entry),
Verify if “ffmpeg” extension for php is enabled in the server.
$ php -i | grep -i ffmpeg
You will get the below result if everything is fine.
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Mar 24 2014 19:02:49
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc52.123.0
ffmpeg libavformat version => Lavf52.111.0
ffmpeg swscaler version => SwS0.14.1
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0
PWD => /usr/local/src/ffmpeg-php-0.6.0
_SERVER["PWD"] => /usr/local/src/ffmpeg-php-0.6.0
_ENV["PWD"] => /usr/local/src/ffmpeg-php-0.6.0