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

Paul Kendall paul
Thu Apr 23 07:47:54 CEST 2009

On Wednesday 22 April 2009 09:30:42 pm David Conrad wrote:
> In general, in ffmpeg parsers split a stream into discrete, correct
> frames/packets without changing the actual bitstream, and maybe do
> some stuff with timestamps. So if you compared the concatenated
> bitstream before and after the parser, it should be the same for all
> of ffmpeg's current parsers (I think, I haven't looked at every parser.)
> I don't know whether you need a parser for latm (it depends on whether
> mpeg-ts is guaranteed to give you the correct packet boundaries). If
> you do need one, the parser you already have should suffice, though
> ideally CODEC_ID_AAC_LATM would not be needed. Either way, the stream
> should have CODEC_ID_AAC after the bitstream filter.
A parser is necessary as mpeg-ts does not guarantee complete LATM packets
in each mpeg-ts packet. In fact from my streams here, none have full LATM 

So, I will change my decoder to a bit stream filter and in there it should
change the codec_id in the AVCodecContext to CODEC_ID_AAC so that the
decoder that is called is the AAC decoder. Obviously is should do this based
on the content of the stream, but lets assume for now it's AAC.

Would this not then cause the next parse (called from an application) to use 
the AAC parser rather than the LATM parser?

> As for extradata handling, the closest example in ffmpeg I can think
> of is H.264, where the decoder can handle both mp4 style (separate
> extradata) and annex B directly, and the h264_mp4toannexb bitstream
> filter converts between the two.


More information about the ffmpeg-devel mailing list