check for avconv version and use new command line api if needed (to support Ubuntu 14.04)

This commit is contained in:
j 2014-07-16 11:04:52 +00:00
commit f0a5f5ddb7
3 changed files with 35 additions and 19 deletions

View file

@ -62,6 +62,13 @@ def supported_formats():
'mp4': 'libx264' in stdout and 'libvo_aacenc' in stdout,
}
def avconv_version():
p = subprocess.Popen([AVCONV],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
version = stderr.split(' ')[2].split('-')[0]
return version
def stream(video, target, profile, info, avconv=None):
if not os.path.exists(target):
ox.makedirs(os.path.dirname(target))
@ -198,24 +205,31 @@ def stream(video, target, profile, info, avconv=None):
'-qdiff', '4'
]
'''
video_settings += [
'-vcodec', 'libx264',
'-flags', '+loop+mv4',
'-cmp', '256',
'-partitions', '+parti4x4+parti8x8+partp4x4+partp8x8+partb8x8',
'-me_method', 'hex',
'-subq', '7',
'-trellis', '1',
'-refs', '5',
'-bf', '0',
'-flags2', '+mixed_refs',
'-coder', '0',
'-me_range', '16',
'-sc_threshold', '40',
'-i_qfactor', '0.71',
'-qmin', '10', '-qmax', '51',
'-qdiff', '4'
]
if settings.AVCONV_VERSION >= '9':
video_settings += [
'-vcodec', 'libx264',
'-preset:v', 'medium',
'-profile:v', 'baseline',
]
else:
video_settings += [
'-vcodec', 'libx264',
'-flags', '+loop+mv4',
'-cmp', '256',
'-partitions', '+parti4x4+parti8x8+partp4x4+partp8x8+partb8x8',
'-me_method', 'hex',
'-subq', '7',
'-trellis', '1',
'-refs', '5',
'-bf', '0',
'-flags2', '+mixed_refs',
'-coder', '0',
'-me_range', '16',
'-sc_threshold', '40',
'-i_qfactor', '0.71',
'-qmin', '10', '-qmax', '51',
'-qdiff', '4'
]
else:
video_settings = ['-vn']