Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

CoreAudio and implicit HE-AAC

Hello,

It seems that CoreAudio not always decode HE-AAC correct. On this page, there are a number of testfiles encoded with HE-AAC or HE-AAC v2.

https://www2.iis.fraunhofer.de/AAC/stereo.html

When I download the files and check info i QuickTime Player, all of them are reported as stereo HE-AAC at 44100 Hz, except AOT 29 implicit (SBRtestStereoAot29Sig0.mp4). This file is reported as mono AAC 22050 Hz.

However, if I check it in VLC, it is reported as stereo 44100 Hz with extensions SBR+PS, that is HE-AAC v2.

The only difference I can see in the program MediaInfo is that this is the only file with format setting: Implicit. The rest has Explicit.

Is there a way to force CoreAudio to decode implicit HE-AAC correctly?

Is it possible to simply edit the format setting "metadata" in a mp4-file, from Implicit to Explicit to make it work? In that case how do one edit the mp4-file?

Thanks!

Posted on Dec 18, 2017 2:48 AM

Reply
1 reply

Dec 20, 2017 3:31 PM in response to Joachim Oijwall

It seems that CoreAudio not always decode HE-AAC correct. On this page, there are a number of testfiles encoded with HE-AAC or HE-AAC v2.

https://www2.iis.fraunhofer.de/AAC/stereo.html

When I download the files and check info i QuickTime Player, all of them are reported as stereo HE-AAC at 44100 Hz, except AOT 29 implicit (SBRtestStereoAot29Sig0.mp4). This file is reported as mono AAC 22050 Hz.

However, if I check it in VLC, it is reported as stereo 44100 Hz with extensions SBR+PS, that is HE-AAC v2.

The only difference I can see in the program MediaInfo is that this is the only file with format setting: Implicit. The rest has Explicit.

I'm neither a sound engineer nor do I use HE-AAC encoding in my daily workflows. However, your question was interesting and so I decided to take some time off from transcoding my iTunes video library to HEVC and do a bit of research on the topic. Here is what I learned...


First off, the Fraunhofer FKD and Apple AAC codecs have somewhat different software implementations and, as a result, perform somewhat differently. As Apple puts it, HE-AAC is a layered format and has at its core the base layer of AAC. The encoded data for a layered audio format can be made of several layers that could have different sample rates, different channel layouts and may be decoded to multiple destination formats. Any AAC decoder would be able to decode the AAC base layer of an HE-AAC bitstream. Further, Core Audio represents this layering through the notion of an audio format list containing one or more audio format list items, each item representing an available format of the encoded data in the file. For example, a hypothetical file encoded as HE-AACv1 may return an audio format list containing two audio format list items, describing the available formats as:

In other words, the encoded data in the file may be rendered as either HE-AAC or AAC-LC. However, since platform capabilities can vary (HE-AAC decoding may be available on one platform but not on another), Core Audio also has the notion of a first playable format. The first playable format is the highest quality (or best) format the platform is capable of playing back as determined at run-time. Unfortunately, as you have already surmised, only the explicit signaling mode is supported by Apple for HE-AAC in the MPEG-4 (MP4 and M4A) file format. Therefore, as in your example above, playback defaults to the AAC, mono 22.05KHz (Front Center Channel) base layer when the file's enhanced layer fails to be signaled to and recognized by Core Audio.


However, if I check it in VLC, it is reported as stereo 44100 Hz with extensions SBR+PS, that is HE-AAC v2.

This is hardly surprising since HandBrake employs the Fraunhofer FKD codec (which supports implicit HE-AAC signaling in MPEG-4 file containers) for "correct" playback.


The only difference I can see in the program MediaInfo is that this is the only file with format setting: Implicit. The rest has Explicit.

Strange! On my system the file named "SBRtestStereoAot5SigusePS.mp4" also shows up as "Implicit" in MediaInfo and was also rendered as an AAC-LC 22.05KHz Mono Center Channel decode in the QTX player.


Is there a way to force CoreAudio to decode implicit HE-AAC correctly?

Not really sure. I suspect developer software apps that have the ability to trace coding might have the capability of stepping through code execution, pausing to change the desired audio list index reference and either modifying a selection or specifying a signaling format ID. Unfortunately, this is beyond my current expertise.


Is it possible to simply edit the format setting "metadata" in a mp4-file, from Implicit to Explicit to make it work? In that case how do one edit the mp4-file?

Not in the same sense as you could modify an MOV, MP4 or M4V file to fool the QTX Player app into loading/playing third-party HEVC video encodes.

User uploaded file

As you can see in the image above, the Fraunhofer encoded file is embedded with the "mp4a" Type ID and already identifies the file as a 44.1KHz, 2-channel audio file. Unfortunately, I believe the "metadata" you seek to change is that which was referenced above as being a "run-time" determination made by a device as it loads/prepares to play that file data. (I.e., to change the signaling from "Implicit" to "Explicit" you will also have to specify the Audio Format List Item reference, as well as, the Format ID as "aach" for correct device software decode execution which implies you'll need to access/modify these parameters after storage is allocated to the device.)


If you are interested, you might want to also read this article on HE-AAC. Not sure what your final goal is for posting here. If it was to find out why the file didn't play, I hope this response helps. If you just want to play Fraunhofer FKD encoded files natively, then use an FKD compatible app like VLC. If to play HE-AAC files natively in QTX, then use a Core Audio compatible encoder such as HandBrake (limited to 32-80Kbps range) or an Apps Store app like To M4A Converter (avoid lowest 16Kbps setting as stereo played incorrectly on my system). If you want to play files natively in the QT7 Player, then avoid HE-AAC v2 encodings since none of the files I created played correctly in QT7 for me under High Sierra.

User uploaded file

CoreAudio and implicit HE-AAC

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.