From a0d394e2f60fd9ff72d6a5f656200abbe94724a7 Mon Sep 17 00:00:00 2001 From: Fuyan Yuan <33221728+TheRainstorm@users.noreply.github.com> Date: Wed, 3 Jan 2024 22:58:08 +0800 Subject: [PATCH] [FFmpegMerger] Fix merger discard input timestamps Some website save video-only and audio-only file with non-zero timestamp. Therefore, when merging them, ffmpeg should keep original timestamp. According to ffmpeg doc: https://ffmpeg.org/ffmpeg.html `-copyts`: Do not process input timestamps, but keep their values without trying to sanitize them. In particular, do not remove the initial start time offset value. --- yt_dlp/postprocessor/ffmpeg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 7c904417ba..82058a4b9d 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -822,7 +822,7 @@ class FFmpegMergerPP(FFmpegPostProcessor): def run(self, info): filename = info['filepath'] temp_filename = prepend_extension(filename, 'temp') - args = ['-c', 'copy'] + args = ['-c', 'copy', '-copyts'] audio_streams = 0 for (i, fmt) in enumerate(info['requested_formats']): if fmt.get('acodec') != 'none':