It's easy and free with ffmpeg and/or mplayer on Linux, BSD, or other free operating systems!
Here is a description of how to extract audio from a video file and convert it to MP3. Let's say you have some sort of video file. Maybe you used the DownloadHelper plugin for Firefox. Other alternatives include KeepVid or TubeGrip An even simpler tool is the yt-dlp fork of youtube-dl, a simple command-line program for downloading video files if you know the URL of the page. See the youtube-dl page for simple instructions on how to install and use that tool on your system.
Now that you have the file, we will do the conversion with
documentation for ffmpeg
for far more details, but here are some simple examples.
Let's assume that you have a movie file named
and you want to extract the audio to an MP3 file named
Just add the full or a relative path
to the following commands as needed.
It's simple! Just do this:
$ ffmpeg -i moviefile.mpeg -f mp3 audiofile.mp3
You can specify the audio bitrate and the audio sampling rate if you want. Here is how you get relatively high quality 128 kbps audio (assuming the original video file had good audio!) sampled at the 44,100 sample/second rate used on a CD:
$ ffmpeg -i moviefile.mpeg -ab 128000 -ar 44100 -f mp3 audiofile.mp3
What if the video file is some non-MPEG format, like Flash (ugh) or AVI or WMV?
Then you will need the appropriate codec plugin for ffmpeg. With some Linux distributions you will need to look outside the distribution itself for the codecs, and maybe even for ffmpeg itself.