ffmpeg is a very powerful video coding suite. It is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. ffmpeg is developed under Linux, but it can be compiled under most operating systems, including Windows.

How to enable mp3 support?

Because of license rights, ffmpeg doesn't include encoding support of mp3 by default.
So we have to recompile it or get a non-free version of ffmpeg.

Install from non-free repository

You can find an already compiled version of ffmpeg in the MediBuntu repository.
It contains a ffmpeg compiled with risky option.

Recompile by yourself

In Ubuntu this can be done quite simply.
Just follow these steps in a shell.

  • Install necessary development packs:
    sudo apt-get install quilt libsdl1.2-dev libogg-dev libvorbis-dev liba52-dev
    libdts-dev libimlib2-dev texi2html libraw1394-dev libdc1394-13-dev
    libtheora-dev libgsm1-dev
    liblame-dev libxvidcore-dev libfaac-dev libfaad2-dev libx264-dev

  • Download ffmpeg sources:
    cd /usr/local/src
    sudo apt-get source ffmpeg
    cd ffmpeg

  • The most important step: enable support for mp3, x264, etc:
    export DEB_BUILD_OPTIONS=risky

  • Build installable debian packages
    sudo dpkg-buildpackage
    cd ..

  • Finally, install all generated debian packages:
    sudo dpkg -i ffmpeg_0.cvs20060823-3.1ubuntu4+medibuntu2_x86.deb libavcodec0d_0.cvs20060823-3.1ubuntu4+medibuntu2_x86.deb libavcodec-dev_0.cvs20060823-3.1ubuntu4+medibuntu2_x86.deb ... 

    Essentially, you have to list all generated debian packages here.

    Maybe you could do something like this:
    sudo dpkg -i `ls *.deb`

Test the non-free version

That's it. Now we can test the installation:
 ffmpeg -i some_of_your_movies.avi -ar 44100 test.flv

This should convert one of your AVI movies into a Flash Video.
ffmpeg shouldn't claim any longer about unknown codec for output stream 0.1 (the audio one).