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:
@@ -43,7 +43,7 @@ def decode_audio(
|
|||||||
raw_buffer = io.BytesIO()
|
raw_buffer = io.BytesIO()
|
||||||
dtype = None
|
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 = container.decode(audio=0)
|
||||||
frames = _ignore_invalid_frames(frames)
|
frames = _ignore_invalid_frames(frames)
|
||||||
frames = _group_frames(frames, 500000)
|
frames = _group_frames(frames, 500000)
|
||||||
|
|||||||
Reference in New Issue
Block a user