How to Install FFmpeg on CentOS

FFmpeg is an awesome collection of open-source tools that can record and stream video and audio. However, it can also convert multimedia the files to different formats.

FFmpeg includes libavcodec audio/video codec library in it.Today, in this article i am going to show you how to install FFmpeg .

Note that I did all the following steps on a CentOS server.

The first thing that you need to do is to add the DAG repository, to add it do the following steps:

Open a file /etc/yum.repos.d/dag.repo and add the following lines:

name=DAG RPM Repository

Once done , Save and close the file.

To successfully use the DAG repository with yum tool, you need to add DAG’s GPG key:

rpm --import

Now DAG is setup, it’s good to update all your packages.

yum update

This could potentially upgrade, install, or replace various packages that may or may not be very important to you. Make sure you carefully look through that list and do any essential preparations before telling yum that it can proceed.

Installing – FFmpeg

Now you are ready to install FFmpeg with yum.

yum install ffmpeg

Now copy extenstion under php extensions directory

cp /srv/build/ffmpeg-php-0.6.0/.libs/  /path/to/php

Add to php.ini file you can find this extension under ./lib/

nano /path/to/php.ini

Add below lines at the end of php.ini file


Now open yum.conf nano /etc/yum.conf and add ffmpeg* in exclude line.

nano /etc/yum.conf
exclude= ffmpeg*

Verify the status of ffmpeg extension on a PHP info web page or from command line as given below:

php -i | grep ffmpeg

php -m | grep ffmpeg

After successfully install FFmpeg, let’s check the version installed on system:

ffmpeg -version

Here is the list of few ffmepg basic command options:

fmpeg -version:            show version
ffmpeg -formats:            show available formats
ffmpeg -codecs:             show available codecs
ffmpeg -decoders:           show available decoders
ffmpeg -encoders:           show available encoders
ffmpeg -bsfs:               show available bit stream filters
ffmpeg -protocols:          show available protocols
ffmpeg -filters:            show available filters
ffmpeg -pix_fmts:           show available pixel formats
ffmpeg -layouts:            show standard channel layouts
ffmpeg -sample_fmts:        show available audio sample formats