From 9641d5f56ac16b92938928c50f94409a3dce4e56 Mon Sep 17 00:00:00 2001 From: Clayton Yochum Date: Mon, 27 Nov 2023 02:43:35 -0700 Subject: [PATCH] Force read-mode in `av.open` (#566) The `av.open` functions checks input metadata to determine the mode to open with ("r" or "w"). If an input to `decode_audio` is found to be in write-mode, without this change it can't be read. Forcing read mode solves this. --- faster_whisper/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faster_whisper/audio.py b/faster_whisper/audio.py index 4dd8aae..3190619 100644 --- a/faster_whisper/audio.py +++ b/faster_whisper/audio.py @@ -43,7 +43,7 @@ def decode_audio( raw_buffer = io.BytesIO() dtype = None - with av.open(input_file, metadata_errors="ignore") as container: + with av.open(input_file, mode="r", metadata_errors="ignore") as container: frames = container.decode(audio=0) frames = _ignore_invalid_frames(frames) frames = _group_frames(frames, 500000)