首页 > 解决方案 > 使用moviepy.editor将文本放入视频中会出错

问题描述

我从互联网上的教程中尝试了这段代码

但它没有工作,错误是:

OSError: MoviePy Error: creation of None failed because of the following error:

[WinError 2] The system cannot find the file specified.

.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
PS C:\Users\Oren\Desktop\Movie> 

我不明白我是否应该下载它ImageMagick,我搜索它,但我没有找到。请帮忙。

# Import everything needed to edit video clips
from moviepy.editor import *
    
# loading video dsa gfg intro video
clip = VideoFileClip("cut_2.mp4")
    
# clipping of the video
# getting video for only starting 10 seconds
clip = clip.subclip(0, 10)
    
# Reduce the audio volume (volume x 0.8)
clip = clip.volumex(0.8)
    
# Generate a text clip
txt_clip = TextClip("GeeksforGeeks", fontsize = 75, color = 'black')
    
# setting position of text in the center and duration will be 10 seconds
txt_clip = txt_clip.set_pos('center').set_duration(10)
    
# Overlay the text clip on the first video clip
video = CompositeVideoClip([clip, txt_clip])
    
# showing video
video.ipython_display(width = 280)

标签: pythonmoviepy

解决方案


推荐阅读