Googling for "python library to edit video file" lead me right back to SO:
In addition to getting this kind of functionality from a library, I often use a system call (os.system or subprocess) to call mencoder or ffmpeg. You could write a function to do this, in pythonesque pseudo code:
def getVideoChunk(filepath, timerange, outputfile):
retcode = systemcall("ffmpeg %s %s", filepath, timerange, outputfile)
return retcode
Ofcourse you need to choose a way of running tge systemcall and you need to learn some ffmpeg syntax.
EDIT (based on comments) Assuming the syntax of mmpeg is like:
ffmpeg -i input.mpg -sameq -ss 00:02:00 -t 00:02:00 output.mpg
The call would look like:
getVideoChunk("input.mpg", "00:02:00", "output.mpg")
and the system call bit would look like (note I use os.system):
os.system("ffmpeg -i %s -sameq -ss %s -t %s %s" % (filepath, timerange, timerange, outputfile))
note that this code is also pseuodo python code and I have not tested it...the code is purely instructional.