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

Paul Kendall paul
Fri Apr 24 12:17:47 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.
> 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.

Ok, Ive modified the decoder to a bit stream filter. Basically this was
just cutting out the code that fed the unwrapped stream to FAAD.

I've go a capture of mpeg-ts data that I used previously with the decoder
and I'm wanting to test that the filter is working. So, my question is,
what's the best way to test it?

./ffmpeg -y -absf latm -acodec copy -vn -i input.ts out.aac

I was hoping that this would use the LATM parser, which it does, then
pass that to the bsf, then copy the result to the out.aac file.

Problem is it's not going into the bsf! I get this output if it helps.

FFmpeg version SVN-r18676, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-libfaad --enable-gpl
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.27. 0 / 52.27. 0
  libavformat   52.32. 0 / 52.32. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Apr 24 2009 21:37:42, gcc: 4.3.3
[h264 @ 0x8e3d0d0]number of reference frames exceeds max (probably corrupt 
input), discarding one
    Last message repeated 27 times
[h264 @ 0x8e3d0d0]mmco: unref short failure
[h264 @ 0x8e3d0d0]number of reference frames exceeds max (probably corrupt 
input), discarding one

Seems stream 0 codec frame rate differs from container frame rate: 100.00 
(100/1) -> 50.00 (50/1)
Input #0, mpegts, from 'input.ts':
  Duration: 00:00:13.73, start: 88875.643656, bitrate: 7723 kb/s
  Program 1
    Stream #0.0[0xfa]: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 
tbr, 90k tbn, 100 tbc
    Stream #0.1[0x12c](eng): Audio: 0x0000, 0 channels, s16
    Stream #0.2[0x3fc](eng): Subtitle: dvbsub
[mpeg @ 0x8f4fc90]sample rate not set
Output #0, mpeg, to 't.mpg':
    Stream #0.0(eng): Audio: 0x0000, 0 channels, s16
Stream mapping:
  Stream #0.1 -> #0.0
Could not write header for output file #0 (incorrect codec parameters ?)


More information about the ffmpeg-devel mailing list