# Resolution - massive performance drop

**URL:** <https://forum.opencv.org/t/resolution-massive-performance-drop/13078>\
**Category:** Python\
**Tags:** videoio\
**Created:** [May 5, 2023, 4:39pm UTC](https://forum.opencv.org/t/resolution-massive-performance-drop/13078 "2023-05-05T16:39:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tennisanders](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@tennisanders](https://forum.opencv.org/u/tennisanders)\
**Post date:** [May 5, 2023, 4:39pm UTC](https://forum.opencv.org/t/resolution-massive-performance-drop/13078/1 "2023-05-05T16:39:33Z")

</div>

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:

```auto
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")
        exit()
    while True:
        # Capture frame-by-frame
        ret, frame = cap.read()
        # if frame is read correctly ret is True
        if not ret:
            print("Can't receive frame (stream end?). Exiting ...")
            break
        
        cv.imshow('frame', frame)
        if cv.waitKey(1) == ord('q'):
            break
    # When everything done, release the capture
    cap.release()
    cv.destroyAllWindows()

```

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

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [May 5, 2023, 10:07pm UTC](https://forum.opencv.org/t/resolution-massive-performance-drop/13078/2 "2023-05-05T22:07:00Z")

</div>

from same question IRC:

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

---

<div class="post-metadata">

**Author:** ![tennisanders](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@tennisanders](https://forum.opencv.org/u/tennisanders)\
**Post date:** [May 6, 2023, 11:20am UTC](https://forum.opencv.org/t/resolution-massive-performance-drop/13078/3 "2023-05-06T11:20:25Z")

</div>

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

```auto
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'))

```

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [May 6, 2023, 12:07pm UTC](https://forum.opencv.org/t/resolution-massive-performance-drop/13078/4 "2023-05-06T12:07:35Z")

</div>

google answer

> <https://stackoverflow.com/questions/16092802/capturing-1080p-at-30fps-from-logitech-c920-with-opencv-2-4-3>
