Let’s learn how to install FFmpeg on Ubuntu, MacOS, and Windows – the easy and painless way. Often times, people spend too much time installing FFmpeg and not using it. Let’s solve that problem today!
For those who do not know, FFmpeg is one of the most important and popular video processing and compression libraries there is! It powers some of the most efficient encoders that are commercially available along with commonly used software like Handbrake and VLC player.
In this article, let’s start with the basics and see how to install FFmpeg on Windows, MacOS, and Ubuntu. Let’s go!
How to Install FFmpeg on Windows?
On a Windows machine, it is a complex process to compile and install FFmpeg if you are not a programmer and don’t have access to coding tools.
However, for almost all purposes, you can head over to Zeranoe and download compiled
.exe FFmpeg files and use that (or the shared libraries).
Update: Zeranoe is shutting down on Sept. 18, 2020 and I’ll provide weekly Win64 builds (static and shared) over here.
How to Install FFmpeg on MacOS?
On a Mac, you can install FFmpeg using
brew which is a superb package manager for the MacOS ecosystem. Here is the one-liner to install FFmpeg on a Mac machine (testing and working on Cataline v 10.15.5)
brew install ffmpeg
If you want additional tools like Netflix’s
VMAF on MacOS with FFmpeg, all you need to do is to include if when you install ffmpeg. For example,
brew install ffmpeg --with-libvmaf
The brew page is an excellent resource for all the possible options. Check there first before hunting on Google or Stackoverflow.
How to Install FFmpeg on Ubuntu?
On Ubuntu, you can install FFmpeg in a couple of ways – using the
apt package manager or compiling from source.
To simply install it using
apt, use the following commandline,
sudo apt install ffmpeg
Compiling FFmpeg from Source
However, if you are installing FFmpeg on an Ubuntu machine, there is a high likelihood that you are going to tinker with FFmpeg and that means you might want to compile from the FFmpeg source.
To do so, you can use the procedure mentioned in the FFmpeg Official Installation Guide.
I’ve done it a few times, and there are a couple of dependencies missing in the official guide. Here is my procedure for compiling and installing FFmpeg from source on Ubuntu 18.04.
Step 1: Install the Dependencies (including
nasm). And, remember to create the following folders
mkdir -p ~/ffmpeg_sources ~/bin
Step 2: Install the Video and Audio Codecs that you are going to need. I installed
Step 3: Install
libunistring-dev to prevent the following error :
ERROR: gnutls not found using pkg-config
sudo apt-get install libunistring-dev
Step 4: Download and compile FFmpeg from sources. Notice that we are now using
--enable libvmaf to enable VMAF with FFmpeg.
cd ~/ffmpeg_sources && \ wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ tar xjvf ffmpeg-snapshot.tar.bz2 && \ cd ffmpeg && \ PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --extra-libs="-lpthread -lm" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-gnutls \ --enable-libass \ --enable-libfdk-aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-nonfree && \ PATH="$HOME/bin:$PATH" make && \ make install && \ hash -r
That’s it – you should be up and running with FFmpeg now!
Krishna Rao Vijayanagar
I’m Dr. Krishna Rao Vijayanagar, and I have worked on Video Compression (AVC, HEVC, MultiView Plus Depth), ABR streaming, and Video Analytics (QoE, Content & Audience, and Ad) for several years.
I hope to use my experience and love for video streaming to bring you information and insights into the OTT universe.