MP4 Video to MP3 File Using ffmpeg (Ubuntu 9.10 Karmic Koala)

Here's how you can use ffmpeg to convert a video (an MP4 video, for example) to an MP3 that you can load on your MP3 player:
    ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
But there's a catch: You have to have ffmpeg and the libavcode-unstripped-52 packages installed on your computer. The problem is that second package is available in the multiverse respository only. To enable the multiverse repository, select Administration from the System menu, then Software Sources. In the Ubuntu Software tab of the Software Sources dialog box, select the check box that reads Software Restricted By Copyright Or Legal Issues (Multiverse). Click the Close button when you're done.

After you've enabled the multiverse repository, you can install the ffmpeg and libavcodec-unstripped-52 packages from a Terminal window with the following command:

    sudo apt-get install ffmpeg libavcodec-unstripped-52
Now, let's go back to the options that I used with the ffmpeg command at the beginning of the article. The -i video.mp4 option is easy: it identifies the path to the input file. The -f mp3 option tells ffmpeg that we want the output format to be MP3. The -ab 192000 bit tells ffmpeg that we want our MP3 encoded at 192Kbps. The -vn option means "No video in the output". Finally, "music.mp3" is just the name we want to give to the output file.

That's it! Now, if you could just figure out how to download video from popular sites on the Internet, you could extract MP3 audio from your downloads!