Enable webcamera FPS 60 in Linux for Logitech C922 Pro Stream Webcam

Raspberry Pi, Jeston Nano


henrywu
Posts: 180
Joined: Sun Apr 17, 2022 4:57 pm

Enable webcamera FPS 60 in Linux for Logitech C922 Pro Stream Webcam

Post by henrywu »

  1. 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
    
    1. 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)
    ...
    
    1. use guvcview to set the default FPS to 60

    2. verify 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()
    
Attachments
Screenshot from 2022-06-05 01-16-54.png
Screenshot from 2022-06-05 01-16-54.png (40.54 KiB) Viewed 1687 times
Screenshot from 2022-06-05 01-11-05.png
Screenshot from 2022-06-05 01-11-05.png (60.12 KiB) Viewed 1689 times
henrywu
Posts: 180
Joined: Sun Apr 17, 2022 4:57 pm

Re: Enable webcamera FPS 60 in Linux for Logitech C922 Pro Stream Webcam

Post by henrywu »

henrywu
Posts: 180
Joined: Sun Apr 17, 2022 4:57 pm

Re: Enable webcamera FPS 60 in Linux for Logitech C922 Pro Stream Webcam

Post by henrywu »

In jetson nano, I only got 29 FPS.

Attachments
Screenshot from 2022-06-05 08-44-33.png
Screenshot from 2022-06-05 08-44-33.png (74.35 KiB) Viewed 1678 times
Screenshot from 2022-06-05 08-44-07.png
Screenshot from 2022-06-05 08-44-07.png (64.28 KiB) Viewed 1678 times
Post Reply