How to Install FFmpeg on Ubuntu 18.04 & 16.04

FFmpeg is a cross-platform solution for streaming audio and video as well as recording and conversion. It’s also useful to convert multimedia files between various formats. FFmpeg includes libavcodec audio/video codec library in it.

This tutorial will help you to install FFmpeg on Ubuntu Ubuntu 18.04 & 16.04 LTS systems with easy steps.

Step 1 – Setup FFmpeg PPA

FFmpeg 4 is the latest available version for installation on Ubuntu. To install the latest version, you need to configure PPA on your system. Execute below command to add FFmpeg PPA on Ubuntu system.

sudo add-apt-repository ppa:jonathonf/ffmpeg-4

Step 2 – Install FFmpeg on Ubuntu

After enabling the PPA, Lets exec below commands to install ffmpeg on Ubuntu system. This will also install many packages for the dependencies.

sudo apt-get update
sudo apt-get install ffmpeg

Step 3 – Check FFmpeg Version

After successfully install FFmpeg, let’s check the version installed on the system.

ffmpeg -version

ffmpeg version 4.0.3-1~18.04.york0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
...

Step 4 – FFmpeg Basic Commands

Here is the list of the ffmepg basic command options used with ffmpeg command line tool.

FFmpeg command examples
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 bit stream 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

Click here to read more about ffmpeg on its official site.

Step 5 – Basic Examples

Below are some examples of uses of ffmpeg command line.

Reduce .mov File Size:

ffmpeg -i in.mov -c:v libx264 -c:a copy -crf 20 out.mov

Convert .move To .mp4

ffmpeg -i in.mov -vcodec copy -acodec aac -strict experimental -ab 128k out.mp4