0

I am currently trying to let users pick a camera for our front end software. We currently iterate through the camera devices like shown in this answer on StackOverflow. This will return us the Camera IDs:

index = 0
arr = []
while True:
    cap = cv2.VideoCapture(index)
    if not cap.read()[0]:
        break
    else:
        arr.append(index)
    cap.release()
    index += 1
return arr

which is fine, but it would be a lot better to get a friendly device name to show the user i.e: Logitech Webcam

Does anyone know how to get the actual names of these cameras to show to the users rather than displaying with IDs?

ariagno
  • 501
  • 1
  • 12
  • 28
  • OpenCV doesn't do that. you'll need to use ffmpeg (PyAV) or whatever media API does the work on your system (V4L, dshow, MSMF, AVFoundation, ...) – Christoph Rackwitz Jan 28 '22 at 08:04

1 Answers1

0

There are two options, with the MSMF backend, you can do it here CV-camera finder, just download the .pyd file on windows (I think only works with python 3.7), or with DSHOW, which is shown on that repo's README.

dmatos2012
  • 73
  • 5