wiki:

CompilationGuide

/

Ubuntu


Version 58 (modified by llogan, 4 years ago) (diff)

nit: forgotten libvpx

Compile FFmpeg on Ubuntu

This guide for Ubuntu 13.04 Raring Ringtail will install the latest FFmpeg programs and enable several external encoding and decoding libraries (codecs). Separate guides are available for Ubuntu 12.10 Quantal Quetzal, Ubuntu 12.04 Precise Pangolin, Ubuntu 11.10 Oneiric Ocelot, Ubuntu 10.04 Lucid Lynx, and Ubuntu 8.04 Hardy Heron?.

Note: Copy and paste the whole code box for each step.

Preparation

Remove any existing packages:

sudo apt-get remove ffmpeg x264 libav-tools libx264-dev

Note: The multiverse repository must be enabled in order to install the libfaac-dev package. See more details on adding repositories.

Get the dependencies (Ubuntu Desktop):

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential checkinstall git libass-dev libfaac-dev \
  libgpac-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev \
  libvpx-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html yasm zlib1g-dev

Get the dependencies (Ubuntu Server):

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential checkinstall git libass-dev libfaac-dev \
  libgpac-dev libmp3lame-dev libtheora-dev libtool libvorbis-dev libvpx-dev pkg-config texi2html yasm zlib1g-dev

Installation

x264

H.264 video encoder. The following commands will get the current source files, compile, and install x264. See the x264 Encoding Guide for some usage examples.

cd
git clone --depth 1 git://git.videolan.org/x264.git
cd x264
./configure --enable-static
make
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
  awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
  --fstrans=no --default

Note: You can download the nightly x264 source snapshot as an alternative to using git.

fdk-aac

AAC audio encoder.

cd
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --disable-shared
make
sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

Note: You can download a fdk-aac source snapshot as an alternative to using git.

FFmpeg

Note: Ubuntu Server users should remove --enable-x11grab from the following command:

cd
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \
  --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 \
  --enable-nonfree --enable-version3
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default
hash -r

Note: You can download the nightly FFmpeg source snapshot as an alternative to using git.

Finish

Installation is now complete and FFmpeg is now ready for use. You can keep the ffmpeg, fdk-aac, and x264 directories in your home directory if you plan on updating later. See Updating FFmpeg below for more details. Some optional steps are next followed by instructions on updating FFmpeg and finally instructions on reverting all changes made by this guide.


Updating FFmpeg (Ubuntu Desktop)

Development of FFmpeg and x264 is active and an occasional update can give you new features and bug fixes. First, remove some packages and then update the dependencies:

sudo apt-get -y remove ffmpeg x264 libx264-dev
sudo apt-get update
sudo apt-get -y install autoconf automake build-essential checkinstall git libass-dev libfaac-dev \
  libgpac-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev \
  libvpx-dev libx11-dev libxext-dev libxfixes-dev texi2html yasm zlib1g-dev

x264

cd ~/x264
make distclean
git pull

Now run ./configure, make, and checkinstall as shown in the Install x264 section.

fdk-aac

cd ~/fdk-aac
make distclean
git pull

Now run ./configure, make, and checkinstall as shown in the Install fdk-aac section.

FFmpeg

cd ~/ffmpeg
make distclean
git pull

Now run ./configure, make, and checkinstall as shown in the Install FFmpeg section.


Reverting Changes Made by This Guide

To remove FFmpeg, x264, and other packages installed for this guide:

sudo apt-get autoremove autoconf automake build-essential checkinstall fdk-aac ffmpeg git libass-dev \
  libfaac-dev libgpac-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \
  libvorbis-dev libvpx-dev libx11-dev libxfixes-dev pkg-config qt-faststart texi2html x264 yasm zlib1g-dev

Lastly, delete the ffmpeg, fdk-aac, and x264 directories in your home folder.

If You Need Help

Feel free to ask your questions at the #ffmpeg IRC channel or the ffmpeg-user mailing list.