How to install ffmpeg & ffmpeg-php Without errors.

Status
Not open for further replies.

ScopeHosts.Sales

Active Member
Corporate Membership
1,246
2008
84
2,915
Installing FFMpeg

Code:
yum install ffmpeg ffmpeg-devel
If you get package not found, then you will need to add few lines in the yum repository for dag packages installation


Create a file named dag.repo in /etc/yum.repos.d with the following contents on it


Code:
nano /etc/yum.repos.d/dag.repo
Add below code in dag.repo

Code:
[dag]
  name=Dag RPM Repository for Red Hat Enterprise Linux
  baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
  gpgcheck=1
  enabled=1
then

Code:
yum install ffmpeg ffmpeg-devel
If everything is fine, then the installation should proceed smoothly. If not you will get something like warning GPG public key missing .
Common Errors

To fix rpmforge GPG key warning:


Code:
 rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
then again

Code:
yum install ffmpeg ffmpeg-devel
To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.
Code:
> ffmpeg
  > ffmpeg -formats
  > ffmpeg --help
  // This lists path of mpeg, its modules and other path information
 
  ffmpeg -i Input.file Output.file
Install FFMPEG-PHP Extension

FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server

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

tar -xjf ffmpeg-php-0.6.0.tbz2


  phpize


 ./configure

  make

  make install
After Running Above Commands If you get Below error:


/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_toGDImageâ:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: âPIX_FMT_RGBA32â undeclared (first use in this function)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_ffmpeg_frameâ:
/usr/src/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
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_toGDImageâ:/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: âPIX_FMT_RGBA32â undeclared (first use in this function)/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_ffmpeg_frameâ:/usr/src/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

To fix it try this:

After extracting ffmpeg-php-0.6.0 source you will need to make some changes in ffmpeg_frame.c file and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32:


Code:
#cd ffmpeg-php-0.6.0


 #vi ffmpeg_frame.c [B]Or[/B] nano ffmpeg_frame.c
Search for 3 instance of “ PIX_FMT_RGBA32″ and replace with “PIX_FMT_RGB32″
Exit and save, then from the same extracted directory (in my case it was /usr/local/src/ffmpeg-php-0.6.0):
Code:
 #cd /usr/local/src/ffmpeg-php-0.6.0


 # cp -aP ffmpeg_frame.loT ffmpeg_frame.lo


 # make clean


 # ./configure


 #   make


 #   make install
This should fix this problem..


Editing PHP.INI

Once you have done that without any problems then you will see the php extension file /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so and you will need mention that extension in php.ini file


Code:
nano /usr/local/lib/php.ini
Put the below two lines at the end of the php.ini file


Code:
[ffmpeg]
  extension=ffmpeg.so
 Then restart the server service httpd restart
To check whether ffmpeg enabled with php, point your browser to test.php file. It should show the confirmation of installed ffmpeg php extension



Code:
// #test.php
  
  <?php
  phpinfo()
  ?>
Hope You Enjoy This tutorial!
 
3 comments
Status
Not open for further replies.
Back
Top