[pp:ugoira] extend 'ffmpeg-output' (#4421)

- when setting this option to a string value,
  pass -hide-banner and -loglevel to FFmpeg
- change default to "error"
pull/4489/head
Mike Fährmann 1 year ago
parent 8dceea3384
commit 70bdf32a88
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -4872,11 +4872,17 @@ Description
ugoira.ffmpeg-output ugoira.ffmpeg-output
-------------------- --------------------
Type Type
``bool`` * ``bool``
* ``string``
Default Default
``true`` ``"error"``
Description Description
Show FFmpeg output. Controls FFmpeg output.
* ``true``: Enable FFmpeg output
* ``false``: Disable all FFmpeg output
* any ``string``: Pass ``-hide_banner`` and ``-loglevel``
with this value as argument to FFmpeg
ugoira.ffmpeg-twopass ugoira.ffmpeg-twopass

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2018-2022 Mike Fährmann # Copyright 2018-2023 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -32,7 +32,7 @@ class UgoiraPP(PostProcessor):
self.extension = options.get("extension") or "webm" self.extension = options.get("extension") or "webm"
self.args = options.get("ffmpeg-args") or () self.args = options.get("ffmpeg-args") or ()
self.twopass = options.get("ffmpeg-twopass", False) self.twopass = options.get("ffmpeg-twopass", False)
self.output = options.get("ffmpeg-output", True) self.output = options.get("ffmpeg-output", "error")
self.delete = not options.get("keep-files", False) self.delete = not options.get("keep-files", False)
self.repeat = options.get("repeat-last-frame", True) self.repeat = options.get("repeat-last-frame", True)
self.mtime = options.get("mtime", True) self.mtime = options.get("mtime", True)
@ -81,6 +81,12 @@ class UgoiraPP(PostProcessor):
else: else:
self.prevent_odd = False self.prevent_odd = False
self.args_pp = args = []
if isinstance(self.output, str):
args += ("-hide_banner", "-loglevel", self.output)
if self.prevent_odd:
args += ("-vf", "crop=iw-mod(iw\\,2):ih-mod(ih\\,2)")
job.register_hooks( job.register_hooks(
{"prepare": self.prepare, "file": self.convert}, options) {"prepare": self.prepare, "file": self.convert}, options)
@ -120,8 +126,8 @@ class UgoiraPP(PostProcessor):
pathfmt.build_path() pathfmt.build_path()
args = self._process(pathfmt, tempdir) args = self._process(pathfmt, tempdir)
if self.prevent_odd: if self.args_pp:
args += ("-vf", "crop=iw-mod(iw\\,2):ih-mod(ih\\,2)") args += self.args_pp
if self.args: if self.args:
args += self.args args += self.args

Loading…
Cancel
Save