How to Install FFmpeg in Linux

FFmpeg is a powerful and open-source multimedia framework that contains various tools for different tasks.

For example, the ffplay is a portable media player that can be used to play audio/video files, ffmpeg can convert between different file formats, ffserver can be used to stream live broadcasts and ffprobe is able to analyze multimedia streams.

FFmpeg framework is really powerful due to the diversity of available tools, that provide the best technical solution for the user.

According to the description of FFmpeg on the official website, the reason for having such a great multimedia framework is the combination of the best free software options available.

The FFmpeg framework offers high security and the reason for this is the seriosity of the developers when they review the code, it is always done with security in mind.

I am very sure you will find the FFmpeg framework very useful when you would like to do some digital audio and video streaming or recording.

There are many other practical things that you can do with the help of the FFmpeg framework such as converting your wav file to an mp3 one, encoding and decoding your videos, or even scaling them.

According to the official website, FFmpeg is able to do the following.

  • decode multimedia files
  • encode multimedia files
  • transcode multimedia files
  • mux multimedia files
  • demux multimedia files
  • stream multimedia files
  • filter multimedia files
  • play multimedia files

Let me take an example, a very simple one. The following command will convert your mp4 file into an avi file, simple as that.

ffmpeg -i Lone_Ranger.mp4 Lone_Ranger.avi

The above command is only useful for explanation, it is not recommended to be used in practice because the codec, bitrate, and other specifics are not declared.

In the next part, we will practice with some of the FFmpeg multimedia framework tools, but before doing that we have to install them in our Linux box.

How to Install FFmpeg in Linux

Since the FFmpeg packages are offered for the most used Linux distributions and the installation will be relatively easy.

To install FFmpeg on Linux, use the following appropriate command for your specific Linux distribution.

sudo apt install ffmpeg         [On Debian, Ubuntu and Mint]
sudo yum install ffmpeg         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/ffmpeg  [On Gentoo Linux]
sudo apk add ffmpeg             [On Alpine Linux]
sudo pacman -S ffmpeg           [On Arch Linux]
sudo zypper install ffmpeg      [On OpenSUSE]    
sudo pkg install ffmpeg         [On FreeBSD]

How to Compile FFmpeg from Source

Compiling software from a source is not the easiest thing in the world, but compiling FFmpeg from a source allows you to customize the build based on your specific needs and requirements.

First, install the necessary build tools and multimedia libraries on your system.

On Debian-based Systems

sudo apt update
sudo apt install build-essential
sudo apt install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev

On RHEL-based Systems

sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig SDL-devel \
a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel freetype-devel giflib gsm gsm-devel \
imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel libXau-devel libXdmcp-devel \
libXext-devel libXrandr-devel libXrender-devel libXt-devel libogg libvorbis vorbis-tools mesa-libGL-devel \
mesa-libGLU-devel xorg-x11-proto-devel zlib-devel libtheora theora-tools ncurses-devel libdc1394 libdc1394-devel \
amrnb-devel amrwb-devel opencore-amr-devel

Next, download the FFmpeg source code from the official website or using the Git version control system and install it as shown.

git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --enable-gpl --enable-libx264 --enable-libfdk-aac --enable-nonfree
make
sudo make install
ffmpeg -version

Keep in mind that these instructions are general, and the specific steps may vary depending on your Linux distribution and the version of FFmpeg you are compiling.

Refer to the FFmpeg documentation for detailed instructions and any additional requirements for your platform.

Conclusion

In this first part, we updated our readers with the latest news according to the FFmpeg multimedia framework and showed them how to install it on their Linux machines.

The next part will be totally about learning how to use ffmpeg to perform various audio, video, and image conversion procedures.

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

