How to Extract MP3 Audio from a Video File

It's easy and free with ffmpeg and/or mplayer on Linux, BSD, or other free operating systems!


See the documentation for ffmpeg for far more details, but here are some simple examples.

Let's say you have some sort of video file. Maybe you used keepvid.com to save a video from YouTube and now you want to extact and save just the audio track as an MP3 file.

Let's assume that you have a movie file named moviefile.mpeg, and you want to extract the audio to an MP3 file named audiofile.mp3. 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 

That's it!

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. The Penguin Liberation Front has some useful additions. Note that PLF provides source code in addition to binary RPMs.


How to copy and burn DVDs, even those with CSS encryption and copy protection, using free software and free operating systems

How to download videos from YouTube and convert them to XviD and DivX

Converting PAL DVDs to NTSC, Creating and Burning Your Own DVDs, and other Video Conversions

Converting Audio Files from WMA or FLAC to MP3

How to Extract MP3 Audio from a Video File

Rotating Digital Camera Movies by 90° and Converting to DVD

Various Technical Topics

Radio topics — Ham radio, construction and repair, propagation, frequencies, etc

Click here to inquire about advertising on this or any page on this site.
Home Unix/Linux Networking Cybersecurity Travel Technical Radio Site Map Contact


Use /bin/vi! Manipulate images with ImageMagick! Hosted on OpenBSD
Hosted on Apache This site is viewable with any browser Valid XHTML 1.0! Valid CSS!
© Bob Cromwell May 2012. Created with /bin/vi and ImageMagick, hosted on OpenBSD with Apache.    Root password available here, privacy policy here.