Enable webcamera FPS 60 in Linux for Logitech C922 Pro Stream Webcam
Posted: Sat Jun 04, 2022 7:20 pm
- List all my 3 web cameras
Code: Select all
$v4l2-ctl --list-devices C922 Pro Stream Webcam (usb-0000:00:14.0-1): /dev/video0 /dev/video1 USB Webcam gadget: UVC HD Camer (usb-0000:00:14.0-2): /dev/video2 /dev/video3 Integrated Camera: Integrated C (usb-0000:00:14.0-8): /dev/video4 /dev/video5
- Find if the webcam support FPS 60
Code: Select all
$ v4l2-ctl --list-formats-ext ... Size: Discrete 1280x720 Interval: Discrete 0.017s (60.000 fps) Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.042s (24.000 fps) Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps) ...
use
guvcview
to set the default FPS to 60verify the FPS with python code
Code: Select all
#!/usr/bin/python import cv2 cap = cv2.VideoCapture(0, cv2.CAP_V4L2) cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) cap.set(cv2.CAP_PROP_FPS, 60) width, height = ( cap.get(cv2.CAP_PROP_FRAME_WIDTH), cap.get(cv2.CAP_PROP_FRAME_HEIGHT), ) print(f"Camera dimensions: {width, height}") print(f"Camera FPS: {cap.get(cv2.CAP_PROP_FPS)}") import time start = time.monotonic() count= 0 while 1: ret, image = cap.read() #.... count+=1 if count%30==0: end = time.monotonic() print(30/(end-start)) start = end cap.release() cv2.destroyAllWindows()