How to Install and Use FFmpeg on Ubuntu 18.04. FFmpeg is
This tutorial covers the steps required to install FFmpeg on Ubuntu 18.04. We will use ffmpeg
Not using Ubuntu 18.04? Choose a different OS:
This setup instructions works on Ubuntu 16.04 and any Ubuntu based distribution, including Linux Mint and Elementary OS. This tutorial is tested on Google Cloud for automatic image and video processing.
Prerequisites
A Ubuntu system with sudo
privileges.
If you are using Google Cloud you need to have some additional requirements fulfilled.
- A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04.
- Initial Ubuntu Server Set up.
Install FFmpeg 4.x on Ubuntu
FFmpeg 4 is available from the Jonathon F’s PPA.
01. Start by adding the jonathonf/ffmpeg-4
PPA
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
02. Now you can install FFmpeg with the following command.
sudo apt install ffmpeg
03. Verify the installation.
ffmpeg -version
The output will be something similar to this.
Output
ffmpeg version 4.1-1~16.04.york1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
Now, FFmpeg is installed successfully and ready to be used.
FFmpeg Examples
In this part, we will look at some basic examples to use the ffmpeg
utility.
Basic conversion
While converting the audio and the video files ffmpeg
Convert a video file from webm
to mp4
ffmpeg -i input.webm output.mp4
Convert an audio file from ogg
to mp3
ffmpeg input.ogg output.mp3
Specifying codecs
You can specify the codecs you want to use with -c
Convert a video file from webm
to mp4
using the libvpx
video codec and libvorbis
audio codec
ffmpeg -i input.webm -c:v libvpx -c:a libvorbis output.mp4
Convert an audio file from ogg
to mp3
encoded with the libopus
codec.
ffmpeg -i input.ogg -c:a libopus output.mp3
Conclusion
Now you have learned how to install FFmpeg on your Ubuntu system.
Thanks for your time. If you face any problem or any feedback, just leave a comment below.
Thanks!
You missed an important step, whereby whenever you add a ppa repo you have to run `sudo apt update` so that the references in the operating system (as far as I know at the very least) get updated. The reason for that is, I tried doing everything I could to upgrade ffmpeg from v2 to v4, it never worked until I ran `update` after installing the new repo
I have a server on compute engine. I installed ffmpeg successfully on it. i can run ffmpeg commands in the terminal successfully. But when i try to execute using the php exec function on my live website it throws an error
ffmpeg: symbol lookup error: /lib/x86_64-linux-gnu/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates