Resolution - massive performance drop

I’m using a Logitech C930e to do some aruco detection and pose estimation. But I dont understand why I cant render the camera feed for any higher resolution than 640x480 without the framerate dropping to the floor and making the feed completely useless. The camera is behaving super smooth at 1920x1080 when using Logitech’s software, but not when OpenCV is ‘controlling’ the camera? I really dont understand why that is.
I even tried removing all computations and just render the feed like this:

def vid():
    cap = cv.VideoCapture(0)
    cap.set(cv.CAP_PROP_FRAME_WIDTH, 1280)
    cap.set(cv.CAP_PROP_FRAME_HEIGHT, 720)
    if not cap.isOpened():
        print("Cannot open camera")
    while True:
        # Capture frame-by-frame
        ret, frame =
        # if frame is read correctly ret is True
        if not ret:
            print("Can't receive frame (stream end?). Exiting ...")
        cv.imshow('frame', frame)
        if cv.waitKey(1) == ord('q'):
    # When everything done, release the capture

As barebones as it can be? And still the feed is super laggy and impossible to use.

from same question IRC:

  • CAP_DSHOW helps because MSMF appears to still be buggy
  • set(), CAP_PROP_FOURCC, VideoWriter_fourcc(*"MJPG")

Cheers, however to make it use MJPEG on Windows 10, I had to force feed it MJPEG codec code:

cap.set(cv.CAP_PROP_FOURCC, cv.VideoWriter.fourcc('m','j','p','g'))
cap.set(cv.CAP_PROP_FOURCC, cv.VideoWriter.fourcc('M','J','P','G'))

google answer