#11080: FFmpeg timestamps do not consistently agree with packet timestamps
-------------------------------------+-------------------------------------
             Reporter:  markfilipak  |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by markfilipak):

 * summary:  FFmpeg timestamps do not consistenly agree with packet
     timestamps => FFmpeg timestamps do not consistently agree with packet
     timestamps


Old description:

> {{{
> Summary of the bug:
>
> I made a 4 second clip having 97 actual frames. Physical order is DTS.
> VLC and PowerDVD play the clip perfectly.
> '-f framecrc' & packet analyzer agree: 97 frames, same DTSes & PTSes.
> '-vf showinfo' disagrees: 53 frames, a gap, and duplicates.
> '-show_frames' disagrees: 53 frames, a different gap, and different
> duplicates.
> '-vf showinfo' & '-show_frames' disagree substantially.
> Other effects:
> MPV exhibits a 2 second glitch that matches the gap.
> '-ss' and '-to' exhibit the same sorts of problems.
>
> __packet analyzer__  _____framecrc______  ___showinfo___
> ______show_frames_______
>  (physical order)        (DTS order)       (DTS order)          (DTS
> order)
> ___DTS___ ___PTS___  ___DTS___ ___PTS___  PN ___PTS___    DN ___DTS___
> ___PTS___
> 504133642 504137396  504133642 504137396   0 504137396 I
> 504137396 504148657  504137396 504148657   3 504148657 P
>           504141150  504141150 504141150   1 504141150
> all these PTSes = DTSes - 3 frames
>           504144903  504144903 504144903   2 504144903                 ¦
> 504148657 504156165  504148657 504156165   5 504156165 P   0 504148657
> 504137396 I
>           504152411  504152411 504152411   4 504152411     1 504152411
> 504141150
> 504156165 504167426  504156165 504167426   8 504167426 P   2 504156165
> 504144903
>           504159918  504159918 504159918   6 504159918     3 504159918
> 504148657 P
>           504163672  504163672 504163672   7 504163672     4 504163672
> 504152411
> 504167426 504174933  504167426 504174933  10 504174933 P   5 504167426
> 504156165 P
>           504171180  504171180 504171180   9 504171180     6 504171180
> 504159918
> 504174933 504186195  504174933 504186195  13 504186195 P   7 504174933
> 504163672
>           504178687  504178687 504178687  11 504178687     8 504178687
> 504167426 P?
>           504182441  504182441 504182441  12 504182441     9 504182441
> 504171180
> 504186195 504197456  504186195 504197456  16 504197456 P  10 504186195
> 504174933 P
>           504189948  504189948 504189948  14 504189948    11 504189948
> 504178687
>           504193702  504193702 504193702  15 504193702    12 504193702
> 504182441
> ===== MPV time pauses here momentarily, then jumps 3 frames later =====
> 504197456 504204963  504197456 504204963  18 504204963 P  13 504197456
> 504186195 P
>           504201210  504201210 504201210  17 504201210    14 504201210
> 504189948
> 504204963 504216225  504204963 504216225                  15 504204963
> 504193702
> ===== MPV time jumps from here =====
>           504208717  504208717 504208717  19 504208717    16 504208717
> 504197456 P?
>           504212471  504212471 504212471  20 504212471    17 504212471
> 504201210
> 504216225 504223732  504216225 504223732                  18 504216225
> 504204963 P
>           504219978  504219978 504219978                  19 504219978
> 504208717
> ===================== SPLICE HERE ======================
> 504223731 504227485  504223731 504227485
> 504227485 504234993  504227485 504234993
>           504231239  504231239 504231239
> 504234993 504246254  504234993 504246254
>           504238746  504238746 504238746
>           504242500  504242500 504242500
> 504246254 504257515  504246254 504257515
>           504250008  504250008 504250008
>           504253761  504253761 504253761
> 504257515 504265023  504257515 504265023
>           504261269  504261269 504261269
> 504265023 504276284  504265023 504276284
>           504268776  504268776 504268776
>           504272530  504272530 504272530
> 504276284 504287545  504276284 504287545
>           504280038  504280038 504280038
>           504283791  504283791 504283791
> 504287545 504295053  504287545 504295053
>           504291299  504291299 504291299
> 504295053 504306314  504295053 504306314
>           504298806  504298806 504298806
>           504302560  504302560 504302560
> 504306314 504317575  504306314 504317575
>           504310068  504310068 504310068
>           504313821  504313821 504313821
> 504317575 504325083  504317575 504325083
>           504321329  504321329 504321329
> 504325083 504332590  504325083 504332590
>           504328836  504328836 504328836
> 504332590 504340098  504332590 504340098
>           504336344  504336344 504336344
> 504340098 504347605  504340098 504347605
>           504343851  504343851 504343851
> 504347605 504355113  504347605 504355113
>           504351359  504351359 504351359
> 504355113 504362620  504355113 504362620
>           504358866  504358866 504358866
> 504362620 504370128  504362620 504370128
>           504366374  504366374 504366374
> 504370128 504377635  504370128 504377635
>           504373881  504373881 504373881
> 504377635 504385143  504377635 504385143
>           504381389  504381389 504381389
> 504385143 504396404  504385143 504396404  22 504396404 P  20 504385143
> 504212471
> ===== MPV time jumps to here =====
>           504388896  504388896 504388896
>           504392650  504392650 504392650  21 504392650    21 504392650
> 504392650   --+ best_effort_timestamp
> 504396404 504407665  504396404 504407665  25 504407665    22 504396404
> 504216225 P?  ¦ switches
>           504400158  504400158 504400158  23 504400158 P  23 504400158
> 504396404 P   ¦ from
>           504403911  504403911 504403911  24 504403911    24 504403911
> 504219978     ¦ 'pts'
> 504407665 504418926  504407665 504418926  28 504418926 I  25 504407665
> 504400158     ¦ to
>           504411419  504411419 504411419  26 504411419 I? 26 504411419
> 504223732 I   ¦ 'pkt_dts'
>           504415173  504415173 504415173  27 504415173    27 504415173
> 504403911     ¦ here
> 504418926 504426434  504418926 504426434  30 504426434    28 504418926
> 504407665 I   ¦
>           504422680  504422680 504422680  29 504422680    29 504422680
> 504411419     ¦
> 504426434 504433941  504426434 504433941  32 504433941    30 504426434
> 504415173     ¦
>           504430188  504430188 504430188  31 504430188 P  31 504430188
> 504418926 P   ¦
> 504433941 504445203  504433941 504445203  35 504445203 P  32 504433941
> 504422680     ¦
>           504437695  504437695 504437695  33 504437695 P? 33 504437695
> 504426434 P   ¦
>           504441449  504441449 504441449  34 504441449    34 504441449
> 504430188     ¦
> 504445203 504456464  504445203 504456464  38 504456464 P  35 504445203
> 504433941 P   ¦
>           504448956  504448956 504448956  36 504448956    36 504448956
> 504437695     ¦
>           504452710  504452710 504452710  37 504452710    37 504452710
> 504441449     ¦
> 504456464 504467725  504456464 504467725  41 504467725 P  38 504456464
> 504445203 P   ¦
>           504460218  504460218 504460218  39 504460218    39 504460218
> 504448956     ¦
>           504463971  504463971 504463971  40 504463971    40 504463971
> 504452710     ¦
> 504467725 504475233  504467725 504475233  43 504475233    41 504467725
> 504456464 P   ¦
>           504471479  504471479 504471479  42 504471479    42 504471479
> 504460218     ¦
> 504475233 504486494  504475233 504486494  46 504486494 P  43 504475233
> 504463971     ¦
>           504478986  504478986 504478986  44 504478986 P? 44 504478986
> 504467725 P?  ¦
>           504482740  504482740 504482740  45 504482740    45 504482740
> 504471479     ¦
> 504486494 504497755  504486494 504497755  52 504497755 I  46 504486494
> 504475233 P?  ¦
>           504490248  504490248 504490248  47 504490248    47 504490248
> 504478986     ¦
>           504494001  504494001 504494001  48 504494001    48 504494001
> 504482740   --+
>                        duplicate of 46 -> 49 504486494 P  49 "N/A"
> 504486494 P
>                        duplicate of 47 -> 50 504490248    50 "N/A"
> 504490248
>                        duplicate of 48 -> 51 504494001    51 "N/A"
> 504494001
>                                                           52 "N/A"
> 504497755 I
>
> How to reproduce:
>
> ffmpeg -i Ticket.m2ts -map 0 -copyts -c copy -dn -sn -f framecrc -
> >Ticket.m2ts_framecrc.txt
>
> ffmpeg -copyts -i Ticket.m2ts -map 0:v -vf showinfo -c:v rawvideo -f null
> -muxdelay 0 - 2>Ticket.m2ts_showinfo.txt
>
> ffprobe -sexagesimal -select_streams v -show_frames -of flat -i
> Ticket.m2ts >Ticket.m2ts_show_frames.txt
> [note]
>
> ffmpeg version 2024-05-20-git-127ded5078-full_build-www.gyan.dev
>
> [note] show_frames complains:
> [null @ 000000000488bc40] Application provided invalid, non monotonically
> increasing dts to muxer in stream 0: 134397 >= 134395
> [null @ 000000000488bc40] Application provided invalid, non monotonically
> increasing dts to muxer in stream 0: 134397 >= 134396
> [null @ 000000000488bc40] Application provided invalid, non monotonically
> increasing dts to muxer in stream 0: 134397 >= 134397
>   What 134397 is, is unknown. It is not a DTS or PTS or packet number
> (packet numbers are 0..73599).
>
> }}}

