Learn How to Install and Use FFmpeg on Ubuntu 20.04

how to install and use ffmpeg on ubuntu 20.04

FFmpeg is an open source and free platform contains larger set of library and program for administrating multimedia files like video files, audio files, streams etc. FFmpeg is mostly used for transcoding, post-production, video editing like trimming, scaling etc. FFmpeg has libavcodec, libavfilter, libauformat, libabresample, libaupostproc, libavutil, libswscale.

In this tutorial we will show you how to install and use FFmpeg on ubuntu 20.04.

Install from Ubuntu Repository:

Ubuntu repository having FFmpeg packages we can install FFmpeg with apt package tool. This is the simplest method to install FFmpeg on ubuntu 20.04. Let’s start the FFmpeg installation.

Before installing the FFmpeg on Ubuntu 20.04, update the Ubuntu packages and install FFmpeg. To update the packages and install FFmpeg on Ubuntu 20.04 run the commands below.

sudo apt update
sudo apt install ffmpeg

After successfully installation now verify the installation.

ffmpeg -version

That’s all we have successfully installed FFmpeg on Ubuntu 20.04 from Ubuntu repository.

Check available Encoders and Decoders:

To check the available encoders and decoders run the commands below.

ffmpeg -encoders
ffmpeg -decoders

Install FFmpeg from Source:

To install the FFmpeg latest version on ubuntu 20.04 then install it from official source. Installing FFmpeg from official sources enables more features. Let start the FFmpeg installation.

Before installing FFmpeg from source we need to install some packages on Ubuntu 20.04.

sudo apt update
sudo apt install libvpx-dev libx264-dev yasm libass-dev libtheora-dev mercurial cmake build-essential libopus-dev libmp3lame-dev libfdk-aac-dev libvorbis-dev libx265-dev

Now download the FFmpeg latest source file. To download the FFmpeg latest version source file from official source run the commands below.

mkdir ~/ffmpegdemo
cd ~/ffmpegdemo
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2

After the successful download extract the file and navigate to the FFmpeg folder.

tar -xvf ffmpeg-snapshot.tar.bz2
cd ~/ffmpegdemo

After extract the FFmpeg source file now complete the installation on Ubuntu 20.04. To complete the FFmpeg installation on Ubuntu 20.04 run the below command and click enter this will install the FFmpeg latest version on Ubuntu 20.04 from official source.

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" \
   ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --extra-libs="-lpthread -lm" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree && \
PATH="$HOME/bin:$PATH" sudo make && sudo make install

Now verify the FFmpeg installation by running the command below.

ffmpeg -version

Now we have installed the latest version of ffmpeg from source.

Use FFmpeg on Ubuntu 20.04:

Convert a video file from WebM to mp4. To convert run the command below.

ffmpeg -i demo.mp4 demo.webm

Convert an audio file from mp3 to ogg format. To convert run the command below.

ffmpeg -i demo.mp3 demo.ogg


Successfully we have installed FFmpeg on Ubuntu 20.04. In this tutorial we have learned how to install and use FFmpeg on Ubuntu 20.04. Hope this helps.

Next Article: How to Install OpenCV on Ubuntu 20.04

Leave a Reply

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

You May Also Like
how to install php on ubuntu 20.04
Read More

How to Install PHP on Ubuntu 20.04 Machine

Table of Contents Hide Add PPA:Install PHP on ubuntu:To install PHP 7.0To install PHP 7.1To install PHP 7.2To install PHP 7.3To install PHP 7.4Conclusion: PHP is a common purpose scripting language…