[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.
This commit is contained in:
Fuyan Yuan 2024-01-03 22:58:08 +08:00
parent 85b33f5c16
commit a0d394e2f6

View File

@ -822,7 +822,7 @@ class FFmpegMergerPP(FFmpegPostProcessor):
def run(self, info): def run(self, info):
filename = info['filepath'] filename = info['filepath']
temp_filename = prepend_extension(filename, 'temp') temp_filename = prepend_extension(filename, 'temp')
args = ['-c', 'copy'] args = ['-c', 'copy', '-copyts']
audio_streams = 0 audio_streams = 0
for (i, fmt) in enumerate(info['requested_formats']): for (i, fmt) in enumerate(info['requested_formats']):
if fmt.get('acodec') != 'none': if fmt.get('acodec') != 'none':