server side chopping of webm, resulting files have broken index, to get seeking to work they need to be run through mkvmerge once.

This commit is contained in:
j 2010-12-31 17:34:33 +05:30
commit 0b71fa1ef1
2 changed files with 37 additions and 0 deletions

View file

@ -392,3 +392,22 @@ def timeline_strip(item, cuts, info, prefix):
print 'writing', timeline_file
timeline_image.save(timeline_file)
def chop(response, video, start, end):
if end <= start:
return ''
t = end - start
cmd = [
'ffmpeg',
'-y',
'-i', video,
'-ss', '%.3f'%start,
'-t','%.3f'%t,
'-vcodec', 'copy',
'-acodec', 'copy',
'-f', 'webm',
'/dev/stdout'
]
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=open('/dev/null', 'w'))
stdout, stderr = p.communicate()
return stdout