What is FFmpeg? How to install it on Ubuntu?

Today in this article you will see what is FFmpeg and how to install it on a Ubuntu system.

What is FFmpeg?

FFmpeg (Fast Forward Moving Picture Experts Group) is a free and open-source software suite that consists of various libraries and programs for handling audio, video, and other media files and streams. It is consist of mainly three command-line tools and these are –

  • ffmpeg – This command is used for converting audio or video formats it can be used to encode or decode media in real-time.
  • ffplay– A simple media player
  • ffprobe– Used to display media information

It can be used to decode, encode, transcode, mux, demux, stream, filter, and play various types of video and audio. By using ffmpeg command you can create GIFs from video files easily.

Features of FFmpeg

  • It provides very high-speed audio and video conversion
  • Supports almost all the audio and video formats
  • It is highly portable
  • Highly secure
  • Many modern players use it in the backend
  • It also supports basic editing and video scaling
  • Provides post-production effects

How to install FFmpeg in Ubuntu

The FFmpeg package is available in the default repository of Ubuntu. You can directly install it on your system by using the apt command in your terminal.

But before you run a command to install a package on your system make sure the package repository is updated –

sudo apt update

Use the following command to install FFmpeg on your system –

sudo apt install ffmpeg

Press y and then enter if it asks for your confirmation.

You can verify the installation by using –

ffmpeg -version

This will display the output something as given in the image below –

ffmpeg version

How to use ffmpeg in Ubuntu

Once the installation is completed you can start using ffmpeg command in your terminal.

To display encoder available with the current version of ffmpeg use –

ffmpeg -encoders

ffmpeg encoders

You can scroll and view the complete list of encoders.
Similarly, by running the given command you can view decoders that are available with the installed version of ffmpeg on your system.

ffmpeg -decoders

decoders

Using ffmpeg to display the information of a media file

By using the given command you can view the details of a media file in your terminal-

ffmpeg -i file.mp4

Here replace the file.mp4 with your original file name and extension.

Using ffmpeg to extract the audio from a video file

Run the given command to extract the audio from a video file in your terminal –

ffmpeg -i input_file.mp4 -vn output_file.mp3

Again modify the input and output file names with yours.

Using ffmpeg to convert a media file from one format to other

By using the commands given below you can convert an audio or video file from one format to another.

For example to convert a file from mp4 to webm format use –

ffmpeg -i input_file.mp4 output_file.webm

To convert an mp3 file to ogg use –

ffmpeg -i input_file.mp3 output_file.ogg

Play a media file after conversion

Using the ffplay command you can play a media file from your terminal.

For example –

ffplay output_file.ogg

For more information on how to use the FFmpeg command, you can view its manpage. Run the given command to see the FFmpeg manpage in your terminal.

man ffmpeg

Conclusion

Ok, so now we hope you have successfully installed FFmpeg on your system and are able to use it.

Now if you have a query or feedback then write us in the comments below.

Leave a Comment