fix melt cmd

This commit is contained in:
j 2014-09-25 16:49:17 +02:00
parent 5b25411a60
commit 4ebd64becf

View file

@ -365,6 +365,7 @@ def melt_frame_cmd(video, frame, position, height=128, info=None):
if not info: if not info:
info = ox.avinfo(video) info = ox.avinfo(video)
fps = float(AspectRatio(info['video'][0]['framerate'])) fps = float(AspectRatio(info['video'][0]['framerate']))
position = int(position * fps)
format = frame.split('.')[-1] format = frame.split('.')[-1]
vcodec = 'mjpeg' if format == 'jpg' else 'png' vcodec = 'mjpeg' if format == 'jpg' else 'png'
cmd = [ cmd = [
@ -372,14 +373,13 @@ def melt_frame_cmd(video, frame, position, height=128, info=None):
'-silent', '-silent',
video, video,
'in=%d' % position, 'out=%d' % position, 'in=%d' % position, 'out=%d' % position,
'-consumer' 'avformat:%s' % frame, '-consumer', 'avformat:%s' % frame,
'vcodec=%s' % vcodec 'vcodec=%s' % vcodec
] ]
if height: if height:
dar = AspectRatio(info['video'][0]['display_aspect_ratio']) dar = AspectRatio(info['video'][0]['display_aspect_ratio'])
width = int(dar * height) width = int(dar * height)
width += width % 2 width += width % 2
position = int(position * fps)
cmd += ['-s', '%sx%s' % (width, height)] cmd += ['-s', '%sx%s' % (width, height)]
return cmd return cmd