Browse by category

Search    |    Advanced search

HowTo :: Install FFmpeg and FFpeg-Php

FFmpegis a complete solution to record, convert and stream audio and video segments. It includes libavcodec, the leading audio/video codec library.


Although there are two methods to install FFmpeg and FFmpeg-Php, their libraries, and modules:

  1. Our preferred method is to use Yum on systems including Red Hat, CentOS, and Fedora Core.
  2. Manually, from source archives/packages -- NOT RECOMMENDED. We deleted the instructions on how to compile and install FFmpeg and FFmpeg-Php, manually.

*** Caution

Using YUM

First, make sure the following binary RPM packages are installed on your server:

gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion

If any of these packages are missing, install them using Yum. For example:

  • yum install PACKAGE
  1. Install rpmforge repository. Follow the instructions on CentOS Wiki
    • wget
    • rpm -ivh rpmforge-release-0.5.2-2.el5.rf.*.rpm
  2. Install ffmpeg, mplayer, mencoder with all supported libraries/modules
    • yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
  3. Manually, install FFmpeg-Php
    • cd /usr/local/src
    • wget
    • tar jxvf ffmpeg-php-0.6.0.tbz2
    • cd ffmpeg-php-0.6.0
    • phpize
    • ./configure
    • make
    • make install

If FFmpeg-Php is compiled successfully, an module will be generated and copied into the default Php directory. Next, run the following command to enable FFmpeg-Php. By running this command you will be adding module into the php.ini file:

echo '' >> /local_path_to_your/php.ini

Final step, restart apache

service httpd restart
/etc/init.d/httpd restart

- Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:

  • php -r 'phpinfo();' | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April 15 2010 15:31:45
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

  • /usr/local/bin/ffmpeg

If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, and FLV2tool are working properly on your server. CONGRATULATIONS!

Add comment
Views: 1501
Votes: 0
Comments: 0

Other articles in this Category