How to open the correct camera in multi camera setup?

I have multiple cameras connected to my Jetson board running Ubuntu.
I use C++ and OpenCV 4.7.0 to grab frames from the cameras.
Currently I open the cameras by index. But that is not a good practice because I’m not sure which index is which camera. So how to do this?
It is strange that I can not find anything about this in this forum. Maybe I use wrong search terms.

I can create a loop and open VideoCapture devices with indexes from 0 to some maximum. But how do I get more information from an opened camera to find out if this is the correct one?

What may make it more difficult is that I have several cameras of the same brand and type.

you won’t find much on the forum. it’s an unsolved problem.

you’d best visit Issues · opencv/opencv · GitHub and look for an issue that matches. if there isn’t one, start one.

this will probably require an extension of the API, such that there’s a way to list cameras with unique ids and to request a camera by unique id.

most people that deal with multiple cameras have to solve this ad-hoc or they use system APIs to access their cameras directly.