Install FFmpeg on Rocky Linux 9|AlmaLinux 9|Oracle Linux 9

FFmpeg is a free and open-source project that consists of programs and libraries capable of transcoding audio, video, and other multimedia files/streams. The core of this tool consists of the command line FFmpeg which processes the audio and video files. The main task of FFmpeg is format transcoding and basic editing that includes trimming, video scaling e.t.c. The libraries included in this project are:

  • Libavcodec – an audio/video codec library
  • Libavformat (Lavf) – an audio/video container mux
  • Libavfilter – used for enhancing and editing filters through a Gstreamer-like filter graph.
  • Libavutil – utility library to aid portable multimedia programming
  • Libswscale – performs highly optimized image scaling and colorspace and pixel format conversion operations.
  • Libswresample – performs highly optimized audio resampling, rematrixing, and sample format conversion operations.
  • Libavdevice – provides a generic framework for grabbing from and rendering to many common multimedia input/output devices

The amazing features associated with FFmpeg are:

  • Supports several protocols such as HTTP/HTTPS, TCP, TLS, UDP, FTP, SFTP, HLS, UDP-Lite e.t.c
  • Supports filters that include; Resampling, Pass/Stop filters, Equalizer, Dynamics, Distortion, Filtering e.t.c
  • Supports media and interfaces such as compact discs, Advanced Linux Sound Architecture (ALSA), OpenAL (input only), Windows DirectShow e.t.c
  • SUpports several common and uncommon image, audio, and video formats.

This guide offers an illustration of how to install and use FFmpeg on Rocky Linux 8|AlmaLinux 8|Oracle Linux 8. Before we dive into the crux of this matter, you need to ensure that all the available packages are updated to their latest available versions.

sudo dnf -y update

Step 1 – Add the RPM Fusion Repository

The FFmpeg packages are not provided in the default Rocky Linux 9|AlmaLinux 9|Oracle Linux 9 repositories. To be able to install FFmpeg, we need to add the RPM Fusion repository to the system.

Begin by enabling the EPEL repository:

sudo dnf -y install https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf install yum-utils -y
sudo dnf config-manager --enable crb

Now proceed and add the RPM Fusion repository:

sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm -y
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm -y

Step 2 – Install FFmpeg on Rocky Linux 9|AlmaLinux 9|Oracle Linux 9

Once the RPM Fusion repository has been added, we can easily install FFmpeg with the command:

sudo dnf install ffmpeg ffmpeg-devel

Once the installation is complete, check the installed version as below:

$ ffmpeg -version
ffmpeg version 5.1.6 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (GCC)
....

Check more information about the package

$ rpm -qi ffmpeg
Name        : ffmpeg
Version     : 5.1.6
Release     : 2.el9
Architecture: x86_64
Install Date: Thu 16 Jan 2025 06:35:12 PM EAT
Group       : Unspecified
Size        : 2295814
License     : GPLv3+
Signature   : RSA/SHA256, Sat 23 Nov 2024 02:00:55 PM EAT, Key ID 7403ea33296458f3
Source RPM  : ffmpeg-5.1.6-2.el9.src.rpm
Build Date  : Thu 21 Nov 2024 07:49:17 AM EAT
Build Host  : buildvm-07.virt.rpmfusion.net
Packager    : RPM Fusion
Vendor      : RPM Fusion
URL         : https://ffmpeg.org/
Bug URL     : https://bugz.rpmfusion.org/ffmpeg
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.

Step 3 – Use FFmpeg on Rocky Linux 9|AlmaLinux 9|Oracle Linux 9

FFmpeg can be used to perform a variety of functions depending on the individual’s needs. For this guide, we will focus on the main use which is transcoding.

Basic conversion

During conversion, you need to specify the input and output files. The input formats are detected automatically and the output is guessed depending on the provided filename extension.

  • Convert video files from mp4 to WebM:

For example, converting a video file to WebM format, use the below syntax.

ffmpeg -i input.mp4 output.webm

Using the command will be:

ffmpeg -i sample-mp4-file.mp4 output.webm

After the command, I will have the output.webm in my working directory.

  • Convert audio files from mp3 to Ogg

Audio files can be converted to the Ogg format using the syntax.

ffmpeg -i input.mp3 output.ogg

Using a codec

You can transcode a file by specifying the codec to be used. Normally, the -cflag is used to specify the codec.

For example, the above commands can be used with the codec as below:

  • Convert video files from mp4 to WebM using the libvpx video codec and libvorbis audio codec as below:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
  • Convert audio files from mp3 to Ogg encoded with libopus codec.
ffmpeg -i input.mp3 -c:a libopus output.ogg
  • Extract audio from a Video file
ffmpeg -i video.mp4 -c:a libmp3lame -q:a 0 -map a output_file.mp3

Replace video.mp4 with the name input video file and output_file.mp3 with the audio file name. The – c:a flag is used to specify the codec for the audio and -q:a defines a variable bitrate for the audio file.

Check more command-line options for FFmpeg using the command:

ffmpeg --help

Closing Thoughts.

That marks the end of this brief guide on how to install and use FFmpeg on Rocky Linux 8|AlmaLinux 8|Oracle Linux 8. I hope this was significant to you.

Related posts:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

For most system admins, their day-to-day life activities revolve around having access to remote systems.VNC an acronym for Virtual Network […]

PostgreSQL is an open-source object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2. Postgresql was developed at the University […]

Today’s tutorial will show you how to install WordPress with Apache and Let’s Encrypt on an Ubuntu 24.04|22.04 Linux system […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.