Install FFmpeg and x264 on Ubuntu Hardy Heron 8.04 LTS

by CarcaBot on July 28, 2010 · 1 comment

Getting the Dependencies
1. First, install packages that x264 and FFmpeg require. Make sure the Ubuntu universe and multiverse repositories are enabled. For help doing this, refer to Adding the Universe and Multiverse Repositories on the Ubuntu Wiki.

2. Uninstall x264, libx264-dev, and ffmpeg if they are already installed. Open a terminal and run the following:

Code:
sudo apt-get remove ffmpeg x264 libx264-dev

Next, get all of the packages you will need to install FFmpeg and x264.

Code:
sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall texi2html libfaac-dev liblame-dev libsdl1.2-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev

3. Yasm 0.5.0 is in the Ubuntu Hardy Heron universe repository, but is too old to be used for x264, so it must be downloaded, compiled, and installed.

Code:
cd
wget http://www.tortall.net/projects/yasm/releases/yasm-1.0.1.tar.gz
tar xzvf yasm-1.0.1.tar.gz
cd yasm-1.0.1
./configure
make
sudo checkinstall --pkgname=yasm --pkgversion "1.0.1" --backup=no --default

Install x264
4. Get the most current source files from the official x264 git repository, compile, and install. You can run “./configure –help” to see what features you can enable/disable. If you are behind a firewall or unable to use git, then daily source tarballs are also available.

Code:
cd
git clone git://git.videolan.org/x264.git
cd x264
./configure
make
sudo checkinstall --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1" --backup=no --default

Install libopencore-amr
5. This will allow you to decode and encode AMR audio. You can skip this step and omit –enable-libopencore-amrnb –enable-libopencore-amrwb in step 7 if you don’t plan on decoding or encoding AMR audio:

Code:
cd
wget http://transact.dl.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
tar xvf opencore-amr-0.1.2.tar.gz
cd opencore-amr-0.1.2
./configure --disable-shared
make
sudo checkinstall --fstrans=no --pkgname="libopencore-amr" --pkgversion="0.1.2" --backup=no --default

Install libtheora
6. This is used to encode to Theora, the video type usually found in OGG files. The repository libtheora is too old, so it must be compiled. You can skip this step and omit –enable-libtheora in step 7 if you don’t plan on encoding to Theora video:

Code:
sudo apt-get install libogg-dev
cd
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --disable-shared
make
sudo checkinstall --fstrans=no --pkgname=libtheora --pkgversion "1.1.1" --backup=no --default

Install FFmpeg
7. Get the most current source files from the official FFmpeg svn, compile, and install. Run “./configure –help” to see what features or codecs you can enable/disable and which have a native implementation. If you are behind a firewall or unable to use subversion, then nightly FFmpeg snapshots are also available.

Code:
cd
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --backup=no --default
hash x264 ffmpeg ffplay

That’s it for installation. You can keep the ~/x264 and ~/ffmpeg directories if you later want to update the source files to a new revision. See “Updating Your Installation” on the first page of this guide for more details.

That’s it! Now head back to the FFmpeg guide for usage instructions and more.

Reverting Changes Made by This Tutorial
To remove FFmpeg/x264 and any changes made from this tutorial:

Code:
sudo apt-get remove x264 ffmpeg build-essential yasm subversion git-core checkinstall texi2html libfaac-dev liblame-dev libsdl1.2-dev libtheora libvorbis-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev

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

Leave a Comment

{ 1 trackback }

Previous post:

Next post: