建议安装1.0.0版本,高版本保存视频有时会没有声音和会报stdout错误
参考:https://www.zhihu.com/question/268046380/answer/720751739
安装moviepy同时也需要安装
brew install imagemagick
brew install ghostscript
windows参考:https://zhuanlan.zhihu.com/p/46341173
from moviepy.editor import *
v1 = VideoFileClip(r'/Users/lonng/Desktop/151-200/任务200: 关系抽取方法介绍.mp4').subclip(1,20)
end1 = TextClip("the end",color='red',fontsize=80).set_duration(v1.duration)
final = CompositeVideoClip([v1,end1])
final.write_videofile('01.mp4',audio_codec='aac')
注意,有的mac电脑保存没声音可以换个播放器或者保存时加上audio_codec='aac’字段
来源:CSDN
作者:初心fly
链接:https://blog.csdn.net/weixin_42357472/article/details/104477624