Linux

How to Install FFmpeg on Ubuntu 22.04

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

How to Install FFmpeg on Ubuntu 22.04. FFmpeg is an open-source collection of great tools for audio and video processing to record, convert and stream.

This tutorial covers the steps required to install FFmpeg on Ubuntu 22.04. You will also learn how to use the ffmpeg command line tool to convert audio, add text to video and many more.

This tutorial is tested on Google Cloud for automatic image and video processing.

Prerequisites

A Ubuntu system with sudo privileges.

Step 1: Update Packages

Update your server packages to the latest version available.

sudo apt update
sudo apt upgrade

Step 2: Install FFmpeg on Ubuntu

FFmpeg 4 is available by default in the Ubuntu Jammy Jellyfish repositories. So you can install it directly using the apt install command

sudo apt install ffmpeg

Verify FFmpeg installation using the below command.

ffmpeg -version

The output will be something similar to this.

Output
ffmpeg version 4.4.1-3ubuntu5 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-18ubuntu1)
configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100

Now, FFmpeg is installed successfully and ready to be used.

Step 3: FFmpeg Examples

In this part, we will look at some basic examples to use the ffmpeg utility.

Basic conversion

While converting the audio and the video files with ffmpeg you don’t need to specify the input and output formats. The input file format is detected automatically and the output format is selected from the file extension.

Convert a video file from webm to mp4

ffmpeg -i input.webm output.mp4

Convert an audio file from ogg to mp3

ffmpeg input.ogg output.mp3

Specifying codecs

You can specify the codecs you want to use with the -c flag option. The codec can be the name of any supported decoder/encoder or a special value copy which simply copies the input stream.

Convert a video file from webm to mp4 using the libvpx video codec and libvorbis audio codec

ffmpeg -i input.webm -c:v libvpx -c:a libvorbis output.mp4

Convert an audio file from ogg to mp3 encoded with the libopus codec.

ffmpeg -i input.ogg -c:a libopus output.mp3

Conclusion

Now you have learned how to install FFmpeg on Ubuntu 22.04 and also use some basic examples for converting files.

Thanks for your time. If you face any problem or any feedback, just leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.