HydrogenAudio

Lossy Audio Compression => AAC => AAC - General => Topic started by: jrmymllr on 2020-05-18 18:03:09

Title: AAC decoder generating mono stream instead of stereo
Post by: jrmymllr on 2020-05-18 18:03:09
I'm using the Helix AAC decoder  (https://hydrogenaud.io/index.php?topic=32051.0) in a streaming player project and noticed that higher bitrate streams (e.g. 128K) are in stereo, but the lower bitrate streams (e.g. 64 or 48K) are decoding to mono. I always thought these lower bitrate streams were truly in mono, until I tried the same stream in Winamp and noticed that's decoding to stereo.

And tried in VLC, and that's also stereo. I'm good with electronics and firmware, but I'm lost on this one. AAC confuses me and someone who knows more about it might have some explanation. Like for example, you have to have this feature to decode to stereo, etc.

 This decoder has SBR, so I tried enabling that. It doubled my output sample rate, but it's still in mono. Anyone know more?
Title: Re: AAC decoder generating mono stream instead of stereo
Post by: celona on 2020-05-18 18:34:59
There are different versions of the AAC encoder, some store a mono signal even at half sampling frequency and then integrate the missing information; the decoder can reconstruct even if less faithfully (check 4 letters code aacp and aacf) .
Title: Re: AAC decoder generating mono stream instead of stereo
Post by: kode54 on 2020-05-19 01:36:33
Yes, AAC High Efficiency, v1 downsamples the elementary Low Complexity stream to half the input sample rate, then encodes the information to reconstruct the rest of the frequency spectrum, known as Spectral Band Replication. v2 additionally downmixes the original signal to mono, and uses similar information to reconstruct the stereo image, known as Parametric Stereo.

If your decoder doesn't support these things, you may only get the elementary Low Complexity stream.
Title: Re: AAC decoder generating mono stream instead of stereo
Post by: nu774 on 2020-05-19 05:15:28
Since OP says "streaming", I would assume AAC is encapsulated within something like ADTS.
In ADTS headers, there's no room for SBR/PS codec specific data. Therefore, when HE-AAC (or HE-AACv2) is multiplexed within ADTS, it is always implicit (SBR/PS is not explicitly signaled as present).

Some decoders (for example, ffmpeg) decodes SBR/PS even when they are not explicitly signaled as present. These decoders always look into extension payload in the FIL elements, where SBR/PS data is stored (when they are present).
Others does not.

In other words, not all AAC decoder cannot decode SBR/PS in ADTS, even when the decoder itself supports SBR/PS.
Title: Re: AAC decoder generating mono stream instead of stereo
Post by: jrmymllr on 2020-05-19 15:46:52
Thanks to everyone who replied. This is helpful.

I'm now trying to get FAAD2 to work. Is this generally considered to support all the current AAC standards? It seems to be quite up to date.