INNER CODE UNIT · Python

convert_audio_stream_to_wav_file

arnonym/ha-plugins · ha-sip/src/audio.py:19

def convert_audio_stream_to_wav_file(
    stream: bytes,
    input_format: AudioInputFormat,
) -> Optional[str]:
    try:
        with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as wav_file:
            subprocess.run(
                [
                    "ffmpeg",
                    "-y",
                    "-hide_banner",
                    "-loglevel", "error",
                    "-f", input_format,
                    "-i", "pipe:0",
                    wav_file.name,
                ],
                input=stream,
                stderr=subprocess.PIPE,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…