[FFmpeg-user] Problems configuring AAC decoder.

Brant Merryman brant at mac.com
Sun Apr 6 07:15:02 CEST 2014

Hi. I'm trying configure an AAC codec to decode raw AAC audio frames. I opened the codec using aacDecoder_Open(TT_MP4_RAW, 1); Next, I want to configure it. These audio frames are being sent in a custom (non-standard) transport stream. The transport stream tells me a lot of details about itself including what kind of audio is being sent, the sample rate, the number of channels, and so forth.

I need to call aacDecoder_ConfigRaw to set the codec for decoding these frames. According to the documentation I found, the second argument is a Audio Specific Config (ASC). I was able to find the following two pages about the Audio Specific Config:


According to this, the Audio Specific Config consists of:

5 bits: object type
4 bits: frequency index
4 bits: channel configuration

In the stream I'm testing with right now, it has two channels and a sample rate of 44100.

So, if I set object_type to AAC_Main which is 1, and the frequency index to 4 which is 44100, and channels to 2, I use the following to get a value:
UInt16 audio_specific = (object_type << 11) | (frequency_index << 7)| (number_of_channels << 3);

audio_specific is 0xA10 (2576 decimal).

Then I make the following call to aacDecoder_ConfigRaw:

UCHAR asc[2];
memcpy(&audio_specific, &asc, sizeof(asc));

UCHAR a_s_conf[] = { asc[0], asc[1] };
UCHAR * conf[] = { a_s_conf };
UINT conf_len = sizeof(a_s_conf);                    
AAC_DECODER_ERROR dec_err = aacDecoder_ConfigRaw(m_AAC_decoder, conf, &conf_len );

At this point, dec_err is AAC_DEC_UNSUPPORTED_FORMAT.

What am I doing wrong? Is it the way that I am formatting the Audio Specific Config - or the way that I'm feeding it into the call?


More information about the ffmpeg-user mailing list