在拼接视频的时候,可能需要指定视频的时长
修改视频clip的时长
修改时长基于duration属性进行修改,示例代码如下:
from moviepy.editor import *
if __name__ == '__main__':
video = r"sand_beach.mp4"
clip = VideoFileClip(video).without_audio() # without_audio()表示只对画面部分进行处理
print(">>>")
print("fps: ", clip.fps)
print("duration: ", clip.duration)
print("start: ", clip.start)
print("end: ", clip.end)
clip_amend = clip.set_duration(15)
print(">>>")
print("fps: ", clip_amend.fps)
print("duration: ", clip_amend.duration)
print("start: ", clip_amend.start)
print("end: ", clip_amend.end)
clip_amend.write_