[postprocessor:ugoira] add 'libx264-prevent-odd' option

A rather crude workaround for "width/height not divisible by 2"
errors when using libx264.
This commit is contained in:
Mike Fährmann
2018-09-21 19:52:45 +02:00
parent 8c8da11bb8
commit 55f5c87160
2 changed files with 30 additions and 4 deletions

View File

@@ -34,6 +34,10 @@ class UgoiraPP(PostProcessor):
if rate != "auto":
self.calculate_framerate = lambda _: (None, rate)
self.prevent_odd = (
options.get("libx264-prevent-odd", True) and
self.extension.lower() in ("mp4", "mkv"))
def run(self, pathfmt):
if pathfmt.keywords["extension"] != "zip":
return
@@ -71,6 +75,8 @@ class UgoiraPP(PostProcessor):
args += ["-i", ffconcat]
if rate_out:
args += ["-r", str(rate_out)]
if self.prevent_odd:
args += ["-vf", "crop=iw-mod(iw\\,2):ih-mod(ih\\,2)"]
if self.args:
args += self.args
self.log.debug("ffmpeg args: %s", args)