I have videos of length approximately 25 min each and I wish to cut a few seconds from the start using python.
Searching about it, I stumbled upon the moviepy package for python. The problem is, it takes up a lot of time even for a single video. Following is the code snippet I use to cut 7 seconds from the start of a single video. The write process consumes a lot of time. Is there a better way to cut the videos using python?
from moviepy.editor import *
clip = VideoFileClip("video1.mp4").cutout(0, 7)
clip.write_videofile("test.mp4")
Please let me know if I have missed out any details.
Any help is appreciated. Thanks!
t1 and t2 in this code represent the start time and end time for trimming. Video before t1 and after t2 will be omitted.
Try this and tell us if it is faster (if it can, it will extract the video directly using ffmpeg, without decoding and reencoding):
If that doesn't help, have a look at the code
If you are new to moviepy you should follow these steps.
Installation (in your virtualenv) :
After these commands, you have the minimal software requirements.
Usage