diff --git a/docs/configuration.rst b/docs/configuration.rst index 8472bac9..303d7a92 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3239,7 +3239,7 @@ ugoira.ffmpeg-demuxer Type ``string`` Default - ``concat`` + ``auto`` Description FFmpeg demuxer to read and process input files with. Possible values are @@ -3247,6 +3247,9 @@ Description * "`image2 `_" (accurate timecodes, not usable on Windows) * "mkvmerge" (accurate timecodes, only WebM or MKV, requires `mkvmerge `__) + `"auto"` will select `mkvmerge` if possible and fall back to `image2` or + `concat` depending on the local operating system. + ugoira.ffmpeg-location ---------------------- diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py index a6157e86..012e199b 100644 --- a/gallery_dl/postprocessor/ugoira.py +++ b/gallery_dl/postprocessor/ugoira.py @@ -43,23 +43,28 @@ class UgoiraPP(PostProcessor): mkvmerge = options.get("mkvmerge-location") self.mkvmerge = util.expand_path(mkvmerge) if mkvmerge else "mkvmerge" - rate = options.get("framerate", "auto") - if rate != "auto": - self.calculate_framerate = lambda _: (None, rate) - demuxer = options.get("ffmpeg-demuxer") - if demuxer == "image2": - self._process = self._process_image2 - self._finalize = None - self.log.debug("using image2 demuxer") - elif demuxer == "mkvmerge": + if demuxer is None or demuxer == "auto": + if self.extension in ("webm", "mkv") and ( + mkvmerge or shutil.which("mkvmerge")): + demuxer = "mkvmerge" + else: + demuxer = "concat" if util.WINDOWS else "image2" + + if demuxer == "mkvmerge": self._process = self._process_mkvmerge self._finalize = self._finalize_mkvmerge - self.log.debug("using image2+mkvmerge demuxer") + elif demuxer == "image2": + self._process = self._process_image2 + self._finalize = None else: self._process = self._process_concat self._finalize = None - self.log.debug("using concat demuxer") + self.log.debug("using %s demuxer", demuxer) + + rate = options.get("framerate", "auto") + if rate != "auto": + self.calculate_framerate = lambda _: (None, rate) if options.get("libx264-prevent-odd", True): # get last video-codec argument