diff --git a/docs/configuration.rst b/docs/configuration.rst index 88289cc0..d693b336 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -911,11 +911,20 @@ Default ``"ffmpeg"`` Description Location of the ``ffmpeg`` (or ``avconv``) executable to use. =========== ===== + +ugoira.ffmpeg-output +-------------------- +=========== ===== +Type ``bool`` +Default ``true`` +Description Show FFmpeg output. +=========== ===== + ugoira.ffmpeg-twopass --------------------- =========== ===== Type ``bool`` -Default ``False`` +Default ``false`` Description Enable Two-Pass encoding. =========== ===== diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index 3913d0ac..d91f1e6b 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -23,7 +23,8 @@ class UgoiraPP(PostProcessor): PostProcessor.__init__(self) self.extension = options.get("extension") or "webm" self.args = options.get("ffmpeg-args") - self.twopass = options.get("ffmpeg-twopass") + self.twopass = options.get("ffmpeg-twopass", False) + self.output = options.get("ffmpeg-output", True) self.delete = not options.get("keep-files", False) ffmpeg = options.get("ffmpeg-location") @@ -79,19 +80,22 @@ class UgoiraPP(PostProcessor): if self.twopass: if "-f" not in args: args += ["-f", self.extension] - null = "NUL" if os.name == "nt" else "/dev/null" args += ["-passlogfile", tempdir + "/ffmpeg2pass", "-pass"] - subprocess.Popen(args + ["1", "-y", null]).wait() - subprocess.Popen(args + ["2", pathfmt.realpath]).wait() + self._exec(args + ["1", "-y", os.devnull]) + self._exec(args + ["2", pathfmt.realpath]) else: args.append(pathfmt.realpath) - subprocess.Popen(args).wait() + self._exec(args) if self.delete: pathfmt.delete = True else: pathfmt.set_extension("zip") + def _exec(self, args): + out = None if self.output else subprocess.DEVNULL + return subprocess.Popen(args, stdout=out, stderr=out).wait() + @staticmethod def calculate_framerate(framelist): counter = collections.Counter(frame["delay"] for frame in framelist)