cameraShot特效及旋转
This commit is contained in:
parent
4549b0ab44
commit
94373cee72
@ -185,22 +185,36 @@ class FfmpegTask(object):
|
|||||||
if effect.startswith("cameraShot:"):
|
if effect.startswith("cameraShot:"):
|
||||||
param = effect.split(":", 2)[1]
|
param = effect.split(":", 2)[1]
|
||||||
if param == '':
|
if param == '':
|
||||||
param = "3,1"
|
param = "3,1,0"
|
||||||
_split = param.split(",")
|
_split = param.split(",")
|
||||||
start = 3
|
start = 3
|
||||||
duration = 1
|
duration = 1
|
||||||
|
rotate_deg = 0
|
||||||
|
if len(_split) >= 3:
|
||||||
|
if _split[2] == '':
|
||||||
|
rotate_deg = 0
|
||||||
|
else:
|
||||||
|
rotate_deg = int(_split[2])
|
||||||
if len(_split) >= 2:
|
if len(_split) >= 2:
|
||||||
start = int(_split[0])
|
duration = float(_split[1])
|
||||||
duration = int(_split[1])
|
if len(_split) >= 1:
|
||||||
elif len(_split) == 1:
|
start = float(_split[0])
|
||||||
start = int(_split[0])
|
|
||||||
_start_out_str = "[eff_s]"
|
_start_out_str = "[eff_s]"
|
||||||
|
_mid_out_str = "[eff_m]"
|
||||||
_end_out_str = "[eff_e]"
|
_end_out_str = "[eff_e]"
|
||||||
filter_args.append(f"{video_output_str}fps=fps={self.frame_rate},split{_start_out_str}{_end_out_str}")
|
filter_args.append(f"{video_output_str}split=3{_start_out_str}{_mid_out_str}{_end_out_str}")
|
||||||
filter_args.append(f"{_start_out_str}trim=start={0}:end={start+duration},freezeframes=first={start*self.frame_rate}:replace={start*self.frame_rate}{_start_out_str}")
|
filter_args.append(f"{video_output_str}[0:v]select=lt(n\,{int(start*self.frame_rate)}){_start_out_str}")
|
||||||
filter_args.append(f"{_end_out_str}trim=start={start}{_end_out_str}")
|
filter_args.append(f"{video_output_str}[0:v]select=gt(n\,{int(start*self.frame_rate)}){_end_out_str}")
|
||||||
|
filter_args.append(f"{video_output_str}[0:v]select=eq(n\,{int(start*self.frame_rate)}){_mid_out_str}")
|
||||||
|
filter_args.append(f"{_mid_out_str}tpad=start_mode=clone:start_duration={duration:.4f}{_mid_out_str}")
|
||||||
|
if rotate_deg != 0:
|
||||||
|
filter_args.append(f"{_mid_out_str}rotate=PI*{rotate_deg}/360{_mid_out_str}")
|
||||||
|
# filter_args.append(f"{video_output_str}trim=start=0:end={start+duration},tpad=stop_mode=clone:stop_duration={duration},setpts=PTS-STARTPTS{_start_out_str}")
|
||||||
|
# filter_args.append(f"tpad=start_mode=clone:start_duration={duration},setpts=PTS-STARTPTS{_start_out_str}")
|
||||||
|
# filter_args.append(f"{_end_out_str}trim=start={start}{_end_out_str}")
|
||||||
video_output_str = "[v_eff]"
|
video_output_str = "[v_eff]"
|
||||||
filter_args.append(f"{_start_out_str}{_end_out_str}concat=n=2:v=1:a=0{video_output_str}")
|
# filter_args.append(f"{_end_out_str}{_start_out_str}overlay=eof_action=pass{video_output_str}")
|
||||||
|
filter_args.append(f"{_start_out_str}{_mid_out_str}{_end_out_str}concat=n=3:v=1:a=0,setpts=N/{self.frame_rate}/TB{video_output_str}")
|
||||||
elif effect.startswith("zoom:"):
|
elif effect.startswith("zoom:"):
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user