[gst-devel] Parsing AAC stream

Andrzej K. Haczewski ahaczewski at gmail.com
Tue Jul 6 10:42:01 CEST 2010

Hi all,

I'm doing a research project for my company - basically encoding live
av stream to H264+AAC in FLV file, all using GStreamer. Now, the
project is more or less complete, but one thing - AAC parsing.

We're using Coding Technologies aac encoder, which comes as a binary
able to encode audio stream on the fly, spitting out ADTS (mpeg-2 or
mpeg-4), ADIF or raw AAC data. Because it runs as a separate process
it is being pulled in to GStreamer pipeline with filesrc pointing to
named pipe (aka FIFO). This works great except for the muxing part.

FLV has a special tag to hold AAC decoder configuration, aka
AudioSpecificConfig, that is defined in MP4 standard. That config
tells how many channels are there, the sampling rate, etc. The point
is aacparse plugin, while reading these things out of ADTS, doesn't
put them into codec_data field in src caps, and codec_data is what
flvmux requires to properly mux AAC sequence header.

Is the omission of codec_data intentional? Like there is another,
better way to pull codec_data from AAC stream? Or can I make a patch
for aacparse plugin to do just that?

As a sidenote, CT encoder is able to produce HE-AAC, which adds SBR to
stream, and when SBR is in there the AudioSpecificConfig does look a
little different (5 bytes instead of 2 bytes), but there's no SBR
signalling done in ADTS header, so creating ASC with signalled SBR
would require parsing AAC frame, so parsing some of the stream before
setting caps. That's something I don't know how to handle at all, so I
would appreciate any help / hints.

Andrzej Haczewski
Software Engineer
Redefine Sp. z o.o.
Research and Development Department

More information about the gstreamer-devel mailing list