Cheap VPS host selection
Provide server host evaluation information

Ubuntu 20.04 Detailed Tutorial of Installing ffmpeg

root@ubuntu-s-1vcpu-1gb-lon1-01 :~# do-release-upgrade
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading.
root@ubuntu-s-1vcpu-1gb-lon1-01 :~#

FFmpeg is a free and open source command line tool for format conversion of multimedia files. It contains a set of shared audio and video libraries, such as libavcodec, libavformat, and libavutil.

With FFmpeg, you can convert between various video and audio formats, set the sampling rate, and adjust the video size.

In order to add a new repository and install software on the Ubuntu system, you must log in as a user with sudo privileges.

The official Ubuntu repository contains the FFmpeg package, which can be installed using the apt package manager. This is the easiest way to install FFmpeg in Ubuntu, but the version contained in the repository may be behind the latest version of FFmpeg.

At the time of writing, the current version of FFmpeg available in the Ubuntu 18.04 repository is 3.3.3. If you need to install FFmpeg 3. x. You can run the following commands.

First update the software package list and run the command sudo apt update. Next, run the command sudo apt install ffmpeg to install FFmpeg.

After the installation is completed, run the ffmpeg - version command to verify whether the software package has been correctly installed. This command will print the FFmpeg version.

You can also run the ffmpeg - encoders command to print all available FFmpeg encoders and decoders for verification. FFmpeg 3. x is now installed on your system.

sudo apt update
sudo apt install ffmpeg
ffmpeg -decoders
ffmpeg -version

Installing FFmpeg 4. x

The default version of the Ubuntu 20.04 repository is 4. x. If your Ubuntu version is 20.04, please skip this step. In this section, we will show step-by-step instructions on how to install FFmpeg version 4. x in Ubuntu 18.04.

FFmpeg version 4.0 has added many new filters, encoders and decoders. This version is available from Jonathan F's PPA. The following steps describe how to install FFmpeg 4. x on Ubuntu 18.04.

First, add jonathonf/ffmpeg-4PPA. Run the command sudo add opt repository ppa: jonathonf/ffmpeg-4.

If you receive an error message that prompts add opt repository command not found, please install software properties common software.

After adding jonathonf/ffmpeg-4PPA, you can run the command sudo apt install ffmpeg to install the version of FFmpeg 4. x.

sudo apt install software-properties-common
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt install ffmpeg

After the installation is completed, run the ffmpeg - version command to verify whether the software package has been correctly installed. This command will print the FFmpeg version.

You can also run the ffmpeg - encoders command to print all available FFmpeg encoders and decoders for verification. FFmpeg 3. x is now installed on your system.

Convert mp4 webm

When using ffmpeg to convert audio and video files, it is not necessary to specify input and output formats. FFmpeg automatically detects the format of the input file and guesses the output format from the file extension.

Here are two simple examples of converting video files from mp4 to webm. Convert audio files from mp3 to ogg.

ffmpeg -i input.mp4 output.webm
ffmpeg -i input.mp3 output.ogg

Specify codec

When converting files, use the - c option to specify the codec. It can be the name of any supported decoder/encoder, or it can be a special value copy that copies only the input stream.

The following example uses the libvpx video codec and the libvorbis audio codec to convert video files from mp4 to webm. Use libopus codec to convert audio files from mp3 to ogg.

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

Do not reprint without permission: Cheap VPS evaluation » Ubuntu 20.04 Detailed Tutorial of Installing ffmpeg