Extracting audio from MP4 video into MP3

40

20

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

OverTheRainbow

Posted 2010-01-15T16:10:39.457

Reputation: 5 153

Are you certain of the file specs you've listed here? Often the bubbly sound indicates that you're resampling the audio. – JDB – 2010-10-19T20:04:30.430

Answers

40

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.

user1686

Posted 2010-01-15T16:10:39.457

Reputation: 283 655

1

I ended up using media.io

– thepirat000 – 2014-12-19T04:09:13.153

works perfectly and is cross platform solution! – Girardi – 2013-03-03T02:57:31.720

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 – 2013-05-08T00:35:55.050

9

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.

evilsoup

Posted 2010-01-15T16:10:39.457

Reputation: 10 085

This worked great for me until avconv disappeared without notice after a bi-yearly Ubuntu upgrade. – Marius Gedminas – 2018-09-25T11:33:55.127

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/

Molly7244

Posted 2010-01-15T16:10:39.457

Reputation:

1oh god ... searched for the download link for 30 seconds, no clue ... then read about the adware ... no thanks. Yamb worked fine! – Anthony Alberto – 2013-01-12T17:46:20.213

1Thanks, Super did it. I then combined the MP3 files into a single file using "Merge MP3". – OverTheRainbow – 2010-01-15T18:14:18.817

1you're more than welcome. SUPER is truly the Swiss Army knife for multimedia file conversion. – None – 2010-01-15T18:18:35.720

3but god, what an awful site. can they hide that download link any deeper?? – quack quixote – 2010-01-16T08:47:02.383

2Yup, their web site sure needs an overhaul. Super's UI is also a bit "unusual" ;-) – OverTheRainbow – 2010-01-18T09:56:56.460

4

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

sprinter

Posted 2010-01-15T16:10:39.457

Reputation: 41

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

Jeff Baker

Posted 2010-01-15T16:10:39.457

Reputation: 141

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.

jsejcksn

Posted 2010-01-15T16:10:39.457

Reputation: 2 854

1

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

mcstrother

Posted 2010-01-15T16:10:39.457

Reputation: 121

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.

John T

Posted 2010-01-15T16:10:39.457

Reputation: 203

2Hi. 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 – 2013-10-11T18:37:25.500

0

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

romanovskis

Posted 2010-01-15T16:10:39.457

Reputation: 1