Update audio.py (#178)

add '-nostdin' argument
This commit is contained in:
sawadata
2022-09-30 04:34:04 +09:00
committed by GitHub
parent 2b0c2971af
commit deafef05f3

View File

@@ -41,7 +41,7 @@ def load_audio(file: str, sr: int = SAMPLE_RATE):
out, _ = ( out, _ = (
ffmpeg.input(file, threads=0) ffmpeg.input(file, threads=0)
.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr) .output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=sr)
.run(cmd="ffmpeg", capture_stdout=True, capture_stderr=True) .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
) )
except ffmpeg.Error as e: except ffmpeg.Error as e:
raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e