FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
Ubuntu’s official repositories contain the FFmpeg package that is used here for installation. The apt package manager is the easiest way to install FFmpeg on Ubuntu. A new major version is released every six months, and the version included in Ubuntu’s repositories usually lags behind the latest version of FFmpeg.
Operating System: Ubuntu 20.04
To install FFmpeg, enter the following command as root or user with sudo privileges:
sudo apt update sudo apt install ffmpeg
To verify the installation, use the ffmpeg -version command, which prints the FFmpeg version along with its configuration.
ffmpeg -version
The output should look similar to following result:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100
To print all available FFmpeg’s encoders and decoders type:
ffmpeg -encoders ffmpeg -decoders
Now FFmpeg is installed on your system, and you can start using it. When a new version is released, you can update the FFmpeg package through the command-line or desktop Software Update tool.
Let’s try some basic examples to know how to use the FFmpeg utility.
Basic conversion
When converting audio and video files with FFmpeg, you do not need to specify the input and output formats. The input file format is auto-detected, and the output format is auto-guessed from the file extension.
Convert a video file from webm to mp4:
ffmpeg -i input.webm output.mp4
Convert an audio file from wav to mp3:
ffmpeg -i input.wav output.mp3
Conversion by specifying codecs
For specifying codecs, use the -c option along with the name of any supported decoder/encoder or some specific value copy that simply copies the input stream.
Convert a video file from mp4 to webm using the libvpx video codec and libvorbis audio codec:
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
Convert an audio file from mp3 to ogg encoded with the libopus codec.
ffmpeg -i input.mp3 -c:a libopus output.ogg
FFmpeg is now installed on Ubuntu 20.04 system. Visit the official FFmpeg Documentation page to learn more about converting video and audio files.