4

Is there a sure way to programmatically differentiate between multiple cameras? I enumerate CLSID_VideoInputDeviceCategory and then I GetDisplayName on each IMoniker. What I found out is that with some cameras plugging them into different USB socket will return you different unique ID, that is, same camera plugged in into different sockets is regarded by my program as multiple cameras attached at different time. Other cameras plugged into different usb sockets are identified with the same GetDisplayName. On top of that, I have two identical cameras (Microsoft LifeCam HD-3000) and when I plug in different hardware pieces into the same socket I can't tell the difference which hardware piece was inserted.

So, is there a way to really tell the difference between multiple identical cameras if I plug them into the same usb port? And related reverse question: how can I id the same camera when I plug it in into different usb sockets?

Pavel P
  • 15,789
  • 11
  • 79
  • 128

1 Answers1

4

Depending on availability of serial number of USB device, re-plugging it into different port will give you the same or different moniker display name. Still moniker display name is the best you can do. See more on this topic here: How to identify a video device correctly?.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • yes, that thread explains what I have observer with my cameras. This MS cam doesn't have serial number and plugging it into different USB sockets creates a new string. With a hi-end cam (Tandberg HD) I have no such issue, becuase it has serial number (as reported by usbview). Thanks for info. – Pavel P Aug 04 '12 at 21:35
  • Roman, I have another dshow related question. I check out your blog, perhaps you'll be able to help? http://stackoverflow.com/questions/11812670/video-playback-on-win7-vista-dshow-dmo – Pavel P Aug 04 '12 at 23:13
  • Can I use `DsDevice.DevicePath` string to uniquely identify cameras? On my system I connected 4 webcams all four have different `DevicePath` string, so can I use `DevicePath` as dropdown list's value and 'Name' as text. Will this behavior will always the same through out the Windows OS? – Amogh Jan 18 '17 at 07:10
  • @Amogh: `DevicePath` is optional, it is present with devices with physical representation and might be absent with virtual devices. So it's not a good identification method. Moniker display name works the best instead. – Roman R. Jan 18 '17 at 12:38