Compile FFmpeg on Ubuntu Hardy Heron 8.04 LTS
Contents
This guide supports Ubuntu Hardy Heron 8.04 LTS. If you are using a different Ubuntu version see the main Compile FFmpeg on Ubuntu Guide. This guide will enable several external encoders and decoders: libfaac (AAC encoder), libmp3lame (MP3 encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired.
Note: Copy and paste the whole code box for each step.
Preparation
Remove any existing packages:
sudo apt-get remove ffmpeg x264 libx264-dev yasm
Get the dependencies (Ubuntu Desktop users):
sudo apt-get update sudo apt-get -y install build-essential git-core checkinstall texi2html libfaac-dev \ libsdl1.2-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config zlib1g-dev
Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update sudo apt-get -y install build-essential git-core checkinstall texi2html libfaac-dev \ libvorbis-dev pkg-config zlib1g-dev
Installation
Yasm
Yasm is an assembler and is recommended for x264 and FFmpeg.
cd wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz tar xzvf yasm-1.2.0.tar.gz cd yasm-1.2.0 ./configure make sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --default
x264
H.264 video encoder. The following commands will get the current source files, compile, and install x264.
cd git clone git://git.videolan.org/x264 cd x264 ./configure --enable-static make sudo checkinstall --pkgname=x264 --pkgversion="2:0.svn$(date +%Y%m%d)-0.0ubuntu1" \ --backup=no --deldoc=yes --default
LAME
MP3 audio encoder.
sudo apt-get -y remove liblame-dev sudo apt-get -y install nasm cd wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xzvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --enable-nasm --disable-shared make sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.99.5" --backup=no \ --deldoc=yes --fstrans=no --default
libvpx
VP8 video encoder and decoder.
sudo apt-get -y install curl cd git clone http://git.chromium.org/webm/libvpx.git cd libvpx ./configure make sudo checkinstall --pkgname=libvpx --pkgversion="$(date +%Y%m%d%H%M)-git" \ --backup=no --deldoc=yes --fstrans=no --default
FFmpeg
cd git clone --depth 1 git://source.ffmpeg.org/ffmpeg cd ffmpeg ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac \ --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 \ --enable-x11grab make sudo checkinstall --pkgname=ffmpeg --pkgversion="4:git-$(date +%Y%m%d)" --backup=no \ --deldoc=yes --default hash x264 ffmpeg ffplay
Note: Ubuntu Server users should omit --enable-x11grab.
Finish
Installation is now complete and FFmpeg is now ready for use. You can keep the x264, libvpx, and ffmpeg directories in your home directory if you plan on updating later. See Updating FFmpeg below for more details. Instructions on updating FFmpeg are next followed by instructions on reverting all changes made by this guide.
Updating FFmpeg
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 as shown under Preparation (follow the "Remove any existing packages" step and then the appropriate "Get the dependencies step"). Then continue as shown below.
x264
cd ~/x264 make distclean git pull
Now run ./configure, make, and make install as shown in the Install x264 section.
libvpx
sudo apt-get -y remove libvpx cd ~/libvpx make clean git pull
Now run ./configure, make, and make install as shown in the Install libvpx section.
FFmpeg
cd ~/ffmpeg make distclean git pull
Now run ./configure, make, and make install as shown in the Install FFmpeg section.
Reverting Changes Made by This Guide
To remove FFmpeg/x264 and other packages added for this guide:
sudo apt-get autoremove build-essential checkinstall ffmpeg git-core lame-ffmpeg \ libfaac-dev libsdl1.2-dev libvorbis-dev libvpx libx11-dev libxext-dev libxfixes-dev \ nasm texi2html x264 yasm zlib1g-dev
Lastly, delete the ffmpeg, x264, yasm, and lame 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.


