moviepy簡單安裝使用

建議安裝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’字段

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章