FFmpeg is an all-in-one multimedia codex that can convert audio and video to different formats and is available as a command line tool. FFmpeg can convert most audio and video formats, it can also edit and stream media files. Here we will show you how to install it on your Linux VPS server .
Here are some of the features of FFmpeg:
- Extract audio from a series of video files
- Extract only video without audio
- Resize video files
- Cut existing video into a smaller clip
- Merge videos
- Convert audio and video
If you want to install FFmpeg on your Linux VPS, connect to your machine via ssh before continuing.
Remember that whatever version of Linux you are using, you can check if FFmpeg is installed or what version you are running with the following command:
ffmpeg -version
A typical output from this command would look like this:
Install FFmpeg on Ubuntu
Installing FFmpeg 4, the latest version, on Ubuntu 14.x and above is easy.
We will install FFmpeg from the mc3man ppa. PPA stands for Personal Package Archives which are supported by the Ubuntu community.
To add this PPA we need to run:
sudo apt-get install -y software-properties-common
add apt-repository ppa:mc3man/trusty-media
After installing the PPA, continue updating the repository by executing:
apt-get update
apt-get dist-upgrade
Finally, to install ffmpeg we have to run:
apt-get install ffmpeg
This finishes the ffmpeg installation. To check the version use the following command:
ffmpeg -version
Install FFmpeg on Debian
To install FFmpeg on Debian 9 – Stretch, you must log in as root. The FFmpeg package uses the apt package manager for installation, which is available in the official Debian repository.
First update the package list using:
apt update
After this we can run the following command to install FFmpeg:
apt install ffmpeg
If you are using Debian 8 – Jessie, FFmpeg will not be available in the official repository; however, the Debian media repository can be used to install the codex.
We will have to add the Debian media repository. To achieve this, we need to edit the /etc/apt/sources.list file . This file contains the list of repositories used by APT. To edit this file, you can use a terminal editor like nano or vi .
Open the file with the following command and press I (Insert) to begin editing:
vi /etc/apt/sources.list
Add the following lines to the file:
deb http://www.deb-multimedia.org jessie main non-free
deb-src http://www.deb-multimedia.org jessie main non-free
# jessie-backports
deb http://ftp.debian.org /debian/ jessie-backports main
To save what you edited in the vi editor press Esc . To exit the editor press : and execute q !
Now we will have to install the deb-multimedia-keyring package . First, we will update, then install and update once again. This ensures that all changes are updated and noted correctly.
apt update
apt install deb-multimedia-keyring
apt update
When you're done, install the FFmpeg package using:
apt install ffmpeg
To validate the installation on Debian use the following command:
ffmpeg -version
Install FFmpeg on CentOS, Fedora and RHEL
CentOS does not have an official repository for FFmpeg installation, but it can be installed using a third-party nux dextop yum repository.
To install using CentOS 7 or 6 , update the system using:
yum install epel-release -y
yum update -y
On CentOS 7 and RHEL 7 use the following command:
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
On CentOS/RHEL 6/5 , the command is slightly different and refers to a different repository.
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
Next, we can install FFmpeg and its development packages using:
yum install ffmpeg ffmpeg-devel -y
This completes the installation.
To install FFmpeg on Fedora , use the RPMfusion repository. If you don't have it installed, use this command:
dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
Next, we can install FFmpeg and its development package using a DNF package manager.
dnf install ffmpeg ffmpeg-devel
That's it, you have successfully added FFmpeg to your Fedora virtual machine .
Install FFmpeg on Arch Linux
For Arch Linux, we have to use the Pacman package manager. This is an Arch Linux repository. The official repository will give details of which version is available.
To update we can use the following command:
pacman -Sy vlc
Next, we can install ffmpeg using:
pacman -R ffmpeg4.0
To reflect these changes, update the system using:
pacman -His
You've made it! Now FFmpeg should be successfully added to your Arch Linux machine. To verify the installation, run:
ffmpeg -version
Conclusion
Setting up a Linux based VPS server and installing FFmpeg is easy and only takes a few minutes. Simply log in as root and follow the guidelines for your operating system. Each version of Linux (Ubuntu, Arch Linux, Debian, CentOS/RHEL, Fedora) has small differences for installing FFmpeg. Start using this powerful codex!