[FFmpeg-devel] [RFC] Non monotonically increasing timestamps

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Mar 21 18:26:36 CET 2011


Hi all,

I'm dealing with files with non-monotonically increasing timestamps,
e.g.:
https://roundup.ffmpeg.org/issue1551

precisely with these files (tipically DVB TS captures), there is are
duplicated DTS values in consecutive video packets.

Follows an example:

$ ffprobe -show_packets  non_monotone_timestamps20091117.ts
...
[PACKET]
codec_type=video
stream_index=0
***pts=6583750012
pts_time=73152.777911 
dts=6583739212
dts_time=73152.657911 
duration=3600
duration_time=0.040000 
size=75597.000000 
pos=11172903
flags=_
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=6583742812
pts_time=73152.697911 
dts=6583742812
dts_time=73152.697911 
duration=3600
duration_time=0.040000 
size=3106.000000 
pos=11257127
flags=_
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=6583746412
pts_time=73152.737911 
dts=6583746412
dts_time=73152.737911 
duration=3600
duration_time=0.040000 
size=3102.000000 
pos=11260699
flags=_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=6583716091
pts_time=73152.401011 
dts=6583716091
dts_time=73152.401011 
duration=0
duration_time=0.000000 
size=5872.000000 
pos=11237199
flags=K
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
***pts=6583750012
pts_time=73152.777911 
***dts=6583750012
dts_time=73152.777911 
duration=1800
duration_time=0.020000 
size=4.000000 
pos=-1
flags=_
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=6583760812
pts_time=73152.897911 
***dts=6583750012
dts_time=73152.777911 
duration=3600
duration_time=0.040000 
size=58301.000000 
pos=11264083
flags=K
[/PACKET]
...

The problem shows up tipically when copying with -vcodec copy, when
transcoding I suppose DTS is recomputed and so it never results in
duplicated DTSs.

So I'm asking if someone can suggest which is a good / the best way to
fix the DTS duplication problem.

A simple solution may consists of simply dropping the packets with the
duplicated DTS, which may result in video corruption (e.g. in the
abovementioned case, where the packet is a key packet), or fix the
dts somehow.

A full-fledged solution may involve the implementation of a
packet-level filtering API (which would be useful also for ffprobe,
e.g. for selecting only particular packets,
e.g. type=A|V|S/stream=X/PTS>X etc.).
-- 
FFmpeg = Formidable and Fiendish Mega Portentous Evanescent Gigant



More information about the ffmpeg-devel mailing list