43

I downloaded a few MP4-encoded videos from which I'd like to extract the audio stream into MP3 files for easy listening on my digital player.

Most likely, VLC can do this, but the instructions followed on their forums gave out a "bubbly" sound file.

Here are the files specifications:

  • Audio mp4a 44100 Hz
  • Video AVC1
1
  • Are you certain of the file specs you've listed here? Often the bubbly sound indicates that you're resampling the audio.
    – JDB
    Oct 19, 2010 at 20:04

9 Answers 9

45

Use ffmpeg:

ffmpeg -i input_file.mp4 -vn -b:a 128k -c:a libmp3lame output_file.mp3

(Don't forget to adjust the audio bitrate, -b:a, otherwise you might get a huge file even for a low quality source.)

Many digital players actually support AAC audio as well, so you can try extracting the original AAC audio stream, without having to reduce quality even more:

ffmpeg -i input_file.mp4 -vn -c:a copy output_file.m4a

For older versions of ffmpeg, you'll need to use -ab & -acodec options instead of -b:a & -c:a.

3
  • works perfectly and is cross platform solution!
    – Girardi
    Mar 3, 2013 at 2:57
  • 4
    -abr is not a valid option: -b:a or -ab can be used instead. (I know this is an old answer, but users are still referencing this.)
    – llogan
    May 8, 2013 at 0:35
  • 1
    I ended up using media.io Dec 19, 2014 at 4:09
10

Most MP4 videos use AAC audio, and most player devices can play AAC audio, normally in an M4A (differently-named MP4) container. Re-encoding to MP3, especially with a low bitrate input (most internet video), can lead to noticeable loss, even on low-end headphones. I would recommend using avconv/ffmpeg on the command-line

avconv -i input.mp4 -vn -c:a copy output.m4a

or

ffmpeg -i input.mp4 -vn -c:a copy output.m4a

To convert every MP4 in a directory:

for f in *.mp4; do avconv -i "$f" -vn -c:a copy "${f/mp4/m4a}"; done

Some players (like my cheapy cheapo mobile phone) can play AAC audio, but not in an M4A container, and for that you have to use

avconv -i input.mp4 -vn -c:a copy output.aac

Now, some older devices genuinely can't play anything but MP3, and for those you can either use grawity's solution, or

avconv -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3

This will create a variable bit rate (VBR) MP3 which, apart from specialised needs like streaming, should be preferred. -q:a 2 will get you an average (over a number of files) bit rate of around 190 kbit/s; for more information on encoding VBR MP3s, see here.

1
  • 1
    This worked great for me until avconv disappeared without notice after a bi-yearly Ubuntu upgrade. Sep 25, 2018 at 11:33
7

If you prefer a GUI, grab SUPER © (Simplified Universal Player Encoder & Renderer). It will do the job (and much more).

SUPER © is a GUI to FFmpeg, MEncoder, MPlayer, x264, musepack, monkey's audio, true audio, wavpack, ffmpeg2theora and the theora/vorbis RealProducer plugIn.

Drag & drop any audio file or even any video/audio file and extract the audio part by checking the Disable Video box, thereby converting it to:

  • aac
  • ac3
  • amr_nb
  • amr_wb
  • ape Monkey's Audio (Lossless)
  • flac FLAC (Lossless)
  • mmf
  • mp2
  • mp3
  • mpc
  • ogg FLAC (Lossless) or Vorbis High Quality
  • tta True Audio (Lossless)
  • wv WavPack (Lossless)
  • wav
  • wma

You can speed up the audio extraction by checking the Stream Copy box, which rips out the internal audio without conversion into another format.

SUPER © is freeware.

Note that SUPER comes bundled with OpenCandy adware. Mitigations:

  • Install in a virtual machine
  • Disable the network after the first step of the installation. The installer verifies that an Internet connection is present. After that you can disable it and ignore all warnings. I'm not entirely sure that this prevents all adware from being installed, though.
  • You can remove OpenCandy after installation: http://www.malwaredictionary.com/2011/06/opencandy/
5
  • 1
    Thanks, Super did it. I then combined the MP3 files into a single file using "Merge MP3". Jan 15, 2010 at 18:14
  • 1
    you're more than welcome. SUPER is truly the Swiss Army knife for multimedia file conversion.
    – Molly7244
    Jan 15, 2010 at 18:18
  • 3
    but god, what an awful site. can they hide that download link any deeper?? Jan 16, 2010 at 8:47
  • 2
    Yup, their web site sure needs an overhaul. Super's UI is also a bit "unusual" ;-) Jan 18, 2010 at 9:56
  • 1
    oh god ... searched for the download link for 30 seconds, no clue ... then read about the adware ... no thanks. Yamb worked fine! Jan 12, 2013 at 17:46
4

Use Yamb to extract the raw audio (mp4a is AAC) then use a suitable MP3 encoder.

2

grawity's answer is great! Just to add to it, if you would like to extract the audio from an MP4 and put it in an MP3 and keep the metadata (MP3 ID3 tags) then you can do this:

ffmpeg -i input_file.mp4 -map_metadata 0 -id3v2_version 3 -vn -b:a 128k -c:a libmp3lame output_file.mp3
1

If you are on a Mac, a simpler method in the future may be to right-click on the the file in the Finder, choose "Get Info", and change the extension from .mp4 to .m4a. Then open it in iTunes and convert it to an mp3.

1

On Windows 7, Any Video Converter worked right out of the box for me. Looks like Mac is supported as well.

1

If you perform a lot of audio editing, there's a reasonable chance you already have (and love!) Audacity.

It will open the mp4 file and allow you to "Save as" a number of file types, including mp3. It also provides a simple dialog for any parameters you might want to change, including things such as sampling rate and MP3 tags.

If you don't have Audacity, it might not be the most direct path, but it's far more versatile than a simple converter program. It's a fully functional audio editor, open source, and cross platform.

1
  • 2
    Hi. Doesn't work. Tried to open 'video.mp4' but Audacity v2.0.4 reported "video.mp4 is an Advanced Audio Coding file. Audacity cannot open this type of file. You need to convert it to a supported audio format, such as WAV or AIFF." Doh! ffmpeg worked perfect, though.
    – judoman
    Oct 11, 2013 at 18:37
0

On Windows I use Pazera Free Audio Extractor. Very lightweight, intuitive, portable. Excellent frontend to ffmpeg tool

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .