Use this python script
#!/bin/python
from sys import argv
from os import system
ffm = 'ffmpeg -i "' # input file
aud = '" -acodec libfaac -aq 64 -ac 2 -ar 44100'
vid = ' -vcodec libx264 -crf 25 -r 25 -subq 9'
c=0
def encode(video,option=''):
global c; c+=1
out = ' "'+ video + str(c) + '.mp4"'
cmd = ffm + video + aud + vid + option + out
print cmd; system(cmd)
def seconds(time):
t = [float(x) for x in time.split(':')]
if len(t)==1: return t[0]
if len(t)==2: return t[1]+t[0]*60
if len(t)==3: return t[2]+t[1]*60+t[0]*3600
def split(time):
(start,end) = [seconds(x) for x in time.split()]
return ' -ss %s -t %s' % (start,end-start)
for slice in argv[2].split(','):
encode(argv[1],split(slice))
# $ python split.py "video.mpg" "1:50 9:10,7:30 15:30,13:30 20:10"
Reading man ffmpeg i saw several accepted formats for -ss and -t
This let you slice with overlap. And can split with miliseconds precision.
$ python split.py "video.mpg" "55:30.356 1:01:10.895"
You have to edit acodec and vcodec with your preferences.
I recommend these options with a libx264 core greater than version 100.