4k Video Capture from HDMI not right

Hi all,
I’m trying to use a vid = cv2.VideoCapture(0) object with a webcam input. The webcam is a 4k camera HDMI output to Video Capture USB device. My problem is that the images I am getting in are cropped to the resolution 1980x1080 (rather than resized), and are only giving me the top left quarter of the original 4k image. The image also has a green hue, in both BGR and RGB format.

I’m using the Elgato cam link 4k video capture device, which also supports 1280x720p resolution. I’ve tried requesting that lower resolution from the webcam using the below code (I need 1280x720 for my project), but that didn’t change the input resolution.

vid = cv2.VideoCapture(0)
codec = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')
vid.set(6, codec)
vid.set(5, 30)
vid.set(3, 1280)
vid.set(4, 720)

The USB Video Capture device works on Windows in Google Meet, showing the correct image, but not for my project running on Linux. Any ideas what could be wrong?

check the shape of the image returned from VideoCapture.read.

on both platforms.

what’s the shape? if you merely did an imshow and expected the picture to be resized to be fully in view… that’s happening with a WINDOW_NORMAL creation flag but not automatically.

use ffmpeg to query the device’s capabilities:

use named constants like cv.CAP_PROP_FRAME_WIDTH etc