ffmpeg concat 因 dts 计时错误而失败
ffmpeg concat failing with dts timing error
我有一些视频正在尝试使用 ffmpeg 进行拼接,它们本身都可以正常工作,但尝试使用以下命令进行拼接:
ffmpeg -f concat -safe 0 -fflags flush_packets -fflags discardcorrupt -i ./videos.txt -c copy -an 1.mp4
这不是直播或 mpeg-dash,它只是独立的 mp4,我想加入一个更长的视频。
这只是一连串的错误,如下所示:
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811593, current: 4396274; changing to 72811594. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811594, current: 4396786; changing to 72811595. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811595, current: 4397298; changing to 72811596. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811596, current: 4397810; changing to 72811597. This may result in incorrect timestamps in the output file.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55e9b217ab40] Dropped corrupted packet (stream = 0)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55e9b217ab40] stream 1, offset 0x402a6: partial file
./videos.txt: Invalid data found when processing input
需要说明的是,这些不是 .ts 视频,而是 mp4 视频。
Here's an example of ffprobe from
Metadata:
minor_version : 512
major_brand : isom
compatible_brands: isomiso2avc1mp41
comment : vid:v09044820000brpbed8biap950ufpcr0
encoder : Lavf58.20.100
Duration: 00:00:14.70, start: 0.000000, bitrate: 901 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024 [SAR 1:1 DAR 9:16], 830 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
另一个视频文件
Metadata:
minor_version : 512
major_brand : isom
compatible_brands: isomiso2avc1mp41
comment : vid:v090447e0000bo8lplu9uukrbn9qbupg
encoder : Lavf58.20.100
Duration: 00:00:12.12, start: 0.000000, bitrate: 791 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 576x1024, 718 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
为了获得最佳结果,所有输入必须具有相同的属性。您的帧速率和时间刻度各不相同。使输入 #1 匹配输入 #2 的示例:
ffmpeg -i 2997.mp4 -r 30 -video_track_timescale 1000k -c:a copy 30.mp4
这将消除 Non-monotonous DTS
错误。 Invalid data found when processing input
错误可能无关。
我有一些视频正在尝试使用 ffmpeg 进行拼接,它们本身都可以正常工作,但尝试使用以下命令进行拼接:
ffmpeg -f concat -safe 0 -fflags flush_packets -fflags discardcorrupt -i ./videos.txt -c copy -an 1.mp4
这不是直播或 mpeg-dash,它只是独立的 mp4,我想加入一个更长的视频。
这只是一连串的错误,如下所示:
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811593, current: 4396274; changing to 72811594. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811594, current: 4396786; changing to 72811595. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811595, current: 4397298; changing to 72811596. This may result in incorrect timestamps in the output file.
[mp4 @ 0x5560664a1780] Non-monotonous DTS in output stream 0:0; previous: 72811596, current: 4397810; changing to 72811597. This may result in incorrect timestamps in the output file.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55e9b217ab40] Dropped corrupted packet (stream = 0)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55e9b217ab40] stream 1, offset 0x402a6: partial file
./videos.txt: Invalid data found when processing input
需要说明的是,这些不是 .ts 视频,而是 mp4 视频。
Here's an example of ffprobe from
Metadata:
minor_version : 512
major_brand : isom
compatible_brands: isomiso2avc1mp41
comment : vid:v09044820000brpbed8biap950ufpcr0
encoder : Lavf58.20.100
Duration: 00:00:14.70, start: 0.000000, bitrate: 901 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 576x1024 [SAR 1:1 DAR 9:16], 830 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
另一个视频文件
Metadata:
minor_version : 512
major_brand : isom
compatible_brands: isomiso2avc1mp41
comment : vid:v090447e0000bo8lplu9uukrbn9qbupg
encoder : Lavf58.20.100
Duration: 00:00:12.12, start: 0.000000, bitrate: 791 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 576x1024, 718 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
为了获得最佳结果,所有输入必须具有相同的属性。您的帧速率和时间刻度各不相同。使输入 #1 匹配输入 #2 的示例:
ffmpeg -i 2997.mp4 -r 30 -video_track_timescale 1000k -c:a copy 30.mp4
这将消除 Non-monotonous DTS
错误。 Invalid data found when processing input
错误可能无关。