1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[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"
This commit is contained in:
Mike Fährmann 2023-08-21 18:19:53 +02:00
parent 8dceea3384
commit 70bdf32a88
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 19 additions and 7 deletions

View File

@ -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

View File

@ -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 @@ class UgoiraPP(PostProcessor):
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 @@ class UgoiraPP(PostProcessor):
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 @@ class UgoiraPP(PostProcessor):
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