Ubuntu – Extract audio mp3 from Video Files Like .flv, .mov, .avi

It is very easy to extract the audio track from video files using Linux. All you need is ffmpeg and some codecs.

1. Add the Medibuntu’s repository to your sources.list:


sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update

2. Install ffmpeg:


sudo apt-get install ffmpeg

3. Let’s get the restricted packages and some codecs installed:

sudo apt-get install ubuntu-restricted-extras libmp3lame0 libdvdcss2 w32codecs

The above command is for i386 architecture. If you have an amd64 architecture, substitute w32codecs with w64codecs.

Note: This is not a complete list of codec packages by any stretch of the imagination. It will get you started though and you will be able to do most formats, but you might have to add codecs as you go along.

4. Now we are ready to extract the audio from the video files:


ffmpeg -i input_file.flv output_file.mp3

The above command will extract the audio from a Flash video file. You can do the same for a QuickTime file as well:


ffmpeg -i input_file.mov output_file.mp3

Or for an Audio Video Interface file:

ffmpeg -i input_file.avi output_file.mp3

YouTube and other video web sites:

Having done all this, now we can download flash files from places like YouTube and strip the audio from them. All you need besides the steps above is a way to save the Flash files (.flv) from YouTube. An easy way to do that is by using Firefox Add-ons like Download Flash and Video or Flash Video Downloader.

The quality of the audio in the YouTube videos for example is 64 bit/sec. Most of the mp3 files are normally compressed to 128 bit/sec or above. Obviously the quality will not be the same, but a human year cannot tell the difference.

The quality of the extracted mp3 will depend on the quality of the audio track in the video file. So the above statement about the 64 bit/sec audio is mostly the case for the files on some video sharing sites.

Leave a Reply

Your email address will not be published. Required fields are marked *

*