How to extract aac audio from an mp4 file to m4a

How can I extract the aac audio from an mp4 file?

I tried with ffmpeg and -acodec copy but if i use mp4 as output it will still encode the video and I get the same file size.

If I use m4a as output it will somehow still encode the video and I get almost the same filesize.

With aac as output I can't open the file in puddletag although the file size suggests the video was stripped

Thanks in advance


Solution 1:

I finally found the solution myself in using mp4 or m4a as output format and adding -vn to prevent also copying the video.

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

(Source: https://superuser.com/a/706622/180675)

Seems simple now :]

Fast and lossless stripping

Solution 2:

Another option:

MP4Box -add infile.mp4#audio outfile.m4a

MP4Box is part of the gpac package.