Sunday, September 4, 2011

// // Leave a Comment

Installing FFmpeg-PHP Extension at Linux

In this tutorial we will learn about installation of FFmpeg PHP extension. As we know that FFmpeg is a very useful tool for audio video conversion etc.

To install FFmpeg PHP extension you must install the FFmpeg first.
Visit Below:
http://w3tool.blogspot.com/2011/09/how-to-install-ffmpeg-latest-version-at.html

After you install the FFmpeg you can now move forward to install the php extension:

Step 1) Download the latest version of FFmpeg-php.
Visit the Below site:
http://ffmpeg-php.sourceforge.net
You can download the latest release using wget command. Click here to learn about wget linux command if you dont know about it.

After downloading you can see the downloaded package in your /root directory which is default.

Step 2) Now extract the file using below command:

 
tar -xjf name of the downloaded file

Step 3) Now enter to the extracted directory using below command:
 
cd Name of the extracted folder

Step 4) Now run below command:
Code:
phpize
if you get command not found error than probably you dont have the php devel installed.
Run the below command to fix it including the above command:
 
yum install php-devel
phpize

Step 5) Now run below command to install the FFmpeg-php:
 
./configure
make
make install
if you get header not found or some similar error then you can fix it by running the below command with the above one:
Code:
yum install ffmpeg-devel
./configure
make
make install
if you get error similar to shared library not found then run the commands given below:
 
./configure --with-ffmpeg=/usr/local/cpffmpeg
./configure
make
make install

Now ffmpeg should be installed correctly without any problem.


Step 6) Now at the end you will need to edit your php.ini file, paste the below code to load the FFmpeg module in php and save it.
 
[ffmpeg]
extension=ffmpeg.so


Step 7) Restart the apache and your FFmpeg installation has been completed.
Code:
service httpd restart

Addons: Now you may want to install some addons like Mencoder and mplayer.
Use below command to install them:
Code:
yum install mplayer mencoder