I'm looking for an open source video editor for windows


in order to cut out some parts of a video. A necessary feature that I'm looking for is to be able to jump forward a few seconds while playing the video (to find where I need to cut it next).

So far, I checked:

  • OpenShot: doesn't have the ability.

  • Shotcut, Avidemux, Kdenlive: it can jump forward, but it stops playing the movie, and I need to press play again, which makes in clunky.


I came up with the following solution. Find the durations using your favorite player. Then, use the following python script that employs ffmpeg:

# Cut out clips from a video given a text file with times, e.g.:
# 0.0-12.20
# 14.28-15.58
# 53.25-53.31
# 54.47-55.05

import sys, re, os
import datetime

fin = "8-01.mp4"
flist = "8-01_cut_out.txt"

def main():
    with open(flist) as f: 
        lines = f.readlines()

    print("Durations to remove:")
    times = ["00:00:00.000"]
    #for line in sys.stdin:
    for line in lines:
        line = line.rstrip()

        reg = re.compile('(\d+)\.(\d+)-(\d+)\.(\d+)')
        m = reg.match(line)
        if not m:
            print("Couldn't find pattern:", line)

        m0, s0, m1, s1 = [int(m.group(i+1)) for i in range(4)]
        t0 = "00:%02d:%02d.000" % (m0, s0)
        t1 = "00:%02d:%02d.000" % (m1, s1)
        print(t0, "...", t1)
        times.extend([t0, t1])
    # append last

    print(">> \nDurations:")
    fclip = open("clip_list.txt", "w")
    for i in range( len(times)//2 ):
        t0 = times[2*i]
        t1 = times[2*i+1]
        fout = "clip%02d.mp4" % i
        dur = datetime.datetime.strptime(t1[:8], "%H:%M:%S") - datetime.datetime.strptime(t0[:8], "%H:%M:%S")
        dur = dur.total_seconds()
        print(">>", fout, t0, "...", t1, "%dsec" % dur)
        if dur == 0:
        fclip.write( "file " + fout + "\n" )

        cmd = "ffmpeg -y -ss %s -i %s -t %d -c copy %s" % (t0, fin, dur, fout)
        print(">>", cmd)
        os.system( cmd )

    print("\n>> Concatenate:")
    cmd = "ffmpeg -y -f concat -i clip_list.txt -c copy out.mp4"
    print(">>", cmd)
    os.system( cmd )

if __name__ == "__main__":
| improve this answer | |
  • I'm a beginner, so apologies if this is obvious in your code, but does datetime handle SMPTE timecode? If not, does your code account for different frame rates? Curious, because I know I've seen python timecode modules on github. Here's one: github.com/eoyilmaz/timecode – Jason Conrad Sep 23 at 3:32
  • The script is given as a suggestion. Feel free to change and use it as you like. – Zohar Levi Sep 23 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.