Search code examples
pythonopencvvideo-capture

HDMI-USB Video Capture Card Stream Using Opencv or any other library in Python


I am trying to read the stream from HDMI-USB video-capture card using opencv. But OpenCV doesn't seem to support that functionality. I used opencv to read RTSP streams and webcams. Can anyone suggest a way here. Currently I am accessing the stream using OBS Studio software. Is there any other module in python that I can use. Thanks in advance.

There's a similar question here. But that approach doesn't work for me.


Solution

  • Edit: video0 or video1 depends on your system and connected devices.

    Turns out we can access this USB device using opencv itself. In linux you can access these devices at /dev/video0.

    import cv2
    cap = cv2.VideoCapture('/dev/video0')
    

    I'm yet to figure out how to do this in windows though