我使用的是Python 3.6(而且相当缺乏经验)。我试图在example之后连接电影文件的不同子剪辑。这个想法是将一个移动文件分成3个10秒,然后连接这三个10s子剪辑。这是代码:
from moviepy.editor import VideoFileClip, concatenate_videoclips
clip1 = VideoFileClip("video_file.mp4").subclip(10, 20)
clip2 = VideoFileClip("video_file.mp4").subclip(30, 40)
clip3 = VideoFileClip("video_file.mp4").subclip(50, 60)
final_clip = concatenate_videoclips([clip1, clip2, clip3])
final_clip.write_videofile("video_file_concatenate.mp4")
但是我收到以下错误:
[MoviePy] >>>> Building video F61_p38_tidibi_concatenate.mp4
[MoviePy] Writing audio in F61_p38_tidibi_concatenateTEMP_MPY_wvf_snd.mp3
0%| | 0/662 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/Users/usr/anaconda3/lib/python3.6/site-packages/moviepy/audio/io/ffmpeg_audiowriter.py", line 84, in write_frames
self.proc.stdin.write(frames_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe
它似乎首先正确构建了视频(第1行),但问题在于“写入音频”(第2行)。有什么建议吗?