about summary refs log tree commit diff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2024-03-03 12:38:00 +0000
committerdirkf <fieldhouse@gmx.net>2024-03-27 13:11:17 +0000
commit21792b88b791b16e3ab0a0fb2e26e5bb8a4e2ff3 (patch)
tree9bba85e51064a62cb17701ad9038ffdd7c2afb79 /youtube_dl/downloader
parentd8f134a664d7be2c10aba44fc2d54a8f7b0542ff (diff)
downloadyoutube-dl-21792b88b791b16e3ab0a0fb2e26e5bb8a4e2ff3.tar.gz
youtube-dl-21792b88b791b16e3ab0a0fb2e26e5bb8a4e2ff3.tar.xz
youtube-dl-21792b88b791b16e3ab0a0fb2e26e5bb8a4e2ff3.zip
[external/FFmpeg] Fix and improve --ffmpeg-location handling
* pass YoutubeDL (FileDownloader) to FFmpegPostProcessor constructor
* consolidate path search in FFmpegPostProcessor
* make availability of FFmpegFD depend on existence of FFmpegPostProcessor
* detect ffmpeg executable on instantiation of FFmpegFD
* resolves #32735
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/external.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py
index f22fa6013..4fbc0f520 100644
--- a/youtube_dl/downloader/external.py
+++ b/youtube_dl/downloader/external.py
@@ -13,7 +13,12 @@ from ..compat import (
     compat_str,
     compat_subprocess_Popen,
 )
-from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
+
+try:
+    from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
+except ImportError:
+    FFmpegPostProcessor = None
+
 from ..utils import (
     cli_option,
     cli_valueless_option,
@@ -362,13 +367,14 @@ class FFmpegFD(ExternalFD):
 
     @classmethod
     def available(cls):
-        return FFmpegPostProcessor().available
+        # actual availability can only be confirmed for an instance
+        return bool(FFmpegPostProcessor)
 
     def _call_downloader(self, tmpfilename, info_dict):
-        url = info_dict['url']
-        ffpp = FFmpegPostProcessor(downloader=self)
+        # `downloader` means the parent `YoutubeDL`
+        ffpp = FFmpegPostProcessor(downloader=self.ydl)
         if not ffpp.available:
-            self.report_error('m3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
+            self.report_error('ffmpeg required for download but no ffmpeg (nor avconv) executable could be found. Please install one.')
             return False
         ffpp.check_version()
 
@@ -397,6 +403,7 @@ class FFmpegFD(ExternalFD):
         # if end_time:
         #     args += ['-t', compat_str(end_time - start_time)]
 
+        url = info_dict['url']
         cookies = self.ydl.cookiejar.get_cookies_for_url(url)
         if cookies:
             args.extend(['-cookies', ''.join(