How to configure your webcam to 60 FPS?

Subject: Need Help with Logitech C922 Pro HD Streaming Webcam 60FPS Issue

Hello,

First of all, I would appreciate your understanding as my English is not fluent.

I am using the Logitech C922 Pro HD Streaming Webcam to capture real-time video at 60FPS. The webcam supports 60FPS, and the video format is MJPG.

However, no matter what I try, the maximum FPS I can achieve is 30FPS, and when setting the resolution to 720p, the FPS drops to 10FPS.

Steps I have tried:

  1. Checked if 60FPS is supported using Logitech Capture and Logi Tune
  2. Contacted Logitech support to check if there are any limitations
  3. Changed the backend (DSHOW, MSMF)
  4. Changed the video format (MJPG)
  5. Disabled auto exposure and manually adjusted the exposure settings (CAP_PROP_AUTO_EXPOSURE)

Default settings when no modifications are applied (get function results):

  • Resolution: 640x480
  • FPS: 30.0
  • Brightness: 128.0
  • Contrast: 128.0
  • Saturation: 128.0
  • Exposure: -5.0

My system environment:

  • OS: Windows 11
  • Hardware: Intel(R) Core™ i5-14400 2.50 GHz
  • OpenCV Version: 4.11.0.86
  • IDE: Visual Studio Code

Since the camera performance is crucial for my project, I would greatly appreciate any help. Please help me!

Below is the code I have tested:

import os
os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0"
import cv2
# import cscore
import time

# 웹캠 열기 (0번 장치)
cap = cv2.VideoCapture(0, cv2.CAP_MSMF) # CAP_DSHOW, CAP_MSMF
# cap = cscore.VideoCapture(0)

vid_fmt = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')
cap.set(cv2.CAP_PROP_FOURCC, vid_fmt)

# 해상도
width = cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)  # 가로 해상도
height = cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)  # 세로 해상도

# fps
fps = cap.get(cv2.CAP_PROP_FPS)  # FPS
print(f"   ▶ 변경 전 FPS: {fps}")
cap.set(cv2.CAP_PROP_FPS, 60)  # FPS
print(f"   ▶ 변경 후 FPS: {cap.get(cv2.CAP_PROP_FPS)}")

# 자동 노출 끄기 (0으로 설정)
cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1)

if not cap.isOpened():
    print("웹캠을 열 수 없습니다.")
    exit()
    
# 📷 웹캠 기본 정보
#    ▶ 해상도: 640x480
#    ▶ FPS: 30.0
#    ▶ 밝기(Brightness): 128.0
#    ▶ 대비(Contrast): 128.0
#    ▶ 채도(Saturation): 128.0
#    ▶ 노출(Exposure): -5.0


print(f"   ▶ 해상도: {int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))}x{int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))}")



# 밝기 (0~1)
brightness = cap.set(cv2.CAP_PROP_BRIGHTNESS, 128)  # 밝기
print(f"   ▶ 밝기(Brightness): {cap.get(cv2.CAP_PROP_BRIGHTNESS)}")

# 대비 (0~1)
# contrast = cap.set(cv2.CAP_PROP_CONTRAST, 0)  # 대비
print(f"   ▶ 대비(Contrast): {cap.get(cv2.CAP_PROP_CONTRAST)}")

saturation = cap.get(cv2.CAP_PROP_SATURATION)  # 채도
exposure = cap.get(cv2.CAP_PROP_EXPOSURE)  # 노출

# ▶ 웹캠 정보 출력

print(f"   ▶ 채도(Saturation): {saturation}")
print(f"   ▶ 노출(Exposure): {exposure}")

vid_fmt = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')
cap.set(cv2.CAP_PROP_FOURCC, vid_fmt)

# FPS를 수동으로 계산할 변수들
fps = 0
frame_count = 0
start_time = time.time()

while True:
    ret, frame = cap.read()
    if not ret:
        print("프레임을 가져올 수 없습니다.")
        break
    
    # FPS 수동 계산
    frame_count += 1
    elapsed_time = time.time() - start_time  # 경과 시간
    if elapsed_time >= 1:
        fps = frame_count / elapsed_time  # FPS 계산
        start_time = time.time()  # 시간 초기화
        frame_count = 0  # 카운트 초기화

    # 화면에 FPS 정보 표시
    cv2.putText(frame, f"FPS: {fps:.2f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)

    cv2.imshow("Logitech Webcam", frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

try different orders of set() calls. there are orders where the FOURCC set call won’t help, but there are orders where it will.

you can check the available video modes using ffprobe or ffmpeg.

get ffmpeg from Download FFmpeg, unpack it, start a terminal in that directory, then follow DirectShow – FFmpeg to enumerate available cameras and list the available modes of your camera.

I checked the available mode of the camera through ffmpeg and found that it supports 1280x720 60fps. I also tried to read the video from Python through the ffmpeg command, but it failed because it was too slow.

You have reordered several set() positions, but this has also failed.

Do you have any other solutions?

try CAP_DSHOW too. if you have any trouble while using either of those, always try the other one as well.

unfortunately I don’t have a C922 to test this with. my C920 only goes upto 30 fps.