Python Forum
Get list of Video Device in python on Windows machine
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get list of Video Device in python on Windows machine
#1
I am working on a software, where an USB video device is used. I use [python]cv2.VideoCapture()[python] function from the openCV library in the software. The function need to get index of the video device, but my USB cam has sometimes index 0, sometimes index 1 or index 7. Because the software must be user friendly, so I would like to get list of all available USB video devices and let the user choose what device he wants. The best would be get name and address of the devices. I tried search in older questions but without satisfactory answer. The solution should be easy and elegant Thank you very much for your help and I hope that the question is understandable.
Reply
#2
Try use
pywin32
if Windows:
import win32com.client

wmi = win32com.client.GetObject ("winmgmts:")
for usb in wmi.InstancesOf ("Win32_USBHub"):
    print usb.DeviceID
More details here: https://stackoverflow.com/questions/8110...-in-python
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Video recording with Raspberry Pi - What´s wrong with my python code? Montezuma1502 3 1,180 Feb-24-2023, 06:14 PM
Last Post: deanhystad
  How to output Python in Spout or any other video sharing network? buzzdarkyear 4 2,073 Jan-11-2022, 11:37 AM
Last Post: buzzdarkyear
  Sending string commands from Python to a bluetooth device Rovelin 13 9,281 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  Python BLE Scanner not detecting device alexanderDennisEnviro500 0 1,972 Aug-01-2021, 02:29 AM
Last Post: alexanderDennisEnviro500
  Real Time Audio Processing with Python Sound-Device not working Slartybartfast 2 3,881 Mar-14-2021, 07:20 PM
Last Post: Slartybartfast
  Need to access Windows Machine or Personal Certificate Store and send to web app seswho 0 1,607 Sep-14-2020, 04:57 PM
Last Post: seswho
  How to get Data-Taken For a Video file using Python ramprasad1211 1 1,862 Apr-28-2020, 08:48 AM
Last Post: ndc85430
  How to check if video has been deleted or removed in youtube using python Prince_Bhatia 14 11,581 Feb-21-2020, 04:33 AM
Last Post: jehoshua
  Want to learn Python compilation and virtual machine IJB 3 2,569 Feb-14-2020, 02:59 PM
Last Post: IJB
  Detecting USB Device Insertion on Windows 10 Atalanttore 0 2,339 Jan-17-2020, 02:46 PM
Last Post: Atalanttore

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020