Convert m4a to aac without quality loss?

5

1

I wanna use a program on an .m4a file, but the program can't handle .m4a. It can handle .aac, however, and the codec of the file is MPEG-4 AAC. Is there a way to convert to .aac (and preferably converting back) without reencoding?

(Alternative solution: does anyone have a good program for lossless splitting of .m4a files? mp3DirectCut kicks ass, but can't handle .m4a.)

Blrp

Posted 2016-04-20T19:50:59.610

Reputation: 315

1Aren't .m4a and .aac just two different filename extensions for the exact same container file format and codec? Did you try just changing the filename extension and seeing if your app is just been too picky about filename extensions? – Spiff – 2016-04-20T20:24:16.360

1@Spiff I tried that. It crashes the app. Also winamp plays .aac and .m4a, but not an .m4a file with extension changed to .aac. – Blrp – 2016-04-20T20:32:39.790

3

So in case anyone else was confused the same way I was, it turns out that even though AAC was developed as an audio codec for MPEG, and thus most natively seen inside .m4a MPEG-4 container files, apparently a .aac file is more likely to be a pure AAC bitstream, not wrapped in an MPEG-4 container. http://stackoverflow.com/questions/18110399/what-is-the-difference-between-m4a-and-aac-audio-files

– Spiff – 2016-04-21T21:46:58.537

1it's impossible to do lossless conversion between two lossy formats. A small decrease in quality is always introduced on each encoding step. You can only convert with minimal quality loss – phuclv – 2018-11-05T04:37:44.457

@phuclv Right, so if there are no encoding steps... – Blrp – 2018-11-05T08:06:10.787

@Blrp that's only possible if you copy the stream directly, i.e. the m4a container must contains an MPEG-4 Part 3 streams (A.K.A AAC). In practice m4a often contains MPEG-4 Part 14 audio streams – phuclv – 2018-11-05T08:18:36.317

@phuclv Well, I haven't had any problems with it. I mostly use it on m4a files downloaded from YouTube though. – Blrp – 2018-11-05T12:12:55.457

Answers

4

I found the answer from the creator of mp3DirectCut. He gives three options. Relevant part of his post follows:


I use the "DSM converter" of an old version of the "Media Player Classic" (1.3.1249.0). Also "FFmpeg" can demux (command line: ffmpeg.exe -i inputfile.mp4 -acodec copy outputfile.aac).

There is also MP4Creator which is much smaller. This small batch file can be used for easy decoding by dropping files on it:

mp4creator demux.bat:

@echo off
mp4creator.exe -list %1
echo Demux which track (usually 1 or 2)?
set /p track=
mp4creator.exe -extract=%track% %1
pause 

The extension output file must be renamed to AAC - and you got it.


I went with ffmpeg. To convert back to AAC it appears that an additional option is needed. The commands for converting to and from AAC are like below:

ffmpeg -i in.m4a -acodec copy out.aac
ffmpeg -i in.aac -acodec copy -bsf:a aac_adtstoasc out.m4a

Blrp

Posted 2016-04-20T19:50:59.610

Reputation: 315