fix avconv video generation

This commit is contained in:
Adrien Beudin 2016-05-18 18:33:53 +02:00
parent 8ae1474a8c
commit f8c65731e9

View File

@ -30,7 +30,6 @@ SETTINGS = {
"format": "webm", "format": "webm",
"resolution": "1280x720", "resolution": "1280x720",
"bitrate": "3900k", "bitrate": "3900k",
"preselect": "libvpx-720p"
} }
} }
@ -63,7 +62,6 @@ class Video(object):
"target": target, "target": target,
"loglevel": "-loglevel %s" % options["loglevel"], "loglevel": "-loglevel %s" % options["loglevel"],
"resolution": "-s %s" % options["resolution"], "resolution": "-s %s" % options["resolution"],
"preselect": "-pre %s" % options["preselect"],
"resize": "-vf scale=-1:%s" % options.get("resize"), "resize": "-vf scale=-1:%s" % options.get("resize"),
"bitrate": "-b %s" % options["bitrate"], "bitrate": "-b %s" % options["bitrate"],
"format": "-f %s" % options["format"], "format": "-f %s" % options["format"],
@ -76,12 +74,9 @@ class Video(object):
command = "{binary} {loglevel} -i {source} {resize} -vframes 1 -y {target}".format(**ffmpeg_switches) command = "{binary} {loglevel} -i {source} {resize} -vframes 1 -y {target}".format(**ffmpeg_switches)
error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"]) error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"])
else: else:
command = "{binary} {loglevel} -i {source} {resolution} {preselect} {bitrate} -pass 1 -an {format} -y {target}".format(**ffmpeg_switches) command = "{binary} {loglevel} -i {source} -c:v libvpx {bitrate} -qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k -c:a libvorbis -b:a 100k {resolution} {format} -y {target}".format(**ffmpeg_switches)
command2 = "{binary} {loglevel} -i {source} {resolution} {preselect} {bitrate} -pass 2 -acodec libvorbis -ab 100k {format} -y {target}".format(**ffmpeg_switches)
print(command) print(command)
error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"]) error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"])
print(command2)
error(os.system(command2) == 0, "%s command failed" % ffmpeg_switches["binary"])
CACHE.cache_picture(source, target, options) CACHE.cache_picture(source, target, options)