Skip to content

Commit

Permalink
Force read-mode in av.open
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ClaytonJY authored Nov 16, 2023
1 parent 5a0541e commit 922ecb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion faster_whisper/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 922ecb7

Please sign in to comment.