Skip to content

A feature-rich command-line audio/video downloader

[pp/ffmpeg] Fix uncaught error if bad --ffmpeg-location is given (#15104)

bashonly0eed3fe530d6
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 82bc5106a5..14879b358d 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -457,6 +457,8 @@ class FFmpegFD(ExternalFD):
@classmethod
def available(cls, path=None):
+ # TODO: Fix path for ffmpeg
+ # Fixme: This may be wrong when --ffmpeg-location is used
return FFmpegPostProcessor().available
def on_process_started(self, proc, stdin):
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 5c9c0390d9..a850bdd102 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -192,7 +192,10 @@ class FFmpegPostProcessor(PostProcessor):
@property
def available(self):
- return bool(self._ffmpeg_location.get()) or self.basename is not None
+ # If we return that ffmpeg is available, then the basename property *must* be run
+ # (as doing so has side effects), and its value can never be None
+ # See: https://github.com/yt-dlp/yt-dlp/issues/12829
+ return self.basename is not None
@property
def executable(self):