You've already forked FrameTour-RenderWorker
分辨率和裁切
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import json
|
||||
import time
|
||||
import uuid
|
||||
from typing import Any
|
||||
@ -48,6 +49,7 @@ class FfmpegTask(object):
|
||||
_str += f', effects={self.effects}'
|
||||
if self.mute:
|
||||
_str += f', mute={self.mute}'
|
||||
_str += f', center_cut={self.center_cut}'
|
||||
return _str + ')'
|
||||
|
||||
def analyze_input_render_tasks(self):
|
||||
@ -171,11 +173,14 @@ class FfmpegTask(object):
|
||||
elif isinstance(input_file, FfmpegTask):
|
||||
input_args.append(input_file.get_output_file())
|
||||
if self.center_cut == 1:
|
||||
pos_json = self.ext_data.get('posJson', {})
|
||||
pos_json_str = self.ext_data.get('posJson', '{}')
|
||||
pos_json = json.loads(pos_json_str)
|
||||
_v_w = pos_json.get('imgWidth', 1)
|
||||
_f_x = pos_json.get('ltX', 0)
|
||||
_x = f'{float(_f_x/_v_w) :.5f}*iw'
|
||||
filter_args.append(f"[{video_output_str}]crop=x={_x}:y=0:w=ih*ih/iw:h=ih[{video_output_str}]")
|
||||
_f_x2 = pos_json.get('rbX', 0)
|
||||
_x = f'{float((_f_x2 - _f_x)/(2 * _v_w)) :.4f}*iw'
|
||||
filter_args.append(f"{video_output_str}crop=x={_x}:y=0:w=ih*ih/iw:h=ih[v_cut]")
|
||||
video_output_str = "[v_cut]"
|
||||
for effect in self.effects:
|
||||
if effect.startswith("cameraShot:"):
|
||||
param = effect.split(":", 2)[1]
|
||||
@ -200,7 +205,7 @@ class FfmpegTask(object):
|
||||
...
|
||||
...
|
||||
for lut in self.luts:
|
||||
filter_args.append(f"[{video_output_str}]lut3d=file={lut}[{video_output_str}]")
|
||||
filter_args.append(f"{video_output_str}lut3d=file={lut}{video_output_str}")
|
||||
for overlay in self.overlays:
|
||||
input_index = input_args.count("-i")
|
||||
input_args.append("-i")
|
||||
|
Reference in New Issue
Block a user