Ask Your Question

Is there a way to select a specific web cam from USB hub on a Mac or Windows?

asked 2020-11-19 15:22:58 -0500

exnx gravatar image


I am using a USB hub splitter for 2 webcams. I am also using other USB ports for other devices.

Right now, I use just an integer value when using VideoCapture(cam_num), but the cam_num integer value changes, and sometimes it's the cam (included) inside my laptop. Not good! I need a way to find a camera specifically and use it.

I see there's a way to select the camera on a linux machine, but is there a way to select a specific cam on a Mac or Windows? Thanks for the help!


edit retag flag offensive close merge delete


Check to see number of camera $ls /dev/video*

supra56 gravatar imagesupra56 ( 2020-11-20 06:53:29 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-11-19 20:13:19 -0500

crackwitz gravatar image

probably not. what you can pass for a camera identifier highly depends on the backend (apiPreference parameter). OpenCV docs contains a list of all the backends and some documentation on what each can handle. you can inspect the source code to see any hidden mechanisms.

if you need this functionality, you should use libraries such as ffmpeg, which are cross-platform (but can't hide system-specific naming schemes), or native system APIs.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-11-19 15:22:58 -0500

Seen: 35 times

Last updated: Nov 19