From 70bdf32a88e89c1373f15c0fe3cf915f007fd0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 21 Aug 2023 18:19:53 +0200 Subject: [PATCH] [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" --- docs/configuration.rst | 12 +++++++++--- gallery_dl/postprocessor/ugoira.py | 14 ++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index ce174ab4f9..190ff91a1f 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4872,11 +4872,17 @@ Description ugoira.ffmpeg-output -------------------- Type - ``bool`` + * ``bool`` + * ``string`` Default - ``true`` + ``"error"`` 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 diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index 6d42567b5b..50c4ed3882 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -1,6 +1,6 @@ # -*- 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 # it under the terms of the GNU General Public License version 2 as @@ -32,7 +32,7 @@ def __init__(self, job, options): self.extension = options.get("extension") or "webm" self.args = options.get("ffmpeg-args") or () 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.repeat = options.get("repeat-last-frame", True) self.mtime = options.get("mtime", True) @@ -81,6 +81,12 @@ def __init__(self, job, options): else: 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( {"prepare": self.prepare, "file": self.convert}, options) @@ -120,8 +126,8 @@ def convert(self, pathfmt): pathfmt.build_path() args = self._process(pathfmt, tempdir) - if self.prevent_odd: - args += ("-vf", "crop=iw-mod(iw\\,2):ih-mod(ih\\,2)") + if self.args_pp: + args += self.args_pp if self.args: args += self.args