New description:

 {{{
 Summary of the bug:

 I made a 4 second clip having 97 actual frames. Physical order is DTS.
 VLC and PowerDVD play the clip perfectly.
 '-f framecrc' & packet analyzer agree: 97 frames, same DTSes & PTSes.
 '-vf showinfo' disagrees: 53 frames, a gap, and duplicates.
 '-show_frames' disagrees: 53 frames, a different gap, and different
 duplicates.
 '-vf showinfo' & '-show_frames' disagree substantially.
 Other effects:
 MPV exhibits a 2 second glitch that matches the gap.
 '-ss' and '-to' exhibit the same sorts of problems.

 __packet analyzer__  _____framecrc______  ___showinfo___
 ______show_frames_______
  (physical order)        (DTS order)       (DTS order)          (DTS
 order)
 ___DTS___ ___PTS___  ___DTS___ ___PTS___  PN ___PTS___    DN ___DTS___
 ___PTS___
 504133642 504137396  504133642 504137396   0 504137396 I
 504137396 504148657  504137396 504148657   3 504148657 P
           504141150  504141150 504141150   1 504141150                 all
 these PTSes = DTSes - 3 frames
           504144903  504144903 504144903   2 504144903                 ¦
 504148657 504156165  504148657 504156165   5 504156165 P   0 504148657
 504137396 I
           504152411  504152411 504152411   4 504152411     1 504152411
 504141150
 504156165 504167426  504156165 504167426   8 504167426 P   2 504156165
 504144903
           504159918  504159918 504159918   6 504159918     3 504159918
 504148657 P
           504163672  504163672 504163672   7 504163672     4 504163672
 504152411
 504167426 504174933  504167426 504174933  10 504174933 P   5 504167426
 504156165 P
           504171180  504171180 504171180   9 504171180     6 504171180
 504159918
 504174933 504186195  504174933 504186195  13 504186195 P   7 504174933
 504163672
           504178687  504178687 504178687  11 504178687     8 504178687
 504167426 P?
           504182441  504182441 504182441  12 504182441     9 504182441
 504171180
 504186195 504197456  504186195 504197456  16 504197456 P  10 504186195
 504174933 P
           504189948  504189948 504189948  14 504189948    11 504189948
 504178687
           504193702  504193702 504193702  15 504193702    12 504193702
 504182441
 ===== MPV time pauses here momentarily, then jumps 3 frames later =====
 504197456 504204963  504197456 504204963  18 504204963 P  13 504197456
 504186195 P
           504201210  504201210 504201210  17 504201210    14 504201210
 504189948
 504204963 504216225  504204963 504216225                  15 504204963
 504193702
 ===== MPV time jumps from here =====
           504208717  504208717 504208717  19 504208717    16 504208717
 504197456 P?
           504212471  504212471 504212471  20 504212471    17 504212471
 504201210
 504216225 504223732  504216225 504223732                  18 504216225
 504204963 P
           504219978  504219978 504219978                  19 504219978
 504208717
 ===================== SPLICE HERE ======================
 504223731 504227485  504223731 504227485
 504227485 504234993  504227485 504234993
           504231239  504231239 504231239
 504234993 504246254  504234993 504246254
           504238746  504238746 504238746
           504242500  504242500 504242500
 504246254 504257515  504246254 504257515
           504250008  504250008 504250008
           504253761  504253761 504253761
 504257515 504265023  504257515 504265023
           504261269  504261269 504261269
 504265023 504276284  504265023 504276284
           504268776  504268776 504268776
           504272530  504272530 504272530
 504276284 504287545  504276284 504287545
           504280038  504280038 504280038
           504283791  504283791 504283791
 504287545 504295053  504287545 504295053
           504291299  504291299 504291299
 504295053 504306314  504295053 504306314
           504298806  504298806 504298806
           504302560  504302560 504302560
 504306314 504317575  504306314 504317575
           504310068  504310068 504310068
           504313821  504313821 504313821
 504317575 504325083  504317575 504325083
           504321329  504321329 504321329
 504325083 504332590  504325083 504332590
           504328836  504328836 504328836
 504332590 504340098  504332590 504340098
           504336344  504336344 504336344
 504340098 504347605  504340098 504347605
           504343851  504343851 504343851
 504347605 504355113  504347605 504355113
           504351359  504351359 504351359
 504355113 504362620  504355113 504362620
           504358866  504358866 504358866
 504362620 504370128  504362620 504370128
           504366374  504366374 504366374
 504370128 504377635  504370128 504377635
           504373881  504373881 504373881
 504377635 504385143  504377635 504385143
           504381389  504381389 504381389
 504385143 504396404  504385143 504396404  22 504396404 P  20 504385143
 504212471
 ===== MPV time jumps to here =====
           504388896  504388896 504388896
           504392650  504392650 504392650  21 504392650    21 504392650
 504392650   --+ best_effort_timestamp
 504396404 504407665  504396404 504407665  25 504407665    22 504396404
 504216225 P?  ¦ switches
           504400158  504400158 504400158  23 504400158 P  23 504400158
 504396404 P   ¦ from
           504403911  504403911 504403911  24 504403911    24 504403911
 504219978     ¦ 'pts'
 504407665 504418926  504407665 504418926  28 504418926 I  25 504407665
 504400158     ¦ to
           504411419  504411419 504411419  26 504411419 I? 26 504411419
 504223732 I   ¦ 'pkt_dts'
           504415173  504415173 504415173  27 504415173    27 504415173
 504403911     ¦ here
 504418926 504426434  504418926 504426434  30 504426434    28 504418926
 504407665 I   ¦
           504422680  504422680 504422680  29 504422680    29 504422680
 504411419     ¦
 504426434 504433941  504426434 504433941  32 504433941    30 504426434
 504415173     ¦
           504430188  504430188 504430188  31 504430188 P  31 504430188
 504418926 P   ¦
 504433941 504445203  504433941 504445203  35 504445203 P  32 504433941
 504422680     ¦
           504437695  504437695 504437695  33 504437695 P? 33 504437695
 504426434 P   ¦
           504441449  504441449 504441449  34 504441449    34 504441449
 504430188     ¦
 504445203 504456464  504445203 504456464  38 504456464 P  35 504445203
 504433941 P   ¦
           504448956  504448956 504448956  36 504448956    36 504448956
 504437695     ¦
           504452710  504452710 504452710  37 504452710    37 504452710
 504441449     ¦
 504456464 504467725  504456464 504467725  41 504467725 P  38 504456464
 504445203 P   ¦
           504460218  504460218 504460218  39 504460218    39 504460218
 504448956     ¦
           504463971  504463971 504463971  40 504463971    40 504463971
 504452710     ¦
 504467725 504475233  504467725 504475233  43 504475233    41 504467725
 504456464 P   ¦
           504471479  504471479 504471479  42 504471479    42 504471479
 504460218     ¦
 504475233 504486494  504475233 504486494  46 504486494 P  43 504475233
 504463971     ¦
           504478986  504478986 504478986  44 504478986 P? 44 504478986
 504467725 P?  ¦
           504482740  504482740 504482740  45 504482740    45 504482740
 504471479     ¦
 504486494 504497755  504486494 504497755  52 504497755 I  46 504486494
 504475233 P?  ¦
           504490248  504490248 504490248  47 504490248    47 504490248
 504478986     ¦
           504494001  504494001 504494001  48 504494001    48 504494001
 504482740   --+
                        duplicate of 46 -> 49 504486494 P  49 "N/A"
 504486494 P
                        duplicate of 47 -> 50 504490248    50 "N/A"
 504490248
                        duplicate of 48 -> 51 504494001    51 "N/A"
 504494001
                                                           52 "N/A"
 504497755 I

 How to reproduce:

 ffmpeg -i Ticket.m2ts -map 0 -copyts -c copy -dn -sn -f framecrc -
 >Ticket.m2ts_framecrc.txt

 ffmpeg -copyts -i Ticket.m2ts -map 0:v -vf showinfo -c:v rawvideo -f null
 -muxdelay 0 - 2>Ticket.m2ts_showinfo.txt

 ffprobe -sexagesimal -select_streams v -show_frames -of flat -i
 Ticket.m2ts >Ticket.m2ts_show_frames.txt
 [note]

 ffmpeg version 2024-05-20-git-127ded5078-full_build-www.gyan.dev

 [note] show_frames complains:
 [null @ 000000000488bc40] Application provided invalid, non monotonically
 increasing dts to muxer in stream 0: 134397 >= 134395
 [null @ 000000000488bc40] Application provided invalid, non monotonically
 increasing dts to muxer in stream 0: 134397 >= 134396
 [null @ 000000000488bc40] Application provided invalid, non monotonically
 increasing dts to muxer in stream 0: 134397 >= 134397
   What 134397 is, is unknown. It is not a DTS or PTS or packet number
 (packet numbers are 0..73599).

 }}}

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11080#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to