Compiling ffmpeg with mp3 on Ubuntu - Revised for Ubuntu Gutsy Server

Joeri Poesen //

This is a revised edition of my original post on compiling ffmpeg on Ubuntu.

update: seems to work in Hardy too.

The excellent Flashvideo module in Drupal uses ffmpeg to convert uploaded video to Adobe Flash Video format (.flv).

However, we’re using Ubuntu based servers and Ubuntu has a strict policy not to include non-free software. This means that the ffmpeg version in the repositories is not built with essential functionality, like mp3 support for audio conversion.

Solution: compile from source. Don’t run away screaming. It’s real easy.

1. enable universe and multiverse repositories

UbuntuGuide » general notes » how to add extra repositories

2. get your tools

sudo apt-get install checkinstall build-essential subversion

3. get the latest ffmpeg sources

cd /usr/local/src
sudo svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

4. get the necessary dependencies

sudo apt-get install liblame-dev libfaad-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev 

5. configure

cd ffmpeg
sudo ./configure --enable-gpl --enable-liba52 --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-pthreads --disable-vhook

6. compile

sudo make

7. go have a snack

8. create the .deb package

sudo checkinstall

note: just press [return] each time when asked for a configuration option

9. install the .deb package

sudo dpkg -i [ffmpeg_your_version.deb]

10. rejoice