[FFmpeg-devel] Bugreport: mpegts-demuxer gives wrong pts/dts with avchd files

Thorsten Jordan tjordan
Thu Feb 14 10:32:40 CET 2008


i just stumbled over misbehvaiour of the mpegts-demuxer of ffmpeg. I
have some avchd files here (.mts) which are just transport stream files
with 4 extra bytes before each packet. Video format is h.264 with PAFF
coding. Plays nice with some sync issues, caused by wrong timestamps.

The problem is that normally h.264 in TS has one timestamp per access
unit or per frame/field. "normally" means DVB sources. Some TV stations
code the same timestamp for both fields of a frame, others code + 1/2
frame duration.

But for avchd only every second field, the top field of each frame, has
a timestamp. The material has AUDs per field, the timestamps are right
before the AUDs, all ok.

However the mpegts demuxer delivers wrong values here, non-monotonous
DTS! In contrast it works ok with DVB/Paff material where each field has

As example some field sizes and pts/dts values how its stored and how
the demuxer reports it

field length    pts
186221          54171
40974           --
5353            46971
11050           --
24266           50571
17645           --
26668           64971
34917           --

and what libavformat reports

field length pts    dts
186221       54171  43371
40974        46971  46971
5353         50571  50571
11050        54171  54171
24266        50571  50571
17645        54171  54171
26668        64971  54171
34917        57771  57771

frame duration is 3600 (PAL)

it seems DTS is increased for every field by 3600, and sometimes reset
to values coded in the stream. Obviously it is non monotonous.

Is there any interest in this? example file?

Who maintains the mpegts demuxer?

Greetings, Thorsten

More information about the ffmpeg-devel mailing list