Setup ffmpeg on CentOS 7

I am developing a PHP application that requires converting mp3 to ogg audio format and this will be run on CentOS 7 Linux distro. The ffmpeg is perfect application to accomplish this task. The following steps are tested running on my Linode server running Centos 7 64-bit.

  1. ffmpeg requires libdc1394-devel and it is available in epel repository. Execute the following command to install epel repository:
    rpm -Uvh

    Note: As of this writing the "" is the latest. If this URL returns 404 error it means that new version is released, you may want to browse "" to look for that new released version.

  2. ffmpeg is available in ATRPMS Repo. The ATRPMS Repo ( is down, we'll use mirror:
    rpm -ivh
  3. Modify the atrpms.repo to update its baseurl:
    vi /etc/yum.repos.d/atrpms.repo

    Under [atrpms] change the baseurl and enabled from:


    ... to:

  4. Lets install now the ffmpeg by executing:
    yum -y --enablerepo=atrpms install ffmpeg
  5. To verify if ffmpeg is already installed:
    ffmpeg -version


    which ffmpeg
  6. To convert mp3 to ogg format, execute the following command:
    ffmpeg -i mpthreetest.mp3 -c:a libvorbis -q:a 4 mpthreetest.ogg
  7. There is PHP library available here but for simplicity the following PHP codes will suffice:
    function convert_mp3_ogg($mp3file) {
      if (`which ffmpeg`) {
        $oggfile = preg_replace('/\.mp3$/', '.ogg', $mp3file);
        shell_exec("ffmpeg -i $mp3file -c:a libvorbis -q:a 4 $oggfile");
        return TRUE;
      return FALSE;

To know more about ffmepeg check their website.



when i run the
#rpm -ivh

package epel-release-7-5.noarch is already installed
[root@aryan used]# rpm -ivh
curl: (7) Failed connect to; Connection timed out
error: skipping - transfer failed
pleases what is this error ...why this error is occuring.please help me guys.

there is no package available

You can use one of these mirrors:

Hello. I'm new to Linux!
I have a CentOS 7, 64-bit, VPS with Apache / MySQL / PHP server on host Ocean Digital.
I followed all the commands according to your article. I used the ATRPMS mirror:
I modified the atrpms.repo and updated the baseurl to: baseurl = https: //$releasever-$basearch/stable
Enabled = 0
Installed FFMPEG without errors. When I make the command (being as ROOT) ffmpeg -version displays the screen:

Ffmpeg version 2.2.1
Built on Jun 17 2014 01:25:46 with gcc 4.8.2 (GCC) 20140120 (Red Hat 4.8.2-16)
Configuration: --prefix = / usr --libdir = / usr / lib64 --shlibdir = / usr / lib64 --mandir = / usr / share / man --enable-shared --enable-runtime -cpudetect --enable- Gable --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable -x11grab --enable -vdpau --disable-avisynth --enable-frei0r --enable -libdc1394 --enable- Libsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags = '-O2 -g -pipe -Wall -Wp, -D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector-strong --param = ssp-buffer-size = 4 -grecord-gcc-switches -m64 -mtune = generic -fPIC '--disable-stripping
Libavutil 52. 66,100 / 52 66,100
Libavcodec 55. 52.102 / 55. 52.102
Libavformat 55. 33,100 / 55. 33,100
Libavdevice 55. 10,100 / 55. 10,100
Libavfilter 4. 2.100 / 4. 2.100
Libswscale 2. 5.102 / 2. 5.102
Libswresample 0. 18,100 / 0. 18,100
Libpostproc 52. 3,100 / 52 3,100

So, I congratulate you on the article. Now, how do I install FFMPEG-PHP extension following a compatible way? The version of my PHP is 5.4.16 with Apache version 2.4.6 and MySQL Version: 5.5.50-MariaDB. Please help me!

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.