How to compile FFmpeg on Ubuntu or Debian

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

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Leave a comment

Your email address will not be published. Required fields are marked *

Current day month ye@r *