This post will help you to install ffmpeg and compile it with some important codecs.

First, get your dependencies:

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev 
libfaac-dev libxvidcore4-dev liba52-0.7.4 
liba52-0.7.4-dev libx264-dev checkinstall 
build-essential subversion

Next, grab the ffmpeg source:

svn checkout -r 8998 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

If you’re feeling adventurous, you can try the very latest code by omitting the -r 8998 part of that line. Revision 8998 is the latest at the time of writing, and worked for me.

Now you can configure and build ffmpeg. This takes a little while:

cd ffmpeg
./configure --enable-gpl --enable-pp --enable-libvorbis 
--enable-libogg --enable-liba52 --enable-libdts 
--enable-dc1394 --enable-libgsm --disable-debug 
--enable-libmp3lame --enable-libfaad --enable-libfaac 
--enable-xvid --enable-pthreads --enable-x264
make

Finally, install it.

checkinstall

gives you the option to edit some parameters: I set the name to ffmpeg and the version to 3:0.svn20070511

sudo checkinstall