Skip to content


How to install ffmpeg on CentOS/RHEL through YUM

How to install ffmpeg on CentOS/RHELvia YUM :-

FFmpeg is very  important if you are planning to run a website with streaming with conversion of video files to different video formats. This post  provide you a walk through  for Centos/Redhat versions of Linux where user can install ffmpeg without compiling the source which is a more traditional way of installing the FFmpeg software on linux servers. In this tutorial i will show you the easy way to install ffmpeg and ffmpeg-php (php extension) with just yum rather than compiling ffmpeg from source files.

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.

First :-

# nano -w /etc/yum.repos.d/dag.repo

Insert :-

[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 save the repo file also you can update RPM through rpmforge :-

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

Then yum update and search for ffmpeg and install all ffmpeg packages including devel.

#  yum update

Installing FFMPEG.:-

# yum install ffmpeg ffmpeg-devel

If Seems there is some lib problems along the way so in /etc/ld.so.conf add

/usr/local/lib

also check /etc/ld.so.conf.d and make sure there are no .conf files that may be loading other files.

then

# ldconfig -v

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.

# cd /usr/local/src

wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=nchc

tar -xjf ffmpeg-php-0.6.0.tbz2

phpize

./configure
make
make install

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.

# nano /usr/local/lib/php.ini

or

# Vi /usr/local/lib/php.ini

Put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

Then 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.

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 <url-link>

# ruby setup.rb config
# ruby setup.rb setup
# sudo 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

At last :- Please restart the apache web server with the following command :-

# /etc/init.d/httpd restart

To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.

# ffmpeg
# ffmpeg -formats

# ffmpeg –help ( This lists path of mpeg, its modules and other path information)
# ffmpeg -i Input.file Output.file

To check what audi/video formats are supported :-

ffmpeg -formats > ffmpeg-format.txt

Open the ffmpeg-formats.txt to see the ooutput

D means decode
E means encode
V means video
A means audio
T = Truncated

To check whether FFMPEG integrated/enabled with PHP or not through phpinfo page :-

Enjoy Linux !!!!

Posted in Apache, FFMPEG, Linux tutorials, Open Source Applications, php.

Tagged with , , , .


4 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. admin says

    Hi,

    The error message stated that there is no make file found,so please download fresh package once again and try once again.

  2. Jordan says

    Make and Make Install dump these errors:

    make: *** No targets specified and no makefile found. Stop.
    make: *** No rule to make target `install’. Stop.

    Took stock package from Sourceforge… so what’s the deal?

  3. admin says

    Thanks Dude :)

  4. Zahid says

    Hi,

    I was trying to install mplayer for my centOS dist. and stumpled upon ffmpeg dependency. Excellent step-by-step instructions. Worked like a charm.

    Much Thanks.

You must be logged in to post a comment.