Best Practice to Python Clip Big Video to Small Video by Start Time and End Time – Python Tutorial

By | September 11, 2019

Big video often need clip to small one to transfer on internet. In this tutorial, we will introduce how to clip video to small one with a start time and end time, which is easy to used. You can learn how to clip by referring to our tutorial.

Install MoviePy

pip install moviepy

Import library

from moviepy.editor import VideoFileClip

Create a VideoFileClip object with video file

video = 'D:\\demo.mp4'
clip = VideoFileClip(video)

Set start time and end time

start_time = '00:01:00' # one minute
end_time = '00:05:00'   # five minute

It means we will clip a big video from its 01:00 — 05:00, which means the new clip video duration is 4 minutes.

Clip video by start time and end time

newclip = clip.subclip(start_time,end_time)

The we will save the new small video to demo-small.mp4, the duration of which is 4 minutes.

Comparing the result.


python video duration example


python clip video examples

From the result, we will find the duration of small video is 4 minutes.