[FFmpeg-trac] #6810(avformat:new): Wrong DTS guess when PTS is reordered for the input without DTS (wrong 'Non-monotonous DTS' fixup)

FFmpeg trac at avcodec.org
Mon Nov 6 20:33:38 EET 2017


#6810: Wrong DTS guess when PTS is reordered for the input without DTS (wrong
'Non-monotonous DTS' fixup)
-------------------------------------+-------------------------------------
             Reporter:  perexg       |                     Type:  defect
               Status:  new          |                 Priority:  critical
            Component:  avformat     |                  Version:  git-
             Keywords:  matroska     |  master
  timestamp                          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 A conversion (copy) from matroska to matroska causes sometimes wrong PTS
 output. The input is H264 with re-ordered video frames (from live
 broadcast).

 The error is directly related to "Non-monotonous DTS in output stream"
 fixup. The DTS is wrongly guessed - select_from_pts_buffer() in
 libavformat/utils.c returns wrong DTS.

 Input PTS example (with wrong DTS):

 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22459 pkt_pts_time:22.459
 pkt_dts:22279 pkt_dts_time:22.279
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22359 pkt_pts_time:22.359
 pkt_dts:22359 pkt_dts_time:22.359
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22379 pkt_pts_time:22.379
 pkt_dts:22379 pkt_dts_time:22.379
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22319 pkt_pts_time:22.319
 pkt_dts:22319 pkt_dts_time:22.319
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22339 pkt_pts_time:22.339
 pkt_dts:22339 pkt_dts_time:22.339
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22399 pkt_pts_time:22.399
 pkt_dts:22399 pkt_dts_time:22.399
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:22419 pkt_pts_time:22.419
 pkt_dts:22419 pkt_dts_time:22.419

 For example, the line with pts == dts == 22359 is wrong, dts should be
 22319 here (+40).

 As a consequence, the monotonous DTS check will correct PTS for the last
 DTS, so the value 22319 will be changed to 22379, because of the invalid
 DTS source.

 If you look to trac, I believe that several other bugs are similar to this
 one.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6810>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list