From 8c0ae192a42965f318644373d05060e720af79c7 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 9 Aug 2021 02:18:58 +0530 Subject: [PATCH] [ffmpeg] Fix `--ffmpeg-location` when directory is given Bug introduced in 89efdc15dd4dbdb4b51e82647637f33112156f61 Closes #654 --- yt_dlp/postprocessor/ffmpeg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index bf6677239..24466f21c 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -109,7 +109,9 @@ class FFmpegPostProcessor(PostProcessor): 'Continuing without ffmpeg.' % (location)) self._versions = {} return - elif not os.path.isdir(location): + elif os.path.isdir(location): + dirname, basename = location, None + else: basename = os.path.splitext(os.path.basename(location))[0] basename = next((p for p in programs if basename.startswith(p)), 'ffmpeg') dirname = os.path.dirname(os.path.abspath(location)) @@ -118,7 +120,8 @@ class FFmpegPostProcessor(PostProcessor): self._paths = dict( (p, os.path.join(dirname, p)) for p in programs) - self._paths[basename] = location + if basename: + self._paths[basename] = location self._versions = dict( (p, get_ffmpeg_version(self._paths[p])) for p in programs) if self._versions is None: