What is FFmpeg?
FFmpeg is an open source software (also a command line tool) used for transcoding multimedia files. FFmpeg consists of shared libraries like libswresample, libavcodec, libavformat, libavutil & programs for handling video, audio & other multimedia files & streams. It provides you the facility of converting various video & audio formats. With FFmpeg you can also capture & encode in real-time from hardware such as TV capture card. Just follow the guide to easily Install FFmpeg on your Ubuntu 18.04.
Step 1: Add ppa:jonathonf/ffmpeg-4.2
Add jonathonf repo & press Enter when prompt to continue
sabi@sabi:~$ sudo add-apt-repository ppa:jonathonf/ffmpeg-4
Backport of FFmpeg 4 and associated libraries. Now includes AOM/AV1 support!
FDK AAC is not compatible with GPL and FFmpeg can't be redistributed with it included. Please don't ask for it to be added to this public PPA.
PPA supporters:
BigBlueButton (https://bigbluebutton.org)
Donate to FFMPEG: https://ffmpeg.org/donations.html
Donate to Debian: https://www.debian.org/donations
Donate to this PPA: https://ko-fi.com/jonathonf
More info: https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-4
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Step 2: Update the Repository index
sudo apt-get udpate
After adding PPA , Install the FFmpeg package by running
sudo apt -y install ffmpeg
Step 3: Verifying FFmpeg Installation
Confirm the installation by verifying version of FFmpeg
sabi@sabi:~$ ffmpeg -version
ffmpeg version 4.2.1-2~18.04.york2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='2~18.04.york2' --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --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
Install Additional packages by typing
ffmpeg -encoders
ffmpeg -decoders
You have successfully installed FFmpeg on your system. It’s time to test and run the FFmpeg on your Ubuntu 18.04
Step 4: How To Use FFmpeg
Let’s take some examples to cover basic things to use FFmpeg on Ubuntu 18.04
Basic Conversion
In basic conversion you don’t have to specify the conversion formats. FFmpeg automatically detects the formats and covert them based on the file extension of an output file.
Covert a video from mp4 to WebM
ffmpeg -i video.mp4 video.webm
Advanced Conversion
In advance conversion, you can specify the codecs using -c option. Specify the name of any encoder/decoder which is supported by ffmpeg for copying the input stream along with -c.
For example, here we will covert the audio (-c:a copy) from input.webm & convert the video to a VP9 codec (-c:v vp9) with a bit rate of 1M/s (-b:v), all bundled up in a Matroska container (output.mkv)
ffmpeg -i input.webm -c:a copy -c:v vp9 -b:v 1M output.mkv