[FFmpeg-devel] [PATCH] LATM Parser & LATM/AAC Decoder

Paul Kendall paul
Wed Apr 22 10:58:55 CEST 2009

On Wednesday 22 April 2009 08:40:49 pm Robert Swain wrote:
> Paul Kendall wrote:
> > On Wednesday 22 April 2009 06:08:35 pm David Conrad wrote:
> >>
> >> Make an AVBitStreamFilter or AVParser (bitstream filter is probably
> >> more appropriate) that takes LATM wrapped AAC and extracts a raw AAC
> >> bitstream, then add a way to get it to automatically use it in the ts
> >> demuxer. Then the standard mechanisms (-codec for ffmpeg) will allow
> >> choosing between multiple plain AAC decoders. As an added plus, this
> >> won't horribly break codec copy.
> >
> > Using a bitstream filter is a good idea.
> >
> >>From what I understand, you need a parser, which then has a split which
> >
> > extracts the extradata (used by an AAC decoder to figure out the channels
> > and sampling frequency etc). Then a bitstream filter (which has all the
> > same code as split!) to remove the LATM and leave the raw AAC from the
> > stream.
> >
> > If I'm wrong here, please correct me and I'll consider doing it this way
> > if it's the preferred method.
> David's description is spot on. An LATM bitstream filter should parse
> anything necessary from the LATM bitstream and reformat anything such
> that the AAC (or other, but that can be extended later, I'm just
> speaking generically) payload is formatted correctly for the decoder.
> I'm not really sure what you mean about a parser versus a bitstream filter.

I think I'm a bit confuzzled here too.

So the plan is no parser, use a bitstream filter to extract extradata (for
channels & sample freq) and the AAC raw data. I know that the ffmpeg libfaad 
decoder can use extradata to configure the faad2 decoder. You can then select
the decoder using the -codec option to ffmpeg or ffplay.

The last hurdle then is to "somehow" get mpegts so automagically install the
LATM bitstream filter in the chain.

I think I'm confused because I thought you would need a parser to packetize
the LATM stream and earlier (a long time ago) Micheal mentioned that a
split method (in the parser) would be used to extract the extradata for
configuring the decoder. So, if we had a parser then mpegts would need to
select the parser, LATM, install the bitstream filter, somehow, then we'd have
to redirect the raw data to the correct decoder, either ffaac or libfaad.

Phew, what's the right way? Obviously there are some missing pieces, either
in my understanding or in ffmpeg, either way I am ready & willing to help.

> >>> This also means that the LATM support needs to be built into the
> >>> ffmpeg
> >>> AAC decoder.
> >>
> >> Why would any AAC decoder need to know anything about LATM?
> >
> > The only reason is that the only use of LATM that I have seen in the wild
> > is for digital terrestrial TV with AAC data in it!
> That's not a necessity. That just possibly makes part of the work easier
> to hack in. :) We don't like hacks.

Sure, I don't like hacks either :-)

> Thanks for your effort on LATM.
Happy to help.

> Regards, Rob


More information about the ffmpeg-devel mailing list