How to Install FFmpeg on Linux, macOS, and Windows (original) (raw)
Nov 09, 2024
Edward S. & Noviantika G.
5min Read
FFmpeg is a cross-platform application that manages various types of multimedia files. The tool contains a set of shared audio and video libraries such as libavformat, libavutil, and libavcodec.
Furthermore, it decodes, encodes, mux, demux, streams, filters, plays, and transcodes media files. When converting video and audio files using FFmpeg, the tool will auto-detect the input and output formats.
FFmpeg is available as a command-line tool and supports different operating systems. In this article, we will explain how to install FFmpeg on Linux, macOS, and Windows.
Warning! If you want to install FFmpeg on your Linux VPS, connect to your machine via SSH before proceeding further.
How to Install FFmpeg on Linux
In this section, we will explain how to set up FFmpeg on popular Linux distributions like Ubuntu, Debian, CentOS, Fedora, and RHEL.
Installing FFmpeg on Ubuntu
The installation of FFmpeg must be done via the default repository if your machine runs on Ubuntu 22.04 or later.
Follow these steps:
- Open the Terminal and access it via a root user.
- Update the system and packages installed by running both commands consecutively:
sudo apt update
sudo apt upgrade
- Insert the command below to install the FFmpeg application:
sudo apt install ffmpeg
Installing FFmpeg on Debian
There are two ways to install FFmpeg on Debian – via the default and multimedia repositories.
The former method serves Debian 9 and newer versions, while the latter applies to Debian 8 and older versions.
Debian 9
Here’s how to install FFmpeg using the default repository:
- Open the Terminal and log in via a root user.
- Update the package list and system by running both commands consecutively:
sudo apt update
sudo apt upgrade
- Next, install FFmpeg by adding the command below:
sudo apt install ffmpeg
Debian 8
FFmpeg is unavailable in the official Debian 8 or older repository. Therefore, users must add the Debian multimedia repository to install the codex by editing the sources.list file that contains the list of repositories the APT uses.
Follow these steps to install FFmpeg using the multimedia repository:
- Launch the Terminal and log in as a root user.
- Next, open the sources.list file by typing in the following command. Use an editor such as nano or vi:
sudo vi /etc/apt/sources.list
- Press I to enter Insert mode and start editing.
- Add the following lines at the end of the file:
deb-multimedia
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://httpredir.debian.org/debian/ jessie-backports main
- Save the file by pressing ESC and close the file by pressing : (colon) and q!
- Finally, update the system by typing in the command below:
sudo apt update
- Insert this command to install the deb-multimedia-keyring package:
sudo apt install deb-multimedia-keyring
- Update the system once again to ensure the changes were saved by running the command below:
sudo apt update
- Once finished, install the FFmpeg package by typing in the command below:
sudo apt install ffmpeg
Installing FFmpeg on CentOS, Fedora, and RHEL
FFmpeg package is not available in the official repository of CentOS, Fedora, and RHEL. Therefore, users need to install it using an additional repository.
CentOS 7
Here’s how to install FFmpeg on CentOS 7 using the Nux Dextop repository:
- Open the Terminal and log in as a root user.
- Install the EPEL repository by typing in this command:
sudo yum install epel-release
- Update the system and packages by running the following command:
sudo yum update
- Use these commands to install the Nux Dextop repository:
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
- Finally, type in this command to install the FFmpeg and its development package:
sudo yum install ffmpeg ffmpeg-devel -y
RHEL 7/8
Follow these steps to install FFmpeg on RHEL 7/8 via the RPM Fusion repository:
- Open the Terminal and access via a root user.
- Type in the command below and press Enter to update the system:
sudo yum update
- Install the EPEL repository by inserting this command and hitting Enter:
sudo yum install epel-release
- Next, run either of these commands to install RPM fusion:
RHEL 7
yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
RHEL 8
yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
- Install FFmpeg and its development packages by typing in the following command:
sudo yum install ffmpeg ffmpeg-devel -y
Fedora
Here’s how to install FFmpeg on Fedora using the RPM Fusion repository:
- Open the Terminal and log in as a root user.
- Update the system by inserting the following command:
sudo dnf update
- Add the RPM Fusion repository to install FFmpeg by running the command below:
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
- Update the system once again to make sure the changes were saved by running the following command:
sudo dnf update
- Next, install FFmpeg and its development package by inserting this:
sudo dnf install ffmpeg ffmpeg-devel
Installing FFmpeg on Arch Linux
The official Arch Linux repository, the Packman package manager, provides the FFmpeg codex on their system. Here’s how to install it:
- Open the Terminal and log in to a user account with sudo privileges.
- Update the system packages by running the following command:
pacman -Syu
- Type in the command belowto install FFmpeg:
sudo pacman -S ffmpeg
- Next, install the development package by inserting the following commands consecutively:
yay -S ffmpeg-git yay -S ffmpeg-full-git
- Update the system once again by running this command:
pacman -Syu
Verifying the FFmpeg Installation
To verify the FFmpeg installation and check what version is running on the machine, insert the following command:
ffmpeg -version
The output should look as shown below:
How to Install FFmpeg on macOS
Follow these steps to set up FFmpeg on macOS:
- Download the FFmpeg package from the official website.
- Choose the Static builds for macOS 64-bit. This will redirect you to the evermeet.cx site.
- Select the ffmpeg-5.0.1 version.
- Open the downloaded file. This will extract it using the Archive Utility and create an executable FFMpeg file.
- Launch the Home folder by opening Finder and using the keyboard shortcut CMD + Shift + H, or clicking the Go buttonon the menu bar and clicking Home.
- Go to File and click the New folder. Rename it to audio-orchestrator-ffmpeg and press Return to confirm the change.
- Open the newly added folder and create a new folder labeled bin.
- Move the FFmpeg file from Downloads to the newly created bin folder.
- Double-click to open the FFmpeg file. When the “ffmpeg” can’t be opened because it is from an unidentified developer.” message appears, press OK.
- Go to System Preferences and select Security and Privacy.
- Choose the General tab.
- When a new error message appears, click Open Anyway.
- Another pop-up will appear stating that “macOS cannot verify the developer of “ffmpeg”. Are you sure you want to open it?”. Click Open.
- Double-click the FFmpeg file, and a new Terminal window will open. Close it only when the process is complete.
- Congratulations, you have successfully installed FFmpeg.
How to Install FFmpeg on Windows
Before the installation process, it is vital to have a ZIP file utility installed on your system. Here’s how to install FFmpeg on Windows:
- Download the FFmpeg package from the official website.
- Choose the Windows builds from gyan.dev. This will redirect you to the gyan.dev website.
- Select the ffmpeg-git-full.7z version.
- Once downloaded, right-click the FFmpeg folder and select Extract files.
- Once done, open the extracted folder and copy and paste all the EXE files from bin to the root folder of your hard drive. For example, create a separate folder on the Local Disk (C:) to store all the files.
- Type “environment properties” on the search tab and click Open.
- This will open the System Properties window. Go to the Advanced tab and choose Environment Variables…
- Go to the System variables section. Select Path from the listand click Edit.
- Choose New and add the FFmpeg path of the folder you have created previously to store the EXE files.
- Once done, click OK to save your changes. This will close the Edit environment variable window.
- Select OK to close the Environment Variables window and click OK once again to close System Properties.
- Open the Command Prompt window or type “cmd” in the search tab.
- Run the following command to verify that FFmpeg is installed:
ffmpeg
- The following output should appear, showing the FFmpeg version and default configuration settings:
- Congratulations, You have successfully installed the FFmpeg application on your system.
Conclusion
FFmpeg is a cross-platform software that manages multimedia files using a single-line command to execute various actions. In addition, it contains a set of shared audio and video libraries such as libavcodec, libavutil, and libavformat.
We have also explained how to install FFmpeg on different Linux distributions such as Ubuntu, Debian, CentOS, RHEL, Fedora, macOS, and Windows systems.
We hope this article has helped you understand how to install FFmpeg. If you have any questions or suggestions, please leave them in the comments section below.
Edward is a content editor with years of experience in IT writing, marketing, and Linux system administration. His goal is to encourage readers to establish an impactful online presence. He also really loves dogs, guitars, and everything related to space.
The Co-author
Noviantika G.
Noviantika is a web development enthusiast with customer obsession at heart. Linux commands and web hosting are like music to her ears. When she's not writing, Noviantika likes to snuggle with her cats and brew some coffee.