Opened 4 years ago

Last modified 4 years ago

#9139 new defect

FFmpeg drops the first frame of video files trimmed in Quicktime 7.

Reported by: aymv Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
FFmpeg drops the first frame of video files trimmed in Quicktime 7.
QuickTime_Player start input.mov from this frame:
https://ibb.co/Hp2HFR6
But after ffmpeg conversation it looks like this:
https://ibb.co/kMz65Fh
Looks like a problem with elst/media_time and how ffmpeg interprets this:

  1. In QuickTime_File_Format_Specification media_time is DT value.
    The edit list atom provides the initial DT value if it is nonempty (nonzero).
    
  2. In ISO IEC 14496-12 media_time is CT value.
    The Edit List Box provides the initial CT value if it is non‐empty (non‐zero).
    

From the code we can see that the second variant is used in ffmpeg, but then what about the existing media_time (it is set not to a specific PTS of frame, but in the middle) in attached file and how to interpret the next note (ISO IEC 14496-12):

Edits are not restricted to fall on sample times. This means that when entering an edit, it can be necessary to (a) back up to  a  sync point,  and pre‐roll from there  and then (b) be careful about the duration of the first sample — it might have been truncated if the edit enters it during its normal duration. If this is audio, that frame might need to be decoded, and then the final slicing done. Likewise, the duration of the last sample in an edit might need slicing.

How to reproduce:

% ffmpeg -i input.mov output.mp4
ffmpeg version - any, last tested - 4.3.2
built on 2021-02-27

Attachments (5)

input.mov (2.2 MB ) - added by aymv 4 years ago.
Video file to reproduce the problem
ffmpeg-console-output.txt (666.2 KB ) - added by aymv 4 years ago.
Console output
ffmpeg-20210305-111903.log (235.5 KB ) - added by aymv 4 years ago.
Report log
input-mov.png (1.3 MB ) - added by Carl Eugen Hoyos 4 years ago.
output-mp4.png (1.1 MB ) - added by Carl Eugen Hoyos 4 years ago.

Change History (7)

by aymv, 4 years ago

Attachment: input.mov added

Video file to reproduce the problem

by aymv, 4 years ago

Attachment: ffmpeg-console-output.txt added

Console output

by aymv, 4 years ago

Attachment: ffmpeg-20210305-111903.log added

Report log

comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: quicktime removed

Is the issue reproducible with current FFmpeg git head, the only version supported here?

by Carl Eugen Hoyos, 4 years ago

Attachment: input-mov.png added

by Carl Eugen Hoyos, 4 years ago

Attachment: output-mp4.png added

in reply to:  1 comment:2 by aymv, 4 years ago

Replying to cehoyos:

Is the issue reproducible with current FFmpeg git head, the only version supported here?

Yes.

Last edited 4 years ago by aymv (previous) (diff)
Note: See TracTickets for help on using tickets.