How to Install FFmpeg (Multimedia Framework) 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.

Similar Posts