User:Manetta/scripts/python-csv-to-ffmpeg-subclips

From XPUB & Lens-Based wiki
< User:Manetta
Revision as of 09:23, 24 March 2015 by Manetta (talk | contribs) (Created page with "<source lang="python"> import os import csv with open('bambi-chunks-annotations.csv', 'rb') as f: reader = csv.reader(f) i=0 for row in reader: start = row[1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
import os
import csv

with open('bambi-chunks-annotations.csv', 'rb') as f:
    reader = csv.reader(f)
    i=0
    for row in reader:
    	start = row[1]
    	end = row[2]
        print "this clip starts at "+start+" and ends at "+end
        c = "ffmpeg -i input.mpeg -ss "+start+" -to "+end+" -y subclips/output{0:03d}.mpeg".format(i)
        print c
        os.system(c)
        print i
        i=i+1