How to Install FFmpeg on Linux

How to Install FFmpeg on Linux

FFmpeg is an all in one multimedia codex which can convert audio and video into different formats. It is available as a command line tool. FFmpeg supports most audio and video formats. It can also edit and stream multimedia files. Here’s how you can install it onto your Linux based machine or VPS.

Here are some other FFmpeg features you can look forward to:

  • Extract audio from a series of video files
  • Extract only video with no audio
  • Resize video files
  • Cut existing video into a smaller clip
  • Merge videos
  • Convert audio and video

Protip: If you want to install FFmpeg on your Linux VPS, connect to your machine via ssh before proceeding further.

Remember, whatever version of Linux you use, you can check if FFmpeg is installed, or what version it’s running with the following command:

ffmpeg -version

A typical output of this command would look as shown below:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OV33RjqT-1599462889378)(https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2019/02/checking-ffmpeg-version.png)]

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 execute:

sudo apt-get install -y software-properties-common
add apt-repository ppa:mc3man/trusty-media

Once the PPA is installed, move on to updating the repository by executing:

apt-get update
apt-get dist-upgrade

Lastly, to install ffmpeg we need to execute:

apt-get install ffmpeg

This completes the ffmpeg installation. To verify the version check using the following command:

ffmpeg -version

Install FFmpeg on Debian

To install FFmpeg on Debian 9 – Stretch, you need to be logged in as a root user. The FFmpeg package uses the apt package manager for installation. It’s available in the official Debian repository.

First, update the package list using:

apt update

After this we can execute the following command to install FFmpeg:

apt install ffmpeg

If you’re using Debian 8 – Jessie, FFmpeg won’t be available in the official repository. However, the Debian multimedia repository can be used to install the codex.

We will have to add the Debian multimedia repository. To add this, we need to edit the file /etc/apt/sources.list. This file contains the list of repositories APT uses. To edit this file, you can use a terminal editor such as nano or vi.

Open the file using the following command and press I (Insert) to start editing:

vi /etc/apt/sources.list

Add the lines listed below 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 your edit on the vi editor press Esc. To exit the editor press : and execute q!

Next we will have to install the deb-multimedia-keyring package. First, we will update, then install, and update one more time. This makes sure that all the changes are correctly updated and noted.

apt update
apt install deb-multimedia-keyring
apt update

Once 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 provide an official repository for FFmpeg installation. This can be installed using third party nux dextop yum repo.

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 successfully added FFmpeg to your Fedora virtual machine.

Install FFmpeg on Arch Linux

For Arch Linux, we need 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 the DB, 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 -Su

And you’re done! FFmpeg should be successfully added to your Arch Linux machine. To verify the installation, execute:

ffmpeg -version

Conclusion

Installing FFmpeg on a Linux machine is easy, and takes only a few minutes. Just log in as a root user and follow the guidelines for your OS. Each flavor of Linux – Ubuntu, Arch Linux, Debian, CentOS/RHEL, Fedora – have slight differences when installing FFmpeg. Start using this powerful codex!

你可能感兴趣的:(vps)