Compile latest ffmpeg and vlc on CentOS 6

Author: | Posted in howto 16 Comments

This guide is for those who want the latest vlc player and the ffmpeg tool on CentOS 6. I used to not care much about the vlc version as long as it was able to play my content. This changed recently when I tried to play a video encoded with the V80 codec. I was running older versions of vlc (1.1.13) and ffmpeg (0.6.5), both from rpmforge and I wasn’t able to play the video properly, so I decided to upgrade. I was familiar with other repositories that provide vlc (e.g. rpmfusion) but I knew that changing repos could cause other dependency issues so I eventually chose to do a plain old source compilation.

I found this guide that proved to be very useful. What follows are the exact steps I took to compile all required libraries, ffmpeg and vlc on my 64-bit CentOS 6 machine (based on an initial minimal installation).

 

Install additional repositories

While this is a guide to compile from sources, some of the dependencies are already available in either the official CentOS 6 channels or compatible repositories. I had both EPEL and RPMforge installed with:

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

I prefer disabling any non-official repositories and only enable them when I know it’s necessary. This way I can prevent dependency issues or package conflicts.

 

Install dependencies

  • from base (the official CentOS repo):
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig wget opencv zlib-devel dbus-devel lua-devel zvbi libdvdread-devel  libdc1394-devel libxcb-devel xcb-util-devel libxml2-devel mesa-libGLU-devel pulseaudio-libs-devel alsa-lib-devel libgcrypt-devel qt-devel
  • from EPEL:
yum --enablerepo=epel install yasm libva-devel libass-devel libkate-devel libbluray-devel libdvdnav-devel libcddb-devel libmodplug-devel
  • from RPMforge:
yum --enablerepo=rpmforge install a52dec-devel libmpeg2-devel

 

Create the folder structure

All source compilation will be performed in /opt/source. vlc will be install in /opt/vlc. The following command creates all required folders.

mkdir -p /opt/source/{ffmpeg,vlc} /opt/vlc

 

x264

cd /opt/source/ffmpeg/
git clone git://git.videolan.org/x264
cd x264
./configure --enable-shared
make
make install

 

libfdk_aac

cd /opt/source/ffmpeg/
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --enable-shared
make
make install

 

lame

cd /opt/source/ffmpeg/
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-shared --enable-nasm
make
make install

 

libogg

cd /opt/source/ffmpeg/
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar xzvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure --enable-shared
make
make install

 

libtheora

cd /opt/source/ffmpeg/
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --enable-shared
make
make install

 

libvorbis

cd /opt/source/ffmpeg/
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xzvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --enable-shared
make
make install

 

libvpx

cd /opt/source/ffmpeg/
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --enable-shared
make
make install

 

ffmpeg

cd /opt/source/ffmpeg/
git clone git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --disable-static --enable-shared
make
make install

 

libmad

cd /opt/source/ffmpeg/
wget ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz
tar zxvf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
./configure
make
make install

Note:

If the configure part doesn’t complete successfully, open the configure file with a text editor such as vim and comment or delete the following line, then re-run ./configure:

optimize="$optimize -fforce-mem"

 

vlc

cd /opt/source/vlc
git clone git://git.videolan.org/vlc.git
cd vlc
./bootstrap 
./configure --prefix=/opt/vlc
make
make install

Note:

If you run into issues during the configure part it could be because the pkgconfig path is not defined. Export at least /usr/local/lib so vlc can detect the recently-compiled libraries, then re-run ./configure.

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH

 

That’s it. Launch vlc from a terminal with /opt/vlc/bin/vlc or add it to your PATH in ~/.bash_profile so you can launch with vlc:

PATH=$PATH:$HOME/bin:/opt/vlc/bin

VLC 2.1 on CentOS6

Comments
  1. Posted by Chris
    • Posted by admin
  2. Posted by Chris
  3. Posted by tony
    • Posted by admin
  4. Posted by tony
  5. Posted by Halfsquatch
  6. Posted by Luis
  7. Posted by Tuelho
    • Posted by admin
  8. Posted by Tuelho
  9. Posted by Halfsquatch
  10. Posted by Halfsquatch
  11. Posted by Halfsquatch
    • Posted by admin
  12. Posted by Nelson

Add Your Comment