Splitting multiple videos into shorter based on frame count

322 Views Asked by At

I can cut the video based on seconds, for example, I can cut the video from second 0 to second 10 and from second 10 to second 20. But I need to cut the video from frame 0 to frame 250 and from frame 250 to frame 500 because of some error due the counting of second. Does anyone has any idea about this?

Here is the code I use to cut based on seconds:

required_video_file = "H8.avi"

with open("Z:/temp/Letícia/Videos/teste/times.txt") as f:
    times = f.readlines()

times = [x.strip() for x in times] 

for time in times:
    starttime = int(time.split('-')[0])
    endtime = int(time.split("-")[1])
    ffmpeg_extract_subclip(required_video_file, starttime, endtime, targetname=str(times.index(time)+1)+".avi")
0

There are 0 best solutions below