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:
- In QuickTime_File_Format_Specification media_time is DT value.
The edit list atom provides the initial DT value if it is nonempty (nonzero).
- 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)
Change History (7)
by , 4 years ago
follow-up: 2 comment:1 by , 4 years ago
Keywords: | quicktime removed |
---|
Is the issue reproducible with current FFmpeg git head, the only version supported here?
by , 4 years ago
Attachment: | input-mov.png added |
---|
by , 4 years ago
Attachment: | output-mp4.png added |
---|
comment:2 by , 4 years ago
Replying to cehoyos:
Is the issue reproducible with current FFmpeg git head, the only version supported here?
Yes.
Video file to reproduce the problem