How to compile FFmpeg on Ubuntu or Debian

Last updated on October 22, 2020 by Dan Nanni

Question: I want to install the original FFmpeg (not Libav fork). How can I compile FFmpeg on Ubuntu or Debian?

On Debian-based distro (e.g., Debian, Ubuntu or Linux Mint), the package ffmpeg has existed as a transitional package for libav fork due to some political reason. So if you are trying to install ffmpeg package with apt-get, you will actually be installing libav tools, not the original FFmpeg, even when the latter is under active development. Starting from Ubuntu 14.04 (Trusty), the misleading transitional package ffmpeg has been removed from base repositories, but the official FFmpeg is still not part of base repositories on Debian-based distros.

If you want to install the original FFmpeg on Ubuntu or Debian, one way is to compile it yourself.

Here is how to compile and install FFmpeg on Ubuntu or Debian.

First, install prerequisites:

$ sudo apt-get install git make nasm pkg-config libx264-dev libxext-dev libxfixes-dev zlib1g-dev

Download FFmpeg source code, and build it as follows.

$ git clone https://github.com/FFmpeg/FFmpeg.git
$ cd FFmpeg
$ ./configure --enable-nonfree --enable-gpl --enable-libx264 --enable-x11grab --enable-zlib
$ make

If build is successful, go ahead and install FFmpeg.

$ sudo make install

After installation, type ffmpeg command to verify the installation.

Troubleshooting during FFmpeg Compilation

1. If you are getting this error while running configure:

"ERROR: Xext not found"

Install this:

$ sudo apt-get install libxext-dev

2. If you are getting this error while running configure:

"ERROR: Xfixes not found"

Install this:

$ sudo apt-get install libxfixes-dev

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean