Suppress the creation of a command window from ffmpeg on Windows
Fix #6038
This commit is contained in:
parent
7f3737fcc2
commit
f9b5cead31
@ -51,6 +51,11 @@ __all__ = (
|
|||||||
'PCMVolumeTransformer',
|
'PCMVolumeTransformer',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if sys.platform != 'win32':
|
||||||
|
CREATE_NO_WINDOW = 0
|
||||||
|
else:
|
||||||
|
CREATE_NO_WINDOW = 0x08000000
|
||||||
|
|
||||||
class AudioSource:
|
class AudioSource:
|
||||||
"""Represents an audio stream.
|
"""Represents an audio stream.
|
||||||
|
|
||||||
@ -136,7 +141,7 @@ class FFmpegAudio(AudioSource):
|
|||||||
def _spawn_process(self, args, **subprocess_kwargs):
|
def _spawn_process(self, args, **subprocess_kwargs):
|
||||||
process = None
|
process = None
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(args, **subprocess_kwargs)
|
process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
executable = args.partition(' ')[0] if isinstance(args, str) else args[0]
|
executable = args.partition(' ')[0] if isinstance(args, str) else args[0]
|
||||||
raise ClientException(executable + ' was not found.') from None
|
raise ClientException(executable + ' was not found.') from None
|
||||||
@ -469,7 +474,7 @@ class FFmpegOpusAudio(FFmpegAudio):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _probe_codec_fallback(source, executable='ffmpeg'):
|
def _probe_codec_fallback(source, executable='ffmpeg'):
|
||||||
args = [executable, '-hide_banner', '-i', source]
|
args = [executable, '-hide_banner', '-i', source]
|
||||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
proc = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
out, _ = proc.communicate(timeout=20)
|
out, _ = proc.communicate(timeout=20)
|
||||||
output = out.decode('utf8')
|
output = out.decode('utf8')
|
||||||
codec = bitrate = None
|
codec = bitrate = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user