When I wrote the article back in June of 2018 on How to Install FFMpeg in CentOS 6 and 7, I did not expect it to be referenced so often! Originally, the article was written to guide how to install FFMpeg quickly, but like so many of the articles they are inspired by my desire to install something and not quite understanding other guides. Since it's been a while, I figured I'd do an updated install guide for CentOS.
If you want the quick and dirty method (copy and paste one line), please find our quick methods for CentOS 6 and CentOS 7 at the bottom. This is only recommended if you know what you're doing and are in a hurry! Everyone else, please continue reading.
- Running CentOS 6 or CentOS 7
- Root access or sudo privileges. (Unmanaged VPS accounts typically run root, while managed shared hosting environments or managed VPS accounts tend to use sudo users)
- Be comfortable with RPM and Yum. No blind copy and paste! Read what you're typing, and try to understand it. (Please pay special attention to concentrated commands, where there is a && between two commands)
- It is highly recommended to do this on a system that has not been modified, as other repositories or packages may cause conflicts. This will always work with a fresh / vanilla install.
Update your system
Your system should always be running the latest packages, for performance and security. Let's start by installing the Extra Packages for Enterprise Linux (EPEL) repository.
Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL). (-EPEL repository wiki)
Once we install the EPEL repository, then issue an update, the system will be running the latest, up to date packages available for a stable system. Let's begin by issuing the command.
yum install epel-release -y && yum update -y
After the repository is installed, and the updates run, if there was any updates to the kernel it is a great idea to restart your system. Do this with:
shutdown -r now
Install the Nux Dextop YUM repository
We are going to install FFMpeg using YUM, so it's simple commands and no complicated compiling of code. FFMpeg is available in the Nux Dextop repository, as there is not an official FFMpeg repository or RPM packages. 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.
CentOS 7 Nux Dextop repository
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
CentOS 6 Nux Dextop repository
In CentOS 6, the same is accomplished with a similar file:
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
Now install FFMpeg
We issue a simple YUM command at this point to install FFMpeg.
yum install ffmpeg ffmpeg-devel -y
If everything worked, you should now be able to use FFMpeg. To test, try this:
Which should yield results similar to this:
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
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' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --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. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Congratulations, you now have a working FFMpeg install! Enjoy encoding your audio and video :)
The Quick Way
If you are not really concerned with what's going on, or why, you can do a copy and paste blind faith install. I call it this, because you are trusting it will work :) Let's get started!
CentOS 7 Quick
Copy and paste this as a single line into your CentOS 7 Server. It is highly recommended you restart your computer after due to package updates.
yum install epel-release -y && yum update -y && 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 && yum install ffmpeg ffmpeg-devel -y && ffmpeg -version
CentOS 6 Quick
Copy and paste this as a single line into your CentOS 6 Server. It is highly recommended you restart your computer after due to package updates.
yum install epel-release -y && yum update -y && 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 && yum install ffmpeg ffmpeg-devel -y && ffmpeg -version