FFmpeg is a free software, handling multimedia data by produces programs and libraries and managing of audio or video streams. FFmpeg is published under the GNU Lesser General Public License. The FFmpeg command line program for transcoding multimedia files. FFmpeg includes libavcodec (libavcodec is a free and open-source library of codecs for encoding and decoding video and audio data.) FFmpeg/Libav allow you to make recordings, corrections with filters, or transcode media from one format to another. FFmpeg mostly developed on Linux, but also compiled on Microsoft Windows, Android, Mac OS X, and many more operating system. Microprocessor and many computing platforms are also supported like PowerPC, ARM, and MIPS.
HOW TO INSTALL FFMPEG ON CENTOS
1) We need to ensure that some codecs and FFmpeg itself are not installed in our system.
# yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg
# yum update
2) Install some of the Ffmpeg’s dependencies from some non-official CentOS repos, EPEL and RPMForge.
# 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
3) Now we can install dependencies.
First, base 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 gsm-devel
Then from EPEL:
# yum –enablerepo=epel install yasm libva-devel libass-devel libkate-devel libbluray-devel libdvdnav-devel libcddb-devel libmodplug-devel
At last from RPMForge:
# yum –enablerepo=rpmforge install a52dec-devel libmpeg2-devel
COMPILATION OF DEPENDENCIES
1) First, need to choose where all the sources are going to live. Here /opt/ffmpeg is using.
2) So, first make directory.
# mkdir -p /opt/ffmpeg/sources
3) Then start compilation of dependencies.
X264
# cd /opt/ffmpeg/sources
# git clone git://git.videolan.org/x264
# cd x264
# ./configure –enable-shared
# make
# make install
XVID
# cd /opt/ffmpeg/sources
# wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
# tar xvfz xvidcore-1.3.2.tar.gz
# cd xvidcore-1.3.2/build/generic
# ./configure –prefix=/usr/local
# make
# make install
LIBFDK_AAC
# cd /opt/ffmpeg/sources
# 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/ffmpeg/sources
# 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
OPENCORE AMR CODEC
#cd /opt/ffmpeg/sources
# wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
# tar xvfz opencore-amr-0.1.2.tar.gz
# cd opencore-amr-0.1.2
# ./configure
# make
# make install
LIBOGG
# cd /opt/ffmpeg/sources
# 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/ffmpeg/sources
# 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/ffmpeg/sources
# 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/ffmpeg/sources
# git clone http://git.chromium.org/webm/libvpx.git
# cd libvpx
# ./configure –enable-shared
# make
# make install
And finally,
FFMPEG
# cd /opt/ffmpeg/sources
# git clone git://source.ffmpeg.org/ffmpeg
# cd ffmpeg
# ./configure –enable-gpl –enable-version3 –enable-libfdk_aac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 –enable-nonfree –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libgsm –enable-libxvid –disable-static –enable-shared
# make
# make install
RUNNING FFMPEG
All the previous steps were executed successfully, then going to end with a compiled FFmpeg binary.
# ffmpeg
May be a chances of getting something like
> ffmpeg: error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory
To fix that issue we need to add the path /usr/local/lib shared libraries ldconfig cache.
# ldd `which ffmpeg`
# find /usr/local/lib/
Let’s add the directory on the ldconfig cache.
# vim /etc/ld.so.conf
It should look something like.
include ld.so.conf.d/*.conf
/usr/local/lib
Now, update the cache.
# ldconfig
You will get the following message.
ffmpeg
> ffmpeg version N-62374-ge89f3d0 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 12 2014 15:31:30 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
configuration: –enable-gpl –enable-version3 –enable-libfdk_aac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 – -enable-nonfree –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libgsm –enable-libxvid –disable-static –enable-shared
libavutil 52. 75.100 / 52. 75.100
libavcodec 55. 58.103 / 55. 58.103
libavformat 55. 37.100 / 55. 37.100
libavdevice 55. 13.100 / 55. 13.100
libavfilter 4. 4.100 / 4. 4.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Use -h to get full help or, even better, run ‘man ffmpeg’
That’s it, FFmpeg installation is successfully completed.
If you need any further assistance please reach our support department.