You've already forked FrameTour-RenderWorker
feat(ffmpeg): 使用 minterpolate 替代 fps 调整视频速度
- 将视频变速功能从直接调整帧率改为使用 minterpolate 滤镜- 通过设置 fps 和 mi_mode 参数实现平滑的视频慢放效果 - 解决了直接调整帧率可能导致的 PTS 冲突问题
This commit is contained in:
@@ -271,10 +271,10 @@ class FfmpegTask(object):
|
||||
if param == '':
|
||||
param = "1"
|
||||
if param != "1":
|
||||
# 视频变速:通过改变帧率实现,避免PTS冲突
|
||||
# 视频变速:使用minterpolate实现,避免PTS冲突
|
||||
effect_index += 1
|
||||
new_fps = self.frame_rate / float(param)
|
||||
filter_args.append(f"{video_output_str}fps={new_fps}[v_eff{effect_index}]")
|
||||
speed_factor = 1.0 / float(param) # 慢放倍数转换为速度因子
|
||||
filter_args.append(f"{video_output_str}minterpolate=fps=25*{speed_factor}:mi_mode=mci[v_eff{effect_index}]")
|
||||
video_output_str = f"[v_eff{effect_index}]"
|
||||
elif effect.startswith("zoom:"):
|
||||
param = effect.split(":", 2)[1]
|
||||
|
Reference in New Issue
Block a user