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.
This commit is contained in:
Clayton Yochum
2023-11-27 02:43:35 -07:00
committed by GitHub
parent e1a218fab1
commit 9641d5f56a

View File

@@ -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)