Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install FFmpeg on Ubuntu 22.04

Install FFmpeg with apt in one command, or compile the newest version from source.

VPS and Cloud Servers1 min read11 screenshots

Method 1: Install with APT

Step 1: Update the package list

sudo apt update
Updating the package list

Step 2: Install FFmpeg

sudo apt install ffmpeg
Installing FFmpeg

Step 3: Check the install

ffmpeg -version
The FFmpeg version

Method 2: Install from source

Use this if you need a newer version than the one in Ubuntu, or special build options.

Step 1: Install the build tools and libraries

sudo apt install build-essential libtool autoconf automake pkg-config yasm nasm libx264-dev libx265-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev libass-dev zlib1g-dev
Installing the dependencies

Step 2: Download the source code

Get the current version number from the FFmpeg website:

wget https://ffmpeg.org/releases/ffmpeg-7.0.1.tar.xz
Downloading FFmpeg

Step 3: Extract it

tar -xvf ffmpeg-7.0.1.tar.xz
Extracting the archive

Step 4: Configure the build

cd ffmpeg-7.0.1
Opening the FFmpeg folder
./configure --enable-gpl --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus
Configuring FFmpeg

Step 5: Compile

make -j$(nproc)
Compiling FFmpeg

This can take a while.

Step 6: Install

sudo make install
Installing FFmpeg

Step 7: Check the install

ffmpeg -version
The FFmpeg version after the build

First commands

Convert a video to MP4:

ffmpeg -i input.avi output.mp4

Extract the audio:

ffmpeg -i video.mp4 -vn -acodec copy audio.aac

Change the size:

ffmpeg -i input.mp4 -vf scale=1280:720 output.mp4

Quick recap

  • sudo apt install ffmpeg is the easy way.
  • Compile from source only if you need a newer version.
  • Check with ffmpeg -version.