Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infer/lib/audio.py: audio2(): av.open(..., "rb"|"wb"): ValueError: mode must be 'r', 'w', or None, got: rb #1915

Open
dimgel opened this issue Mar 23, 2024 · 6 comments
Labels
stale 🪨话题搁置

Comments

@dimgel
Copy link

dimgel commented Mar 23, 2024

Hi. Got error when trying "Model Inference" tab, had to patch subj to get it working:

-   inp = av.open(i, "rb")
-   out = av.open(o, "wb", format=format)
+   inp = av.open(i, "r")
+   out = av.open(o, "w", format=format)

It was just a guess. I don't know python, couldn't find API docs nor what "b" means. "Binary"? Ha, can it also process text files? :)

Also hit #1155 on first run, 1st comment there helped. Didn't try anything else yet.

ArtixLinux, python 3.11.8, ffmpeg 6.1.1 & 4.4.4, nvidia blob.

@WuYuZh17
Copy link

I meet that question too.In python,"rb"means you need to read a binary file.In function "open" it works,so I guess that's the question of av library.I want to solve that too:(

@dimgel
Copy link
Author

dimgel commented Mar 23, 2024

I want to solve that too:(

Then just remove "b" like I did -- and it will work.

@WuYuZh17
Copy link

thanks a lot,that works,but I meet the question"UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 25: illegal multibyte sequence",could you help me please:(

@dimgel
Copy link
Author

dimgel commented Mar 30, 2024

Sorry, not my area of expertise.

@JarrodElliott
Copy link

@dimgel, @WuYuZh17: Looks like this commit makes it so you can't use 'rb' in the open anymore which was being used in the latest release here.

Try installing an older version - PyAV v11.0.0
pip install --force-reinstall -v "av==11.0.0"

@admarsee
Copy link

@JarrodElliott , downgrading av from 12 to 11 fixed the issue for me!

@github-actions github-actions bot added the stale 🪨话题搁置 label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale 🪨话题搁置
Projects
None yet
Development

No branches or pull requests

4 participants