mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-09 13:39:40 +00:00
[ffmpeg] Set ffmpeg_location
in a contextvar
Fixes #2191 for the CLI, but not when used through the API
This commit is contained in:
@@ -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}
|
||||
|
||||
|
Reference in New Issue
Block a user