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.
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:
|
|
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:
|
|
We can now install RPM Fusion. Use these commands to enable the free and non free repositories:
|
|
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:
|
|
We can also install the development libraries:
|
|
Confirm the installation:
|
|
You can also check the installed version
|
|
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:
|
|
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.