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
OpenCV specify environment variables inside python file wrong documentation (OPENCV_FFMPEG_READ_ATTEMPTS) #25536
Comments
first read python doc : I don't see anything in your code about reading a video |
i meet with same problem |
Dear @LaurentBerger, I understood the Python Doc but I honestly don't know what to understand in your quoted paragraph. 😕 What I said is that the code provided inside the OpenCV Doc to modify os environment variable, executed as is, raises an error. The code that reads a video frame doesn't matter much, and it's embedded through MMCV that uses OpenCV, so I'm not able to provide a OpenCV-code-only example. I know this part works, because as I said, it works once the environment variable modified inside Windows parameters. Please tell me if you really need an example for reading a video frame but I think it's not necessary, as I guess the problem will occur on the set up of every possible OpenCV environment variable. |
os.environ["MY_ENV_VARIABLE"] = True |
Example in the documentation is wrong because it doesn't use string. However generally this approach should work:
Default value without environment change:
|
Most probably the same as https://stackoverflow.com/questions/5153547/environment-variables-are-different-for-dll-than-exe. It's not related to OpenCV, but OS specific. |
Describe the doc issue
Hello,
I think this is documentation issue + bug issue
First, when reading a video, this warning occured, giving me a None value instead of a frame :
I wanted to create the environment variable inside my Python file to be machine-independant so I followed the instructions in page OpenCV: OpenCV environment variables reference
When I executed this code in the given page :
It raised this error :
Same error if I give an int instead of a bool.
So I tried giving a str instead, to the variable :
This prints me 16000, but I still have the first error provided at the top, saying that current value of OPENCV_FFMPEG_READ_ATTEMPTS is 4096, when reading a particular frame of a particular video.
Now that I have created a system environment variable in Windows, plus restarted my computer, it works.
Do anyone know what the opencv Doc is missing and why setting environment variable inside python file seems impossible ?
(Windows 10, opencv-python 4.9.0.80, Python 3.9.12, openCV doc tried on version 4.10.0 and 4.9.0)
Fix suggestion
No response
The text was updated successfully, but these errors were encountered: