0
所以基本上,我的代碼應該編輯前15秒,中間15秒和最後15秒的給定目錄中的視頻。我在Python 2.7,我使用的是影片模塊。Python Moviepy模塊:輸出視頻?
import moviepy.editor as mp
from moviepy.editor import *
import os
for item in os.listdir(wildcard):
clip = VideoFileClip(vid + item)
dur = clip.duration
firstHalf = (dur/2.0) - 7.5
secHalf = (dur/2.0) + 7.5
end = dur - 15.0
clip1 = clip.subclip(0, 15.0)
clip2 = clip.subclip(firstHalf, secHalf)
clip3 = clip.subclip(end, int(dur))
video = mp.concatenate([clip1,clip2,clip3])
video.to_videofile(wildcard, fps=24, codec='mpeg4')
但我不斷收到一個錯誤在video = mp.concatenate()行。我不知道爲什麼,但它輸出的信息「Errno 22:無效的論點。」