13 thoughts on “How to Install FFmpeg in Linux”

    • @Diva,

      The instructions are already provided in the article on how to Set up FFMPEG in a Linux server, just go through it…

      Reply
    • @Alok,

      Run the following commands to Install FFmpeg on CloudLinux OS.

      # yum install ffmpeg ffmpeg-devel ffmpeg-libs
      # yum install alt-php*ffmpeg
      
      Reply
  1. Hi,

    This is mani, when I was trying to install the FFMPEG tool in Redhat 7.6, I am getting Library errors.

    Error: Package: libva-1.8.3-0.1.el7.x86_64 (epel-multimedia)
               Requires: libEGL.so.1()(64bit)
    Error: Package: jack-audio-connection-kit-1.9.9.5-6.el7.x86_64 (epel)
               Requires: libsamplerate.so.0(libsamplerate.so.0.0)(64bit)
    Error: Package: 1:ffmpeg-libs-4.2.2-3.el7.x86_64 (epel-multimedia)
               Requires: libfontconfig.so.1()(64bit)
    Error: Package: 1:ffmpeg-libs-4.2.2-3.el7.x86_64 (epel-multimedia)
               Requires: libX11.so.6()(64bit)
    Error: Package: tesseract-3.04.00-3.el7.x86_64 (epel)
               Requires: libpango-1.0.so.0()(64bit)
    Error: Package: 1:ffmpeg-libs-4.2.2-3.el7.x86_64 (epel-multimedia)
               Requires: libtheoraenc.so.1(libtheoraenc_1.0)(64bit)
    ...
    
    Reply
  2. I can’t fetch update from this repo ‘ppa:mc3man/trusty-media‘.

    My environment : Ubuntu 19.04

    E: The repository ‘http://ppa.launchpad.net/mc3man/trusty-media/ubuntu disco Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

    Reply
    • @Tom,

      The PPA does not support your version of Ubuntu, better install FFMPEG from default repositories.

      $ sudo apt intall ffmpeg
      

      Make sure to remove the added PPA:

      $ sudo ppa-purge ppa:mc3man/trusty-media
      
      Reply
  3. hello..the above tutorials for ffmpeg wont work with atrpms repository for centos 7…since atrpms server is dead..its no longer available..
    one can download the above commands by enabling nux desktop repository explicitely..

    sudo yum -y –enablerepo=rpmforge install ffmpeg ffmpeg-devel
    and also to the above dependency packegaes

    Reply
  4. Hello, people!

    I am trying to use Clip Bucket with FFPMEG conversion, but the script sent the parm ‘- aspect 0’, but the FFMPEG 2.2.4 do not recognize it.

    Some technicians talked to me for downgrade to FFMPEG 0.9.1. However, I want to use newest version.

    Look my problem:

    Converting Video
    Conversion Command : /usr/bin/ffmpeg -i /files/conversion_queue/140413494554888.mp4 -f flv -vcodec libx264 -preset normal -r 25 -s 0x0 -aspect 0 -vf pad=0:0:0:0:black -acodec libfaac -ab 128000 -an /files/videos/140413494554888.flv 2> /files/temp/140413500190db3.tmp

    Conversion Details

    ffmpeg version 2.2.4- http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2014 the FFmpeg developers
    built on Jun 24 2014 20:49:40 with gcc 4.9 (Debian 4.9.0-7)
    configuration: –enable-gpl –enable-version3 –disable-shared –disable-debug –enable-runtime-cpudetect –enable-libmp3lame –enable-libx264 –enable-libwebp –enable-libspeex –enable-libvorbis –enable-libvpx –enable-libfreetype –enable-fontconfig –enable-libxvid –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libtheora –enable-libvo-aacenc –enable-libvo-amrwbenc –enable-gray –enable-libopenjpeg –enable-libopus –disable-ffserver –enable-libass
    libavutil 52. 66.100 / 52. 66.100
    libavcodec 55. 52.102 / 55. 52.102
    libavformat 55. 33.100 / 55. 33.100
    libavdevice 55. 10.100 / 55. 10.100
    libavfilter 4. 2.100 / 4. 2.100
    libswscale 2. 5.102 / 2. 5.102
    libswresample 0. 18.100 / 0. 18.100
    libpostproc 52. 3.100 / 52. 3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘/files/conversion_queue/140413494554888.mp4’:
    Metadata:
    major_brand : isom
    minor_version : 0
    compatible_brands: isomiso2avc1
    creation_time : 2013-12-25 18:45:13
    Duration: 00:00:10.29, start: 0.000000, bitrate: 817 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640×360, 700 kb/s, 30.11 fps, 30.11 tbr, 30107 tbn, 60214 tbc (default)
    Metadata:
    creation_time : 2013-12-25 18:45:12
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
    creation_time : 2013-12-22 22:48:57
    Invalid aspect ratio: 0
    Conversion failed!

    Thanks a lot!

    Reply
    • The part 2 of this series, will be published soon. The author (Oltjano Terpollari) having some serious personal issues, due to this, he may not getting time to publish the 2nd part of this series. And we not repeating it, we updating the article based on newer ffmpeg release. Please co-operate with us, will soon publish a remain part of this portion.

      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.