[FFmpeg-trac] #9590(avformat:new): FFmpeg-written MP4 fails to be read-back without distortion of PTS/DTS

FFmpeg trac at avcodec.org
Thu Jun 16 13:24:43 EEST 2022

#9590: FFmpeg-written MP4 fails to be read-back without distortion of PTS/DTS
             Reporter:  Ulrik        |                    Owner:  (none)
  Mikaelsson                         |
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avformat
              Version:  unspecified  |               Resolution:
             Keywords:  mov pts DTS  |               Blocked By:
  mp4                                |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
Comment (by Balling):

 So let me get this straight. First 3 frames with their PTS and DTS are
 discarded, so it makes the 4th frame first non-discarded frame (why do you
 need to discard video frames again?) which gets corrected to PTS 0 and
 when correcting it so happens to be DTS 0.

 I have questions. Why discard video? Does it even matter what first PTS is
 if all before are discarded? Also, do you understand what is DTS and PTS?
 DTS are supposed to be from less to bigger always, because that is how you
 parse and decode the hevc /avc stream. PTS is how you then (after
 decoding) present those frames. So it means that after decoding and
 presenting first frame, you decode 2nd, 3rd and 4th and only 4th is
 presented and then 3rd is presented and then 5th decoded and 5th presnted
 and only then 2nd is presented. Okay?

 It is a very common idea that discarded frames do not affect anything. And
 it is wrong. E.g., AAC has 1024 samples that are priming and that are
 discarded. But decoding happens since 1024 frame, its state is then used
 to decode 1025 frame, but 1024 frame is still thrn discarded. You need
 roll metadata to signal that.
Ticket URL: <https://trac.ffmpeg.org/ticket/9590#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list