How to install FFmpeg on your VPS / Dedicated Server

In this tutorial we will show you how to install FFmpeg on your VPS/dedicated server running on CentOS 6 64bit with cPanel.

First off, what is FFmpeg?

FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge technology. No matter if they were designed by some standards committee, the community or a corporation.

Most  of the PHP applications for video sharing (such as CumulusClips, ClipBucket and many more) are using the FFmpeg command line tool to convert videos to a proper format playable by the built-in video players.

Different applications require different audio/video codecs and different FFmpeg versions. In this tutorial we will cover the basic installation of FFmpeg and explain how you can add the required codecs before the installation.

When you have decided which video-sharing platform you will use, you need to check the required codecs for it. Most of the platforms have them included in their documentation or during the installation you will see them on the checking stage.

Before we start we need to mention that you will need SSH access to your VPS/Dedicated server and root privileges.

Let’s prepare our system by adding the EPEL repository (if you have done this already, you can skip to the next step)

        # wget dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
        # rpm -Uvh epel-release-6-8.noarch.rpm

Now we have a lot more tools available. Let’s install the dependencies for compiling and configuring FFmpeg:

        # yum install autoconf automake gcc gcc-c++ git libtool make yasm nasm pkgconfig zlib-devel

We will pull the latest version from the FFmpeg GitHub repository:

cPanel Hosting from WebhostFace

        # git clone git://git.videolan.org/ffmpeg.git

After the download is finished you should see a directory called ‘ffmpeg’ containing all the files.

        # cd ffmpeg

Once you are in the directory, we can begin the configuration of FFmpeg.

Here is the part where you need to include the codecs for your application. For example, CumulusClips requires Xvid, Lame, Faac, OpenCore AMR, OGG, Vorbis, VPX, Theora and x264 codecs to function properly. When we have them installed they should also be included in the ffmpeg installation. This is done by the configuration file. Here is what we need to tell the configuration file if we want to enable all of the mentioned codecs:

        #  ./configure –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libfaac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –enable-gpl –enable-postproc –enable-nonfree –enable-libvpx –extra-ldflags=-ldl

When this command is executed FFmpeg will be configured to use them and it will know where they are located. Now we can proceed with the compilation of FFmpeg:

        # make

This can take a lot of time depending on the hardware resources that you have. When this is done we can finally install ffmpeg:

        # make install

In the end, we are set and ready to use FFmpeg. You can issue the command ‘ffmpeg’ and you will be presented with some information about your build such as version, enabled codecs etc.

was this knowledge base article useful to you