FFmpeg is a collection of libraries and tools for handling videos, audio, subtitles, and other multimedia files. It is a cross-platform, free, and open-source multimedia framework that allows you to decode, encode, transcode, filter, stream, and play multimedia files and their metadata. The FFmpeg project consists of the following main tools;
- ffmpeg which is the command-line tool that can manipulate multimedia files. It is a very fast video and audio converter and can also record live video and audio sources.
- ffplay which is the multimedia player. It uses the FFmpeg libraries and the SDL library and is also used as a testbed for FFmpeg APIs.
- ffprobe which is the tool used to analyze multimedia content. It gathers information from multimedia streams and prints it in human and machine-readable forms. Meaning it picks the format of a container with the multimedia stream and also checks the format of the multimedia stream in the container.
FFmpeg libraries include;
- libavutil which contains functions for implying programming.
- libavcodec that contains recorders and encoders for audio/video codecs.
- libavformat that implements streaming controls.
- libavdevice that contains input and output devices.
- libavfilter that contains media filters.
- libswscale that performs image scaling.
- libswresample that performs audio resampling.
There are two options for installing FFmpeg;
- Install from the APT package repository.
- Install from the source.
- Install FFmpeg from the mc3man PPA.
In this guide, I will show you how to install FFmpeg on KDE Neon|Kubuntu system from the APT package repository.
Installation of FFmpeg on KDE Neon / Kubuntu
Update your system packages
### KDE Neon ###
sudo apt update && sudo pkcon update -y
### Kubuntu ###
sudo apt update && sudo apt upgrade -y
Then install the latest FFmpeg version using the following command.
$ sudo apt install ffmpeg
#Output
The following additional packages will be installed:
libavdevice58 libavresample4 libcdio-cdda2 libcdio-paranoia2 libcdio18 libsdl2-2.0-0
Suggested packages:
ffmpeg-doc
The following NEW packages will be installed:
ffmpeg libavdevice58 libavresample4 libcdio-cdda2 libcdio-paranoia2 libcdio18 libsdl2-2.0-0
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,080 kB of archives.
After this operation, 4,409 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ke.archive.ubuntu.com/ubuntu focal/main amd64 libcdio18 amd64 2.0.0-2 [58.6 kB]
Get:2 http://ke.archive.ubuntu.com/ubuntu focal/main amd64 libcdio-cdda2 amd64 10.2+2.0.0-1 [17.6 kB]
Get:3 http://ke.archive.ubuntu.com/ubuntu focal/main amd64 libcdio-paranoia2 amd64 10.2+2.0.0-1 [16.2 kB]
Get:4 http://ke.archive.ubuntu.com/ubuntu focal/universe amd64 libsdl2-2.0-0 amd64 2.0.10+dfsg1-3 [407 kB]
Get:5 http://ke.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libavdevice58 amd64 7:4.2.4-1ubuntu0.1 [74.3 kB]
Get:6 http://ke.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libavresample4 amd64 7:4.2.4-1ubuntu0.1 [54.2 kB]
Get:7 http://ke.archive.ubuntu.com/ubuntu focal-updates/universe amd64 ffmpeg amd64 7:4.2.4-1ubuntu0.1 [1,453 kB]
Fetched 2,080 kB in 2s (1,161 kB/s)
Selecting previously unselected package libcdio18:amd64.
Then check for the version using the following command
$ ffmpeg -version
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
You can use the following command to view the available outputs of ffmpeg encoders and decoders
ffmpeg -encoders
ffmpeg -decoders
Useful FFmpeg Commands
Getting File information
To get information for an audio or video file using the following command. Let’s say I have a video file named video in mp4 format.
$ ffmpeg -i video.mp4 -hide_banner
The -hide_banner
is used to hide the FFmpeg copyright information that shows up like build options and library versions.
Ensure you are in the directory where the file is located and if it is a different directory from home, you will have to change the directory of the file or move the file to the home directory.
Sample Output
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2022-04-03T05:47:25.000000Z
Duration: 00:09:01.47, start: 0.000000, bitrate: 1190 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1058 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022
Extract an audio file from a video file.
To extract an audio file, use the following command. The -vn option is used to disable video recording during conversion.
$ ffmpeg -i video.mp4 -vn audio.mp3
Sample Output
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2022-04-03T05:47:25.000000Z
Duration: 00:09:01.47, start: 0.000000, bitrate: 1190 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1058 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'audio.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
TSSE : Lavf58.29.100
Stream #0:0(und): Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
encoder : Lavc58.54.100 libmp3lame
size= 8461kB time=00:09:01.46 bitrate= 128.0kbits/s speed= 51x
video:0kB audio:8461kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003994%
Convert a Media file to another File Format
Let’s covert our video file from .mp4
to .webm
file format. We will use the following command. You will provide the output file with a different name.
ffmpeg -i video.mp4 new_video.webm
Sample output
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2022-04-03T05:47:25.000000Z
Duration: 00:09:01.47, start: 0.000000, bitrate: 1190 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1058 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2022-04-03T05:47:25.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 04/02/2022.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9))
Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55a76e3e52c0] v1.8.2
[libopus @ 0x55a76e3ab600] No bit rate set. Defaulting to 96000 bps.
Output #0, webm, to 'new_video.webm':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.29.100
Stream #0:0(und): Video: vp9 (libvpx-vp9), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 30 fps, 1k tbn, 30 tbc (default)
The conversion speed will depend on the size of the file
As you can see from my folder I now have the audio and the newly converted video.

Other ffmpeg commands
There are other commands that can be run with FFmpeg to manipulate videos further.
Convert a video to an animated GIF.
You can convert a video to an animated GIF by indicating the .gif file format as shown below.
ffmpeg -i video.mp4 animated.gif.mp4
Covert a video to a CD or VCD
You can do this by adding the -target type option on the command line. The options vary from vcd, svcd, dvd, or dv.
$ ffmpeg -i video.mpg -target vcd vcd_video.mpg
Increase/Reduce Video Playback Speed
To manipulate the speed of the video, we use the -vf option for video filters to adjust the speed.
ffmpeg -i video.mpg -vf "setpts=0.5*PTS" highspeed.mpg
Conclusion
In this guide, I have shown you how to install FFmpeg on the Kubuntu / KDE Neon system. We have also gone through some of the commands used to manipulate video files and convert them to different formats.
More guides:
- Install MATE Desktop Environment on Solus
- Configure vsftpd FTP Server on KDE Neon / Kubuntu
- Install and Use eDEX-UI Terminal Emulator on Windows
- Running Linux GUI applications on Windows Subsystem for Linux (WSL)