尝试传入resolution,不使用scale自适应模板

This commit is contained in:
2025-04-28 14:54:30 +08:00
parent f139fbccd7
commit 1603be9157
3 changed files with 14 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class FfmpegTask(object):
self.mute = True
self.speed = 1
self.frame_rate = 25
self.resolution = None
self.subtitles = []
self.luts = []
self.audios = []
@ -239,7 +240,13 @@ class FfmpegTask(object):
input_index = input_args.count("-i")
input_args.append("-i")
input_args.append(overlay)
filter_args.append(f"{video_output_str}[{input_index}:v]scale=rw:rh[v]")
if self.resolution:
filter_args.append(f"{video_output_str}scale={self.resolution.replace('x', ':')}[v]")
else:
if os.getenv("OLD_FFMPEG"):
filter_args.append(f"{video_output_str}[{input_index}:v]scale2ref=iw:ih[v]")
else:
filter_args.append(f"{video_output_str}[{input_index}:v]scale=rw:rh[v]")
filter_args.append(f"[v][{input_index}:v]overlay=1:eof_action=endall[v]")
video_output_str = "[v]"
for subtitle in self.subtitles: