Yet another how to for installing FFmpeg + Mplayer + Mencoder + FlvTool2 + LAME in CentOS/Redhat flavors of Linux

Tags: ffmpegflvtoolinstall ffmpeglamelibogglibvorbismencodermplayer

Published on: May 11, 2010 by Sharafuddin M.A

Yet another how to for installing FFmpeg +  Mplayer + Mencoder + FlvTool2 +  LAME in CentOS/Redhat flavors of Linux


FFmpeg is a very fast video and audio converter. It can also grab from a live audio/video source. FFmpeg is so important if you are planning to run a video website with streaming with conversion of video files to different video formats. This blog is intended for providing steps on FFmpeg install on CentOS server, where any novice user can install ffmpeg without compiling the source, which is a more traditional way of installing the FFmpeg software on linux servers. In this blog I will show you the easy way for ffmpeg install on CentOS and ffmpeg-php (php extension) with just yum rather than compiling ffmpeg from source files.

ffmpeg on your desktop machine can be used to convert between various audio and video formats, but I will explain that in another post.

Being said the expected audience to be novice, I am assuming that you are familiar with vi and if you are not, please use nano or joe editors.

For FFmpeg install on CentOs first you need to add a file in yum repository directory for dag packages installation. For this edit the following file:

vi /etc/yum.repos.d/dag.repo

add the following contents to the file,

name=Dag RPM Repository for Red Hat Enterprise Linux

Then enter the command,

yum install ffmpeg ffmpeg-devel

To check what audio/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

Installation of 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.
For downloading the source tarball click here
If you are unable to download with the above link, please use the below command:

cd /usr/local/src/

Extract the souce tarball. If you don’t see phpize, your php may be an rpm installed one and you need to install php-devel rpms to get phpize in the server.

tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
make install

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/ (this location may depend on the php version) and you will need mention that extension in php.ini file

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


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:
// # vi test.php

In any case the ffmpeg does not show in the phpinfo() test, make sure that php.ini path to is correct. Still the problem occurs, the reason could be you might be using older version of ffmpeg-php which is buggy. Just download the latest version of ffmpeg-php source then compile it.

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 meta-data and can cut and edit cue points for flv files.

yum install flvtool2

Installing LAME MP3 Encoder, Libogg, LIBVORBIS
LAME is a high quality MPEG Audio Layer III (MP3) encoder is licensed under the LGPL. Both quality and speed improvements are still happening, probably making LAME the only MP3 encoder still being actively developed.

yum install lame libogg libvorbis

This is the full installation steps which I did in all the live servers . I will post the common errors happening while installing the ffmpeg on next blog.

Enjoy with Video streaming on your website 🙂

Category : Howtos, Linux

Sharafuddin M.A

Sharafuddin M.A

Sharaf got immense interest and knowledge in implementing custom application and security solutions. He is highly competent in identifying and resolving security vulnerabilities, security breaches, hacked server recovery and server hardening. This soft spoken guy loves to watch movies and hanging out with friends.

You may also read:


Add new commentSIGN IN

Let's Connect


Your Cart

Cart is empty.

Send this to a friend