Install and Use FFmpeg on AlmaLinux 9 – Best Steps
In this guide, we want to teach you how to Install and Use FFmpeg on AlmaLinux 9. FFmpeg is a free software project that produces libraries and programs for handling and manipulating multimedia data. FFmpeg can handle transcoding, video and image manipulation (resizing, denoising, etc.), packaging, streaming, and playback. It is the most popular video and image processing software and is used by many companies across various industries. The ability to Install and Use FFmpeg on AlmaLinux 9 opens up a world of possibilities for multimedia management.
Now you can proceed to the following guide steps that are provided by the Orcacore team to Install and Use FFmpeg on AlmaLinux 9.
To Install and Use FFmpeg on AlmaLinux 9, log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 9.
1. Install RPM Fusion For FFmpeg Setup
FFmpeg packages aren’t available in the default AlmaLinux 9 repository. So you need to add the RPM fusion repo on your server.
First, update your local package index with the command below:
sudo dnf update -y
Then, install the Epel repository by using the command below:
sudo dnf install epel-release -y
Enable PowerTools by using the following command:
sudo dnf config-manager --set-enabled crb
Now use the following commands to add the RPM Fusion repos on your AlmaLinux 9 repository:
# sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y
# sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y
2. Install FFmpeg on AlmaLinux 9
At this point, you can easily use the following command to Install FFmpeg on AlmaLinux 9:
sudo dnf install ffmpeg ffmpeg-devel -y
You can verify your installation by checking its version:
ffmpeg -version
**<mark>Output</mark>**
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11 (GCC)
Also, you can get full information about your FFmpeg by using the command below:
rpm -qi ffmpeg
**<mark>Output</mark>**
Name : ffmpeg
Version : 5.1.2
Release : 9.el9
Architecture: x86_64
Install Date: Sat 04 Mar 2023 03:45:48 AM EST
Group : Unspecified
Size : 2295097
License : GPLv3+
Source RPM : ffmpeg-5.1.2-9.el9.src.rpm
Build Date : Sun 08 Jan 2023 07:50:09 AM EST
Build Host : buildvm-07.virt.rpmfusion.net
Packager : RPM Fusion
Vendor : RPM Fusion
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.
3. List Available FFmpeg Encoders and Decoders
At this point that you have learned to Install and Use FFmpeg on AlmaLinux 9, you can now see all available FFmpeg encoders and FFmpeg decoders types on AlmaLinux 9 with the following commands:
ffmpeg -encoders

ffmpeg -decoders

At this point, you have installed FFmpeg on your AlmaLinux 9. Now you can start using it.
4. How To Use FFmpeg on AlmaLinux 9?
In this step of this guide on Install and Use FFmpeg on AlmaLinux 9, we will show you how to use FFmpeg with some basic examples.
You don’t have to specify the input and output formats when you are converting the audio and video files with FFmpeg on AlmaLinux 9.
The input file format is auto-detected, and the output format is guessed from the file extension.
For example, to convert a video file from mp4 to webm you can use the following command:
ffmpeg -i input.mp4 output.webm
To convert an audio file from mp3 to ogg you can use the following command:
ffmpeg -i input.mp3 output.ogg
Also, you can use the –c parameter to specify the codecs when you are converting the files.
For example, you can convert a video file from mp4 to webm using the libvpx video codec and the libvorbis audio codec:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
To convert an audio file mp3 to ogg encoded with the libopus codec, you can use the following command:
ffmpeg -i input.mp3 -c:a libopus output.ogg
For more details and information about FFmpeg, you can visit the official FFmpeg documentation page
Conclusion
By following the steps to Install and Use FFmpeg on AlmaLinux 9, you can effortlessly convert, encode, and manipulate different media formats on your system. Whether you’re a system administrator managing server-side media files or a developer working with multimedia applications, FFmpeg offers robust tools to streamline your workflow. AlmaLinux 9’s compatibility with FFmpeg ensures that you have access to this powerful tool to enhance your media processing tasks efficiently.
Hope you enjoy it. You may also interested in these articles:
Introduce AlmaLinux 10 Beta Release
Install Tesseract OCR on AlmaLinux 9
Install and Secure Wekan Server on AlmaLinux 9
HAproxy Load Balancing Setup AlmaLinux 9
Remmina Remote Desktop Setup AlmaLinux 9
Install Chromium Browser on AlmaLinux 9
Resolve Failed to mount /sysroot in AlmaLinux
Learn to Search Audit Logs in AlmaLinux
FAQs
Can I use FFmpeg to convert video formats?
Yes, FFmpeg can convert videos between different formats. For example, to convert a video from MP4 to AVI format, you can use the following command:ffmpeg -i input.mp4 output.avi
What multimedia formats does FFmpeg support?
FFmpeg supports many multimedia formats such as MP4, AVI, MOV, MKV, MP3, WAV, and many more.
What are the common use cases for FFmpeg on AlmaLinux?
You can use FFmpeg for video and audio conversion, streaming, compressing large files, and extracting audio from videos. It’s also used in broadcasting and media processing pipelines.
Alternative Solutions for Installing FFmpeg on AlmaLinux 9
While the RPM Fusion repository method is a common and generally reliable way to install FFmpeg on AlmaLinux 9, there are alternative methods you can consider. These might be useful if you encounter issues with RPM Fusion, prefer a different installation approach, or require a specific version of FFmpeg not available through the standard repositories.
1. Using Snap
Snap is a universal package manager that works across many Linux distributions, including AlmaLinux. While it’s not the "native" package manager for AlmaLinux, it offers a convenient way to install software, especially when the desired package isn’t readily available in the standard repositories.
Explanation:
Snaps are containerized software packages that include all their dependencies. This means they are self-contained and less likely to conflict with other software on your system. This isolation can be beneficial, but it also means that snaps can sometimes be larger than traditionally packaged software.
Steps:
-
Enable Snapd: AlmaLinux doesn’t have Snapd installed by default. You’ll need to install it first.
sudo dnf install snapd sudo systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap
-
Install FFmpeg via Snap: Now you can install FFmpeg using the
snap install
command.sudo snap install ffmpeg
-
Verify Installation: Check the version of FFmpeg to confirm it’s installed correctly.
ffmpeg -version
Code Example (Usage):
The usage remains the same as with the RPM Fusion installation. For example:
ffmpeg -i input.mp4 output.webm
Pros:
- Simple installation process.
- Self-contained, reducing dependency conflicts.
- Often provides newer versions of software.
Cons:
- Snap packages can be larger than native packages.
- Snapd adds overhead to the system.
- The containerized nature might introduce slight performance differences.
- Requires Snapd to be installed.
2. Compiling from Source
Compiling from source gives you the most control over the installation process. You can customize FFmpeg with specific features and optimizations for your hardware. However, it’s also the most complex and time-consuming method.
Explanation:
Compiling from source involves downloading the FFmpeg source code, configuring the build process, and then compiling the code into executable binaries. This requires having the necessary development tools and libraries installed on your system.
Steps:
-
Install Development Tools: You’ll need a compiler (like GCC), build tools (like
make
), and development libraries.sudo dnf groupinstall "Development Tools" sudo dnf install autoconf automake libtool pkgconfig sudo dnf install zlib-devel bzip2-devel libX11-devel sudo dnf install yasm
-
Download FFmpeg Source Code: Download the latest source code from the FFmpeg website (https://ffmpeg.org/download.html). Replace
<version>
with the actual version number.wget https://ffmpeg.org/releases/ffmpeg-<version>.tar.gz tar xvf ffmpeg-<version>.tar.gz cd ffmpeg-<version>
-
Configure, Build, and Install: Configure the build process, compile the code, and install FFmpeg.
./configure --prefix=/opt/ffmpeg --enable-gpl --enable-nonfree make sudo make install
-
Add FFmpeg to Path: Add the FFmpeg binaries to your system’s PATH so you can run them from any directory. Edit
~/.bashrc
(or your shell’s equivalent) and add the following line:export PATH="$PATH:/opt/ffmpeg/bin"
Then, source your
~/.bashrc
file:source ~/.bashrc
-
Verify Installation:
ffmpeg -version
Code Example (Configuration with specific libraries):
You can enable specific libraries during the configuration step. For example, to enable libx264 (a popular H.264 encoder) and libfdk-aac (a high-quality AAC encoder), you would add the following to the ./configure
command:
./configure --prefix=/opt/ffmpeg --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk-aac --enable-encoder=libx264 --enable-encoder=aac
Note: You might need to install the dependencies for these libraries separately.
Pros:
- Maximum control over the installation and configuration.
- Opportunity to optimize FFmpeg for your specific hardware.
- Potential to use the latest, unreleased versions.
Cons:
- Most complex and time-consuming method.
- Requires a good understanding of the build process.
- Requires managing dependencies manually.
- Can be prone to errors if not done carefully.
By understanding these alternative installation methods, you’ll be better equipped to troubleshoot any issues you encounter and choose the best approach for your specific needs when you need to Install and Use FFmpeg on AlmaLinux 9. Remember to choose the method that best aligns with your technical expertise and system requirements.