Invalid ADTS sampling_frequency_index and channel_configuration why?

1.6k Views Asked by At

I hope someone can direct me on the right path before I put a lot of time and effort on this. I'm currently trying to parse an AAC+ frame to get information such as number of channels and sample frequency. So it seems that we can simply get this information from the ADTS header but most of the time this information is inaccurate.

So the question is: -Why is this data inaccurate? What is the meaning of the ADTS header channel and sample freq? Should I rely on it? -Should I parse further down the frame to get this information?

FYI, the AAC+ raw data is coming from streaming servers...

Thanks for the help!

1

There are 1 best solutions below

0
On BEST ANSWER

ADTS sample rates and channel counts are for HE-AAC and HE-AACv2 to try to maintain compatibility with LC only decoders. The good news is that it they are inaccurate in a precise manner. HE-AAC will report half the sample rate and HE-AACv2 will always report a mono stream. This is because HE-AAC adds SBR which double the sample rate and HE-AACv2 adds parametric stereo to SBR and PS turning a mono stream into a stereo image. The SBR payload lives inside an AAC fill element which is ignored by an LC only encoder and the PS payload lives inside the SBR payload.

Some decoders assume SBR if the sample rate <= 24kHz and always decode mono streams to stereo to avoid detecting these features up front. In that case the SBR decoder can be run in a pure upsampling mode if SBR data is not found.

@spender see: http://wiki.multimedia.cx/index.php?title=ADTS