The easiest way to install FFMPEG and other modules is through yum. Following are the steps given to install ffmpeg with yum command.

First we will have to install the DAG RPM repositories which contains huge amount of rpm packages. It’s very easy. Just install the latest rpmforge-release package for your distribution and architecture.

This will automatically install the configuration and GPG keys that are for safely installing RPMforge packages.

Please select the correct command from the following list:

  • Supported Red Hat Enterprise Linux 5 / i386:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  • Red Hat Enterprise Linux 5 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  • Red Hat Enterprise Linux 4 / i386:
rpm -Uhv http://apt.sw.be/redhat/el4/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
  • Red Hat Enterprise Linux 4 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el4/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm
  • Red Hat Enterprise Linux 3 / i386:
rpm -Uhv http://apt.sw.be/redhat/el3/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el3.rf.i386.rpm
  • Red Hat Enterprise Linux 3 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el3/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el3.rf.x86_64.rpm
  • Red Hat Enterprise Linux 2 / i386:
rpm -Uhv http://apt.sw.be/redhat/el2.1/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el2.rf.i386.rpm
  • Red Hat Linux 9 / i386:
rpm -Uhv http://apt.sw.be/redhat/9/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.rh9.rf.i386.rpm

Installing FFMPEG

 

yum install ffmpeg ffmpeg-devel

Installing FFMPEG-PHP Extension

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

cd /usr/local/src
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize

You will get results like this

Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025

Now let’s configure the extension

./configure
make
make install

You may get following error while running make command

ERROR: ‘PIX_FMT_RGBA32′

While compiling ffmpeg-php

Error: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_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 ‘zif_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)

FIX: With the latest version of ffmpeg-php (0.6.0), update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:w
:q!

Once you have done that without any problems then you will see the php extension file and you will need mention that extension in php.ini file.

On cPanel based server: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so

On LAMP Environment: /usr/lib64/php/modules/

Adding FFMPEG.SO extension in php.ini

On cPanel based server open following file

nano /usr/local/lib/php.ini

On LAMP Environment open following file

nano /etc/php.ini

now put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

Now restart apache using

service httpd restart

Installing Mplayer + Mencoder

Just issue the following yum commands to install the rest of the packages.

yum install mplayer mencoder

Installing FlvTool2

Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.

yum install flvtool2

If you are on Centos 5 try yum install flvtool2 with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 from: http://rubyforge.org/projects/flvtool2/

wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
tar -xvf flvtool2-1.0.6.tgz
cd flvtool2-1.0.6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

If you get command not found error, it probably means that you dont have ruby installed. Being a cpanel server you can do that using

/scripts/installruby

OR

yum install ruby


Tagged with:  

You must log in to post a comment.