Extract audio aac from mp4

10

2

Is there a command line tool for Windows to extract audio aac from mp4 ?

iceman

Posted 2010-09-09T08:58:27.607

Reputation: 2 232

How to change compatible brand with mp4box? -brand doesn't work! – Dr.jacky – 2015-11-10T11:13:48.100

Answers

5

FFmpeg can do it. Here is a list of commands that might come useful for you. Go here for instructions.

Example:

ffmpeg -i INPUT.mp4 -c copy -map 0:a:0 Output.aac
  • -i: input file
  • -c copy: copies the bitstreams without re-encoding
  • -map 0:a:0: selects track from: 1st input file -> audio tracks -> first track (1st audio track from 1st input file)

Note that it would work similarly with avconv, which is a fork of ffmpeg.

subanki

Posted 2010-09-09T08:58:27.607

Reputation: 6 702

1Only linking to a solution is bad practice. At least give some examples. – erik – 2015-07-04T21:58:03.310

1If there's only one audio stream inside the MP4, the -map argument is not necessary, ie. writing this is enough: ffmpeg -i INPUT.mp4 -c copy Output.aac – miyalys – 2015-09-22T12:21:12.307

Here is how to create in batch mode. First create a sub-folder "out" where your mp4 files are. Then, "open command window" to the mp4 folder and paste the following

for %f in ("*.mp4") do C:\yourpath\ffmpeg\bin\ffmpeg -i "%f" -c copy -map 0:a:0 out/"%~nf.aac" – Vijay Jagdale – 2017-06-04T21:29:12.007

8

mp4box can also do this.

To demux/extract aac from mp4 (assuming audio is the 2nd track):

mp4box -raw 2 video.mp4

This will automatically create output file "video_track2.aac"

If you wanted control over the output filename, you would do

mp4box -raw 2 video.mp4 -out audio.aac

If you wanted to remux back into mp4 container (i.e. for iTunes) you could do:

mp4box -single 2 video.mp4 -out audio.m4a

You could then put this in a batch script to operate over all the files in a directory:

for %%f in ("*.mp4") do (

mp4box -single 2 "%%f" -out "%%~nf.m4a"

)

(batch script inspired by videohelp and stackoverflow)

Download links:

user26398

Posted 2010-09-09T08:58:27.607

Reputation: 178

1+1 Thank you, the -single command is exactly what I was looking for (it adds MP4 info to -raw) – Martin – 2015-09-16T21:44:51.303

5

Here’s the actual commands to use since all the provided links don’t actually give them, and anyway: links rot and die so should always be replaced with actual answers on stackexchange.

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

Max Howell

Posted 2010-09-09T08:58:27.607

Reputation: 587

Worked great (with parent project "ffmpeg.exe" instead of "avconv.exe") and fixed .aac output problem of inaccurate timecode. Turns out m4a is a proper container format. – SushiGuy – 2016-11-02T02:16:23.227

I'm getting "Output file #0 does not contain any stream" – Chris – 2019-06-18T11:11:49.513

0

I first just use mkvtoolnix to convert the MP4 to MKV and use mkvextract gui to extract the needed track. Lot less complicated and full GUI. Absolutely zero change in any component whatsoever.

user38660

Posted 2010-09-09T08:58:27.607

Reputation: 1

1If it’s less complicated, can you please describe how to do what the OP wants to do with these tools?  Also, note that the question asked for a command line tool. – Scott – 2017-10-20T12:33:08.303

Actually mkvtoolnix is a graphical front end for the command line mkvmerge.exe I believe you can find the command line switches and command formatting information on line too. The GUI also has the option of creating batch files for working on multiple files. – user38660 – 2017-10-23T05:53:16.783

-3

Super can do it also.

SUPER © "The Player" surpasses any known player by supporting just any Multimedia file format. SUPER © plays files that cannot be played with WMP or even other libavcodec-based players like MPC and VLC. SUPER © also plays and saves Internet Media Streams of different protocols ( mms:// rtsp:// http://)

SUPER © "The Encoder" is the fastest and simplest tool to encode full length movies to any other format without any time or function limitation.

Moab

Posted 2010-09-09T08:58:27.607

Reputation: 54 203