INNER CODE UNIT · Python
AudioInputFormat
arnonym/ha-plugins · ha-sip/src/audio.py:12
class AudioInputFormat(str, Enum):
MP3 = "mp3"
WAV = "wav"
OGG = "ogg"
FLAC = "flac"
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",