l1npengtul / nokhwa

Cross Platform Rust Library for Powerful Webcam/Camera Capture
Apache License 2.0
533 stars 137 forks source link

v4l camera indexing isn't necessarily accurate #171

Open ajaypillay opened 6 months ago

ajaypillay commented 6 months ago

For my webcam, this is what v4l2-ctl --list-devices shows:

Integrated Camera: Integrated C (usb-0000:00:14.0-4):
    /dev/video1
    /dev/video2
    /dev/video3
    /dev/video4
    /dev/media0
    /dev/media1

Currently, nokhwa_bindings_linux::query() shows multiple cameras (since the way the indexing is done is by parsing the /sys/class/... path) when in fact there's only 1 actual camera stream that can be accessed. The correct index is located in the file /sys/class/videoX/index. All of them indicate the correct index as 1. Index 0 is being used by Droidcam. As these aren't accessible streams to my knowledge, it might be worth condensing that.

l1npengtul commented 1 month ago

Considering this for 0.11, will need more testing