[libav-api] Decoding AAC Stream

Attila Kr├╝pl krupl.attila at gmail.com
Sun May 12 10:48:32 CEST 2019

Hi All,

I'm about to decode AAC stream - with the LibAV codec - received from
Mainconcept's AAC encoder.

Basically, the Mainconcept library is doing an encoding on raw media input,
sending it through to my LibAV decoder, where I'm trying to decode it.

My issue is, that I can't decode it the way the decoding example explains (

120-140 byte packets are arriving each time from Mainconcept's encoder and
I'm populating the AVPacket with the contents of the packet's buffer. I've
tried to do it both by parsing and by copying the buffer's content manually
into my AVPacket object. The avcodec_send_packet function succeeds both
way. Upon calling the avcodec_receive_frame function I'm always getting
back the EAGAIN error, no matter how much data I've sent for decoding.

I believe my codec, context and parser have been initialized properly, at
least I did everything the example said. I've also got the packet and the
frame initialized, and i did the same decoding process for video, and
succeeded there.

The only difference is, that I've set certain properties for video decoding
I've found in the context description.

My guess is, that I should be setting some flags or other properties for
the audio codec context too, but I went through a lot of them without
success, and I've got no clue how to continue.

Also there is another difference compared to the example: I'm not reading a
file, but I'm getting the encoded packets in real time, one by one from the
Mainconcept encoder.

Have you got any experience with AAC audio decoding? Can anyone help with
this please?

Many thanks!

Best Regards,


More information about the libav-api mailing list