1 安装moviepy
pip install moviepy
2 使用movie进行视频剪辑
from moviepy.editor import *
import time
t_start = (0, 1, 20)
t_end = (0, 2, 20)
clip = VideoFileClip('../1-1.mp4').subclip(t_start, t_end)
new_file = str(int(time.time())) + '_subclip.mp4'
clip.write_videofile(new_file)
3 使用movie进行视频拼接
from moviepy.editor import VideoFileClip, concatenate_videoclips
clip1 = VideoFileClip("./8_1.mp4")
clip2 = VideoFileClip("./8_2.mp4")
final_clip = concatenate_videoclips([clip1,clip2])
final_clip.write_videofile("8.mp4")