How to install and use FFmpeg on CentOS 8

FFmpeg is a free and open source command line tool for encoding multimedia files. FFmpeg has a bunch of shared audio and video libraries like libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between different video and audio formats, set sample rate, and resize the video (resize).

This tutorial covers the steps required to install FFmpeg on CentOS 8.

Install FFmpeg on CentOS 8

FFmpeg is not available in default CentOS 8 repositories. You can choose to create FFmpeg from source or install with dnf from Negativo17 repository. The second option we will use is to install with dnf from the Negativo17 repository

Complete the following steps to install FFmpeg on CentOS 8:

  1. Negativo17 repository is based on EPEL and PowerTools repository. Run the following command as root or a user with sudo privileges to enable the required repositories:
    sudo dnf install epel-release
    sudo yum config-manager --set-enabled PowerTools
    sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
  2. Once the repository is enabled, install FFmpeg:
    sudo dnf install ffmpeg
  3. Check if FFmpeg is installed by checking the version:
    ffmpeg -version

    At the time of writing this article, the current version of FFmpeg available on Negativo17 is 2.8.15.

    ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8 (GCC)
    ...

    The command will also display FFmpeg configuration. The command will also display FFmpeg configuration options.

FFmpeg is already installed on your CentOS machine, and you can start using it.

Examples of using FFmpeg on CentOS 8

In this section, we’ll look at some basic examples of how to use utilities ffmpeg.

Primary conversion

When converting audio and video files with ffmpeg, you don’t need to select the input and output formats. The input file format is automatically detected, and the output format is guessed based on the file extension.

  • Convert video files from mp4 to webm:
    ffmpeg -i input.mp4 output.webm
  • Convert audio files from mp3 to ogg:
    ffmpeg -i input.mp3 output.ogg

Using codecs

When converting files, you can select which codec to use with the options -c. The codec can be the name of each supported decoder / encoder or value copy Which copies only the input stream.

  • Convert mp4 videos to webm with libvpx video codec and libvorbis audio codec:
    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

Conclusion

You have successfully installed FFmpeg on CentOS 8. You can now visit the official FFmpeg documentation page and learn how to use FFmpeg to convert video and audio files.

.

Source link

Leave a Reply

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