Install FFMpeg in CentOS 6 / CentOS 7

Install FFMpeg in CentOS 6 / CentOS 7

From time to time, I have to fire up my good friend (major search engine) to remember how to do certain tasks.  For example, today I was in the process of migrating a website from one web host to another.  In order to do so, I needed to make sure that FFMpeg was installed and working on the new host before migrating the site, or all of the cool website multimedia features (e.g. audio blogs) would stop working.  Using FFMpeg is really a quick way to convert massive files into managable, portable, web ready files.  I digress.

To install FFMpeg on CentOS 6 or CentOS 7, you will need to follow a couple steps.

Prerequisites

  • Running CentOS 6 / CentOS 7
  • Root Access (typical on a VPS) or have a sudo user (typical on a shared hosting environment or other VPS environments)
  • Comfortable with YUM and RPM commands (Please don't blindly copy and paste code, understand it!)

Update your system before anything

yum install epel-release -y && yum update -y

This will install the EPEL Repository which contains updated packages over the base packages provided with CentOS out of the box.  Many of these updated packages also contain security updates, so I would highly suggest installing and using the EPEL Repository as default behavior.  Also, further dependencies later will require the EPEL repository, so in our case it is required.  After the EPEL Repository is installed, an update command will be issued.  Notice the -y after each yum command, which means force yes to any questions (read: automatic, no prompts).  

If after the update, there was any updates to the kernel, you will want to restart your machine.  To do so, issue a restart command:

shutdown -r now

Install the Nux Dextop YUM repository for FFMpeg packages

FFMpeg

 

Since there is not an official release of FFMpeg in RPM packages, we need to use the Nux Dextop repository which does contain FFMpeg.  Don't be concerned with the name of the repository, as we are not installing any GUI on your server, instead only using the repository for the FFMpeg packages bundled with it.

With CentOS 7, you can install the GPG Key and Repository with the following:  
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

With CentOS 6, the same can be accomplished with the following:

rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm

Install FFmpeg Packages

Now that we have the repository installed for our version of CentOS, we can now install FFMpeg.  Typically, most installs you will want to install the base FFMpeg and the FFMpeg Development packages.  To do this, simply issue the following command:

yum install ffmpeg ffmpeg-devel -y

Check that FFMpeg installed without issues

To check that FFMpeg is installed correctly, you can issue a simple ffmpeg command:

ffmpeg

This should result in something very similar to the following output:

 

ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)   configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect   libavutil      54. 20.100 / 54. 20.100   libavcodec     56. 26.100 / 56. 26.100   libavformat    56. 25.101 / 56. 25.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 11.102 /  5. 11.102   libavresample   2.  1.  0 /  2.  1.  0   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  1.100 /  1.  1.100   libpostproc    53.  3.100 / 53.  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'

You are ready to go, and FFMpeg is now installed.  Congratulations, you can now start converting your audio and video files on your server.

Looking for a version other than 2.6.8 for FFMpeg?  That is now also possible via an install script 

Static Prebuilt Install of FFMpeg. 

To do so, start by getting the install script:

wget https://raw.githubusercontent.com/q3aql/ffmpeg-install/master/ffmpeg-install

Then make the file executable:

chmod a+x ffmpeg-install

Now install a release version:

./ffmpeg-install --install release

Now double check that it works:

ffmpeg -version

ffmpeg version 3.3.2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.1 (Debian 5.4.1-11) 20170519 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100

Comments

Joaquim Martins (not verified) , Aug 21 2018 - 6:59am
I'm getting this error

Error: Package: libavdevice-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libcdio_paranoia.so.1(CDIO_PARANOIA_1)(64bit)
Error: Package: x265-libs-1.9-1.el7.nux.x86_64 (nux-dextop)
Requires: libm.so.6(GLIBC_2.15)(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libgnutls.so.28(GNUTLS_1_4)(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libass.so.5()(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libgmp.so.10()(64bit)
Error: Package: xvidcore-1.3.2-5.el7.nux.x86_64 (nux-dextop)
Requires: libm.so.6(GLIBC_2.15)(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libgnutls.so.28(GNUTLS_3_0_0)(64bit)
Error: Package: libavdevice-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libcdio_cdda.so.1()(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libopenjpeg.so.1()(64bit)
Error: Package: ffmpeg-libs-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libgnutls.so.28()(64bit)
Error: Package: libavdevice-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libcdio_paranoia.so.1()(64bit)
Error: Package: libavdevice-2.8.15-1.el7.nux.x86_64 (nux-dextop)
Requires: libcdio_cdda.so.1(CDIO_CDDA_1)(64bit)
It looks like you have missing dependency issues. Did you install and enable the EPEL repository prior to nux-desktop? Without EPEL this will fail, which is why it’s listed as required at the top. 😊