[postprocessor:ugoira] add 'ffmpeg-output' option

pull/133/head
Mike Fährmann 6 years ago
parent 02a4a67f6d
commit 6ecb36d88c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -911,11 +911,20 @@ Default ``"ffmpeg"``
Description Location of the ``ffmpeg`` (or ``avconv``) executable to use. Description Location of the ``ffmpeg`` (or ``avconv``) executable to use.
=========== ===== =========== =====
ugoira.ffmpeg-output
--------------------
=========== =====
Type ``bool``
Default ``true``
Description Show FFmpeg output.
=========== =====
ugoira.ffmpeg-twopass ugoira.ffmpeg-twopass
--------------------- ---------------------
=========== ===== =========== =====
Type ``bool`` Type ``bool``
Default ``False`` Default ``false``
Description Enable Two-Pass encoding. Description Enable Two-Pass encoding.
=========== ===== =========== =====

@ -23,7 +23,8 @@ class UgoiraPP(PostProcessor):
PostProcessor.__init__(self) PostProcessor.__init__(self)
self.extension = options.get("extension") or "webm" self.extension = options.get("extension") or "webm"
self.args = options.get("ffmpeg-args") 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) self.delete = not options.get("keep-files", False)
ffmpeg = options.get("ffmpeg-location") ffmpeg = options.get("ffmpeg-location")
@ -79,19 +80,22 @@ class UgoiraPP(PostProcessor):
if self.twopass: if self.twopass:
if "-f" not in args: if "-f" not in args:
args += ["-f", self.extension] args += ["-f", self.extension]
null = "NUL" if os.name == "nt" else "/dev/null"
args += ["-passlogfile", tempdir + "/ffmpeg2pass", "-pass"] args += ["-passlogfile", tempdir + "/ffmpeg2pass", "-pass"]
subprocess.Popen(args + ["1", "-y", null]).wait() self._exec(args + ["1", "-y", os.devnull])
subprocess.Popen(args + ["2", pathfmt.realpath]).wait() self._exec(args + ["2", pathfmt.realpath])
else: else:
args.append(pathfmt.realpath) args.append(pathfmt.realpath)
subprocess.Popen(args).wait() self._exec(args)
if self.delete: if self.delete:
pathfmt.delete = True pathfmt.delete = True
else: else:
pathfmt.set_extension("zip") 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 @staticmethod
def calculate_framerate(framelist): def calculate_framerate(framelist):
counter = collections.Counter(frame["delay"] for frame in framelist) counter = collections.Counter(frame["delay"] for frame in framelist)

Loading…
Cancel
Save