You've already forked FrameTour-RenderWorker
支持zoom_cut
This commit is contained in:
@@ -187,6 +187,32 @@ class FfmpegTask(object):
|
||||
filter_args.append(f"{video_output_str}crop=x={_x}:y=0:w=ih*ih/iw:h=ih[v_cut{effect_index}]")
|
||||
video_output_str = f"[v_cut{effect_index}]"
|
||||
effect_index += 1
|
||||
if self.zoom_cut == 1 and self.resolution:
|
||||
_input = None
|
||||
for input_file in self.input_file:
|
||||
if type(input_file) is str:
|
||||
_input = input_file
|
||||
break
|
||||
elif isinstance(input_file, FfmpegTask):
|
||||
_input = input_file.get_output_file()
|
||||
break
|
||||
if _input:
|
||||
from util.ffmpeg import probe_video_info
|
||||
_iw, _ih, _ = probe_video_info(_input)
|
||||
_w, _h = self.resolution.split('x', 1)
|
||||
pos_json_str = self.ext_data.get('posJson', '{}')
|
||||
pos_json = json.loads(pos_json_str)
|
||||
_v_w = pos_json.get('imgWidth', 1)
|
||||
_v_h = pos_json.get('imgHeight', 1)
|
||||
_f_x = pos_json.get('ltX', 0)
|
||||
_f_x2 = pos_json.get('rbX', 0)
|
||||
_f_y = pos_json.get('ltY', 0)
|
||||
_f_y2 = pos_json.get('rbY', 0)
|
||||
_x = min(max(0, (_f_x + _f_x2) / 2 - int(_w) / 2), _iw - int(_w))
|
||||
_y = min(max(0, (_f_y + _f_y2) / 2 - int(_h) / 2), _ih - int(_h))
|
||||
filter_args.append(f"{video_output_str}crop=x={_x}:y={_y}:w={_w}:h={_h}[vz_cut{effect_index}]")
|
||||
video_output_str = f"[vz_cut{effect_index}]"
|
||||
effect_index += 1
|
||||
for effect in self.effects:
|
||||
if effect.startswith("cameraShot:"):
|
||||
param = effect.split(":", 2)[1]
|
||||
|
Reference in New Issue
Block a user