Closed wrzwicky closed 2 months ago
Can you download and test the preview wheels from the artifacts at https://github.com/letmaik/pyvirtualcam/actions/runs/9624551391#artifacts? This was built against numpy 2.
@wrzwicky Ping
Sorry for being a slacker, turns out depthai released 2.27 around the time you were doing your fix. Their 2.27 actually fixes the true problem, as using their 2.26 with your 0.12.0 exhibits the same gray flickering screen I saw above.
More importantly, their 2.27 works fine with your 0.11.1.
You'll need to decide whether to push your change; asarray() allowing copy will crash less, but may also sometimes consume more CPU with no explanation. And it may even be wrong, since a crash really means the incoming frame data is not in the expected format. If that's true, you may want to catch and rethrow a new exception with a more applicable message. (I did this sort of thing all the time in Java.)
And also, since I'm here, I can't make sense of np.array(frame.reshape())
on line 348. Looking at the docs, it appears copy=False
basically means np.array()
does nothing, and since reshape(-1)
returns a 1-D array, then order='C'
also does nothing.
Ok I'll stop now. Thanks for your time and attention.
Closing as solved. Bug was fixed in depthai; both pyvirtualcam 0.11.1 and the proposed 0.12.0 work fine.
pip install
)Describe the bug Pyvirtualcam does not work with the new Numpy 2.0. You may want to update your dependencies to make that explicit, or update the code to support 2.0.
To Reproduce I installed the code for my Oak D Lite camera:
pipenv shell
pipenv install depthai pyvirtualcam
This ended up installing Numpy 2.0.0.I then ran their sample code to build a UVC camera. The result crashed from inside your
camera.py
, line 348frame = np.array(frame.reshape(-1), copy=False, order='C')
with the error:When I made the change suggested, I got a video feed that showed a flat grey color that flickered in brightness.
I then downgraded Numpy to 1.26 (
pipenv install numpy==1.26
) and the camera feed started working fine. When I reverted my change to your file, the camera feed continued to work fine.