Getting started with FFmpeg in Rocky Linux 9
FFmpeg is a free (LGPL, GPL licensed) free software project that produces programs and libraries for managing multimedia files. It can convert any video format to another video format by changing its codecs as well.
In this article, we will describe the installation of this application, which can be installed on many operating systems (Windows, GNU/Linux, Mac OS X), on Rocky Linux.
Steps to install FFmpeg Rocky Linux 9
The FFmpeg package is not available in Rocky Linux 9 base repos, you can install it by adding an extra repo. There are package repos and installation files for different distributions at its official address. This installation is the first method, another method is the installation by compiling the source code. Let's start.
Method -1- Install from Repository
Let's start the installation step by step.
Step-1 Install the EPEL/EPEL Next Repository
Install the epel-release-latest package:
[foc@rocky9 ~]$ sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
Then install the epel-next-release-latest package:
[foc@rocky9 ~]$ sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm
Step-2 Enable the EPEL/EPEL Next and CRP Repositories
First, enable the EPEL, EPEL-Next and CRB repository:
[foc@rocky9 ~]$ sudo dnf config-manager --enable epel,epel-next,crb
Step-3 Install the RPM Fusion Repository
We will install ffmpeg and its other dependencies from the RPM Fusion repository. First install the rpmfusion-free-release-9 package:
[foc@rocky9 ~]$ sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm
Then install the rpmfusion-nonfree-release-9 package:
[foc@rocky9 ~]$ sudo dnf install -y https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm
In the last case, the repolist should be as follows:
[foc@rocky9 ~]$ dnf repolist
repo id repo name
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
crb Rocky Linux 9 - CRB
epel Extra Packages for Enterprise Linux 9 - x86_64
epel-next Extra Packages for Enterprise Linux 9 - Next - x86_64
extras Rocky Linux 9 - Extras
rpmfusion-free-updates RPM Fusion for EL 9 - Free - Updates
rpmfusion-nonfree-updates RPM Fusion for EL 9 - Nonfree - Updates
And start the FFmpeg package installation:
[foc@rocky9 ~]$ sudo dnf -y install ffmpeg
The installation is completed by downloading packages from the repos we added earlier. Let's view the installed ffmpeg package:
[foc@rocky9 ~]$ rpm -qa ffmpeg
ffmpeg-5.1.1-2.el9.x86_64
Method -2- Building FFmpeg From Source Code
The source package can be downloaded as a compressed file in tar.bz2 format from the FFmpeg official address. The downloaded file should be extracted from the compressed file. Add the epel repo so you can install the packages you will need:
[foc@rocky9 ~]$ sudo dnf install epel-release -y
Install the following packages:
[foc@rocky9 ~]$ sudo dnf install wget nano tar lbzip2 gcc yasm -y
Get the source code:
[foc@rocky9 ~]$ wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
Extract from tar.bz2
file:
[foc@rocky9 ~]$ tar -xf ffmpeg-snapshot.tar.bz2
Go to the ffmpeg
directory:
[foc@rocky9 ~]$ cd ffmpeg
Then run configure command:
[foc@rocky9 ffmpeg]$ sudo ./configure
Run make and make install commands:
[foc@rocky9 ffmpeg]$ sudo make [foc@rocky9 ffmpeg]$ sudo make install
Installation is complete. You now have an ffmpeg
application in the directory (To Our example: /home/foc/ffmpeg
) where you downloaded the source code. Let's see which version we downloaded:
[foc@rocky9 ffmpeg]$ ./ffmpeg -version
ffmpeg version N-108450-g9d52844aba Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11 (GCC)
configuration:
libavutil 57. 38.100 / 57. 38.100
libavcodec 59. 48.100 / 59. 48.100
libavformat 59. 33.100 / 59. 33.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 49.100 / 8. 49.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
FFmpeg Command-Line Tools
The principal FFmpeg tool is ffmpeg itself. The simplest use is as a converter from one format to another, as follows:
ffmpeg -i file.ogg file.mp3
This will convert an Ogg container of Vorbis codec data to an MPEG container of MP2 codec data.
The Libav equivalent is avconv, which runs similarly.
avconv -i file.ogg file.mp3
Internally, ffmpeg uses a pipeline of modules
The muxer/demuxer and decoder/encoder can all be set using options if the defaults are not appropriate.
The following are other commands:
ffprobe
gives information about a file.ffplay
is a simple media player.ffserver
is a media server.
Summary
It may be easier and stable to install from the repository. But the source code provides the use of up-to-date code. We told you 2 methods, now the choice is yours.
In the installation from the repository, the following 2 commands will be helpful for post-installation:
[foc@rocky9 ~]$ man ffmpeg
NAME
ffmpeg - ffmpeg video converter
SYNOPSIS
ffmpeg [global_options] {[input_file_options] -i input_url} ...
{[output_file_options] output_url} ...
For help:
[foc@rocky9 ~]$ ffmpeg --help
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
After installation from source code, you should run the following command for help in ffmpeg home directory:
foc@rocky9 ffmpeg]$ ./ffmpeg --help
References
rpmfusion.org - Download FFmpeg