How to Install and Use FFmpeg on Ubuntu 20.04 or Debian 10

FFmpeg on Ubuntu or Debian

Here you will see how easy it is to install and use FFmpeg on Ubuntu 20.04 or Debian 10 and earlier to perform a variety of tasks on audio and video files.

FFmpeg is an open-source and cross-platform application for handling video, audio, and other multimedia files and streams. At its core is the command-line interface used to perform a large number of tasks while processing video and audio files.

First off, we will need to make sure our Ubuntu or Debian installation is up-to-date.

$ sudo apt update
$ sudo apt upgrade

We can now Install FFmpeg on Ubuntu 20.04 or Debian 10

It so happens that Ubuntu 20.04 LTS contains the FFmpeg apt packages in the default repositories. We can simply execute the following commands:

$ sudo apt install ffmpeg

Confirm the FFmpeg installed on your system by checking the version on your system using:

$ ffmpeg -version

With output that looks like this:

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)

You can list the capabilities of FFmpeg by running any one of these commands in your terminal:

  • ffmpeg -version: show version
  • ffmpeg -formats: show available formats
  • ffmpeg -codecs: show available codecs
  • ffmpeg -decoders: show available decoders
  • ffmpeg -encoders: show available encoders
  • ffmpeg -bsfs: show available bitstream filters
  • ffmpeg -protocols: show available protocols
  • ffmpeg -filters: show available filters
  • ffmpeg -pix_fmts: show available pixel formats
  • ffmpeg -layouts: show standard channel layouts
  • ffmpeg -sample_fmts: show available audio sample formats
Read Also  A Brief Overview of Computer File Systems

Some Examples

Converting an existing video file from avi to mp4 format:

$ ffmpeg -i infile.avi outfile.mp4

Creating a video from many images:

ffmpeg -f image2 -framerate 12 -i foo-%03d.jpeg -s WxH foo.avi

Extracting images from a video:

$ ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg

Grab video from specified device and input:

$ ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg

For an extensive and in-depth guide on how to use FFmpeg on Ubuntu and other systems, you can check out the official documentation.