import os from moviepy.editor import * def mergevideo(path): L = [] # 访问 video 文件夹 (假设视频都放在这里面) for root, dirs, files in os.walk(path): # 按文件名排序 files.sort() # 遍历所有文件 print (files) for file in files: # 如果后缀名为 .mp4 if os.path.splitext(file)[1] == '.mp4' or os.path.splitext(file)[1] == '.flv': # 拼接成完整路径 filePath = os.path.join(root, file) # 载入视频 video = VideoFileClip(filePath) # 添加到数组 L.append(video) # 拼接视频 final_clip = concatenate_videoclips(L) # 生成目标视频文件 final_clip.write_videofile(path+"\out.mp4", fps=24, threads = 32, remove_temp=True, audio_codec="aac")
Run moviepy code, get a error: [moviepy] module 'sys' has no attribute 'setcheckinterval' check : https://docs.python.org/3.8/library/sys.html#sys.setcheckinterval then we know setcheckinterval funtion doesn't have an effect anymore, so open edit _tqdm.py edit line 68: setcheckinterval --> setswitchinterval ok, it works fine.
发表评论