This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
为什么还是报错,有哪位大神知道吗?
from moviepy.editor import VideoFileClip
from moviepy.video.VideoClip import TextClip
from xbot importprint
from typing import *
defadd_subtitles_to_video(video_path, subtitles_path, output_path):
"""
title: 合成视频和字幕文件
description: 将字幕文件添加到视频中,并生成新的视频文件
inputs:
- video_path (file): 视频文件的路径,eg: "path/to/video.mp4"
- subtitles_path (file): 字幕文件的路径,eg: "path/to/subtitles.srt"
- output_path (file): 输出视频文件的路径,eg: "path/to/output.mp4"
outputs:
- None
"""
video = VideoFileClip(video_path)
subtitles = TextClip(subtitles_path, fontsize=24, color='white').set_position(('center', 'bottom')).set_duration(video.duration)
video_with_subtitles = CompositeVideoClip([video, subtitles])
video_with_subtitles.write_videofile(output_path, codec='libx264', audio_codec='aac')
video.close()
video_with_subtitles.close()
本地已经下载了
环境变量也设置了
