aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/postprocessor/ffmpeg.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-07-30 23:47:14 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-07-31 02:20:12 +0530
commit6a7d3a0a0981d05903e70bcb31fc3f9438eedf22 (patch)
tree2ec5b3c9b61c69712e6376863cfca66f9ddb3b11 /yt_dlp/postprocessor/ffmpeg.py
parentc646d76f6717a646dd35f6efad6b396435f9fa55 (diff)
downloadhypervideo-pre-6a7d3a0a0981d05903e70bcb31fc3f9438eedf22.tar.lz
hypervideo-pre-6a7d3a0a0981d05903e70bcb31fc3f9438eedf22.tar.xz
hypervideo-pre-6a7d3a0a0981d05903e70bcb31fc3f9438eedf22.zip
[ffmpeg] Set `ffmpeg_location` in a contextvar
Fixes #2191 for the CLI, but not when used through the API
Diffstat (limited to 'yt_dlp/postprocessor/ffmpeg.py')
-rw-r--r--yt_dlp/postprocessor/ffmpeg.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index c3b9ac7fa..f77ca427e 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -1,4 +1,5 @@
import collections
+import contextvars
import itertools
import json
import os
@@ -81,6 +82,8 @@ class FFmpegPostProcessorError(PostProcessingError):
class FFmpegPostProcessor(PostProcessor):
+ _ffmpeg_location = contextvars.ContextVar('ffmpeg_location', default=None)
+
def __init__(self, downloader=None):
PostProcessor.__init__(self, downloader)
self._prefer_ffmpeg = self.get_param('prefer_ffmpeg', True)
@@ -100,7 +103,7 @@ class FFmpegPostProcessor(PostProcessor):
def _determine_executables(self):
programs = [*self._ffmpeg_to_avconv.keys(), *self._ffmpeg_to_avconv.values()]
- location = self.get_param('ffmpeg_location')
+ location = self.get_param('ffmpeg_location', self._ffmpeg_location.get())
if location is None:
return {p: p for p in programs}