FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. It is a complete, cross-platform solution to record, convert and stream audio and video.
FFmpeg is used to play, encode, decode, stream, transcode, mux, demux, and filter different formats of multimedia files including MPEG1 audio and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash. At its core is the command-line ffmpeg tool itself, designed for processing of video and audio files. FFmpeg is a cross-platform application as it can run on Linux, macOS, Windows, BSDs, Solaris, etc, under wide variety of build environments, configurations and machine architectures. Most media players available for Linux and Audio/Video downloaders and converters such as youtube-dl require FFmpeg to work.
In this guide, we will learn how to install Ffmpeg in Rocky Linux/Alma Linux 8.
Table of content
- Ensure that the server is up to date
- Installing RPM Fusion repository
- Install FFmpeg
- Using FFmpeg
1. Ensure that the system is up to date
Before proceeding, it is always a good practice to ensure that the server is updated. Use this command to update the server packages:
sudo dnf -y update
2. Install RPM Fusion Repository
The packages providing ffmpeg are not available in the default Rocky Linux repos. The RPM Fusion repository has Ffmpeg. The RPM Fusion repository was created to provide software not shipped by Fedora and Red Hat based distributions. All software applications available in this repository are provided as precompiled RPM files.
We will need to enable EPEL on Rocky Linux before we install RPM fusion. EPEL is a repository that provides extra packages for Enterprise Linux. Use this command to install EPEL release:
sudo dnf -y install https://download.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm sudo yum-config-manager --enable powertools
We can now install RPM Fusion. Use these commands to enable the free and non free repositories:
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm -y sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm -y
3. Install FFmpeg
Once the RPM Fusion repos is installed, we can install FFmpeg. Run these commands to install ffmpeg. A number of dependencies will be installed in the process:
sudo dnf install -y ffmpeg
We can also install the development libraries:
sudo dnf -y install ffmpeg-devel
Confirm the instllation:
$ rpm -qi ffmpeg Name : ffmpeg Version : 4.2.5 Release : 2.el8 Architecture: x86_64 Install Date: Fri 14 Jan 2022 02:57:02 PM UTC Group : Unspecified Size : 1932220 License : GPLv2+ Signature : RSA/SHA1, Fri 03 Dec 2021 05:39:21 PM UTC, Key ID 979f0c69158b3811 Source RPM : ffmpeg-4.2.5-2.el8.src.rpm Build Date : Wed 01 Dec 2021 04:57:45 PM UTC Build Host : buildvm-07.virt.rpmfusion.net Relocations : (not relocatable) Packager : RPM Fusion Vendor : RPM Fusion URL : http://ffmpeg.org/ Summary : Digital VCR and streaming server Description : FFmpeg is a complete and free Internet live audio and video broadcasting solution for Linux/Unix. It also includes a digital VCR. It can encode in real time in many formats including MPEG1 audio and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash.
You can also check the installed version
$ ffmpeg -version ffmpeg version 4.2.5 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (GCC) ...
4. Using ffmpeg
FFmpeg can be used to achieve many functions. The usage of ffmpeg depends on individual projects and desired output. A simple use case is to convert a video to audio, i.e. extracting an audio from video.
Extracting an audio from a video:
ffmpeg -i video.mp4 -c:a libmp3lame -q:a 0 -map a output_file.mp3
In the above syntax, video.mp4 is the input video file and output_file.mp3 is the output audio file. The -map a tag takes the default audio stream and excludes any subtitles, c:a specifies the codec for the audio to be used, and q:a defines a variable bitrate for the audio.
For more info check the FFmpeg documentation. You can also check command line options with:
That is it! You have learnt how to install ffmpeg in Rocky Linux.
you missed to install yum-utils, as there’s no yum-config-manager installed per default 🙂
sudo dnf -y install yum-utils.noarch
Thanks for this!