Opened 23 months ago
Last modified 23 months ago
#11200 new enhancement
FFmpeg unintelligently meddled input timestamps during "-c copy"
| Reported by: | hachi | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | Non-monotonic DTS |
| Cc: | MasterQuestionable | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by )
Summary of the bug:
FFmpeg incorrecly alters timestamps, which results in subtitles not displayed when viewing output file:
[sost#0:6/copy @ 0x127e150b0] Non-monotonic DTS; previous: 1268750, current: 150; changing to 1268750. This may result in incorrect timestamps in the output file. [sost#0:6/copy @ 0x127e150b0] Non-monotonic DTS; previous: 1268750, current: 2020; changing to 1268750. This may result in incorrect timestamps in the output file. [sost#0:6/copy @ 0x127e150b0] Non-monotonic DTS; previous: 1268750, current: 5070; changing to 1268750. This may result in incorrect timestamps in the output file.
I have not found an option to preserve original timestamps and bypass this error.
How to reproduce:
% cat input_*.mkv > input.mkv % ffmpeg -i input.mkv -c copy -map 0 output.mkv ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers built with Apple clang version 15.0.0 (clang-1500.3.9.4)
Attachments (7)
Change History (15)
comment:1 by , 23 months ago
comment:3 by , 23 months ago
| Cc: | added |
|---|---|
| Component: | undetermined → avformat |
| Keywords: | Non-monotonic added; Non-monotonous removed |
| Summary: | FFmpeg setting all timestamps to end → FFmpeg unintelligently meddled input timestamps during "-c copy" |
| Type: | defect → enhancement |
| Version: | unspecified → git-master |
͏ Try "-copyts" whatsoever..?
͏ https://trac.ffmpeg.org/ticket/11034#comment:1
͏ Such peculiar timestamps indicated input seemingly broken.
͏ Caution that FFmpeg currently may not handle non-perfectly-valid files in the most sensible way:
͏ https://trac.ffmpeg.org/ticket/11056#comment:18
comment:4 by , 23 months ago
| Keywords: | timestamp removed |
|---|
͏ Also, the "DTS" here likely refers presentation timestamp ("PTS"). (misuse)
͏ Non-monotonic DTS (count in presentation order) is valid involving B-frames.
͏ See also: https://trac.ffmpeg.org/ticket/11055#comment:16
comment:5 by , 23 months ago
"Also, the "DTS" here likely refers presentation timestamp ("PTS"). (misuse)"
Mkv has no DTS. But here it appears that ffmpeg is generating DTS that are wrong. Each next DTS must be strictly bigger than previous one.
by , 23 months ago
| Attachment: | input_01.mkv added |
|---|
by , 23 months ago
| Attachment: | input_02.mkv added |
|---|
by , 23 months ago
| Attachment: | input_03.mkv added |
|---|
comment:6 by , 23 months ago
I have uploaded a 10 seconds mkv split into 3 parts, because of the 2.5M upload limit.
To concatenate the parts simply do:
cat input_*.mkv > input.mkv
comment:7 by , 23 months ago
| Description: | modified (diff) |
|---|
comment:8 by , 23 months ago
͏ "input.mkv" is a blob of attachments... (mostly TTF, subtitles, and metadata)
͏ Same bothersome... https://trac.ffmpeg.org/ticket/10891#comment:5
͏ Anyway, I extracted some of the subtitles best-effort:
by , 23 months ago
by , 23 months ago
͏ I guess this is the one of interest:
͏ Tagged default; also had alike error messages during extraction.
by , 23 months ago
by , 23 months ago
| Attachment: | 0.h265.xml added |
|---|
͏ ffprobe -hide_banner -threads 0 -show_entries "frame" -select_streams v:0 -of "xml" "input.mkv" -o "0.h265.xml"



If needed I can attach a 10MB file to see how subtitles are affected