From 74d97e6c6b8b87ff96619cf71aefea872f5d07d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 26 May 2021 02:26:26 +0200 Subject: [PATCH] [postprocessor:ugoira] add 'repeat-last-frame' option (#1550) --- docs/configuration.rst | 11 +++++++++++ gallery_dl/postprocessor/ugoira.py | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 8006d989..54eca6b4 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2584,6 +2584,17 @@ Description to reduce an odd width/height by 1 pixel and make them even. +ugoira.repeat-last-frame +------------------------ +Type + ``bool`` +Default + ``true`` +Description + Allow repeating the last frame when necessary + to prevent it from only being displayed for a very short amount of time. + + zip.compression --------------- Type diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index 86d0f620..8960f8ce 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -36,8 +36,11 @@ class UgoiraPP(PostProcessor): if options.get("ffmpeg-demuxer") == "concat": self._process = self._concat + self.repeat = (options.get("repeat-last-frame", True) and + self.extension != "gif") else: self._process = self._image2 + self.repeat = False if options.get("libx264-prevent-odd", True): # get last video-codec argument @@ -123,9 +126,7 @@ class UgoiraPP(PostProcessor): for frame in self._frames: file.write("file '{}'\n".format(frame["file"])) file.write("duration {}\n".format(frame["delay"] / 1000)) - if self.extension != "gif": - # repeat the last frame to prevent it from only being - # displayed for a very short amount of time + if self.repeat: file.write("file '{}'\n".format(frame["file"])) rate_in, rate_out = self.calculate_framerate(self._frames)