0

So there is a 10 min long .mp4 and I have to cut it in 2 seconds long segments every 10 seconds, then concatenate all 2 sec segments together to get a 2 min long film.

I manage to do that with a loop in python that subprocep ffmpeg, but it's long and ugly (cut, cut cut... and then glue)

Is it a way to do that with just a line in ffmpeg ?

my code in python for cutting sequences :

import subprocess# as sp

ffmpeg = file on disk # on Windows
film_in =  a file name

t_total = 10#min
t_sec = t_total*60

def c_cut(time) :
    cmd = [ffmpeg  , '-i' ,film_in ,'-b:v', '800k' ,'-ss', str(time) , '-t','2' , '-an', film_out]
    return cmd


for tps in range(0, t_sec, 10) :
    film_out = a file name unique for each segment
    command = c_cut(tps)
    subprocess.call(command)
B Pulsart
  • 77
  • 6

0 Answers0