
Table of Contents
Install FFmpeg on Ubuntu 18.04
FFmpeg is one the free and open source cross-platform solution for converting, recording and streaming media. FFmpeg is also used for converting media files to different formats, resize video, change sample rates for video and audio files. In this tutorial, you are going to learn how to install FFmpeg on Ubuntu 18.04.
In this tutorial we will install FFmpeg in the following two ways:
- Install FFmpeg 4 using External Repository. (recommended)
- Install FFmpeg 3 using Ubuntu Repository.
Prerequisites
Before you start to install FFmpeg on Ubuntu 18.04. You must have a non-root user account on your server with sudo privileges.
Here we are going to use add-apt-repository
command so to install this command type:
sudo apt install software-properties-common
Method 1: Install FFmpeg 4 using External Repository
After every three months, a new version of FFmpeg comes with new features and bug fixes. Here in this method, we are going to install the current latest version (at the time of writing this article) FFmpeg 4.x version on Ubuntu 18.04. Follow below instructions to install FFmpeg.
Update the apt package manager using the following command:
sudo apt update
Now add JonathanF’s ffmpeg-4
repository to your Ubuntu system by using below command:
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
Now you are ready to install FFmpeg-4 on Ubuntu, Type following command to install FFmpeg:
sudo apt install ffmpeg
Confirm the installation and check FFmpeg version typing below command:
ffmpeg -version
The output should be:
Method 2: Install FFmpeg 3 using Ubuntu Repository
Use the following instructions to install FFmpeg using Ubuntu Repository.
First, Update the apt
package manager index typing following command:
sudo apt update
To install FFmpeg type following command in the terminal:
sudo apt install ffmpeg
Confirm the installation and check FFmpeg version typing below command:
ffmpeg -version
The output should be:
ffmpeg version 3.4.4-0york1~18.04 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
Basic FFmpeg Examples
Below are some basic examples to use FFmpeg:
To check the media file information run following command:
ffmpeg -i filename.mp3
To convert an audio .amr
file to .mp3
run the following command:
ffmpeg -i filename1.amr filename2.mp3
Similarly, you can convert video file like to convert .mp4
file to avi
run below command:
ffmpeg -i inputvideo.mp4 outputvideo.mkv
You can also remove the audio stream from the video file using below command:
ffmpeg -i inputvideo.mp4 -vn outputaudio.mp3
Conclusion
You have successfully learned how to install FFmpeg on Ubuntu 18.04. If you have any queries please don’t forget to comment out.