How to install FFmpeg & PHP-FFmpeg on cPanel

By Default ffmpeg rpms are not added in centos yum repositories

a new repository will have to be added to install ffmpeg

For centos6 64bit OS

run below commands,

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Once done

# yum install ffmpeg ffmpeg-devel

This will install ffmpeg on server

Now once this is done

you will need to install ffmpeg-php for php to recognize ffmpeg

Below are the steps

#wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2

# tar -xvf  ffmpeg-php-0.6.0.tbz2

#cd ffmpeg-php-0.6.0

#phpize

#./configure

#make && make install

now you need to add ffmpeg.so module in php.ini

add   extension=ffmpeg.so and restart httpd

You can check for ffmpeg in phpinfo page

 

 

Note: You may get error ” error: ‘new_le’ undeclared (first use in this function)” while running make command

You need to make modification in below file ffmpeg_movie.c which is in ffmpeg-php-0.6.0

 

Changes in ffmpeg_movie.c:

  • 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),