Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logitech Brio OpenCV Capture Settings

Tags:

opencv

I'm trying to record from a Logitech Brio at 60fps, preferably at 1080p. It should work because I can get it working on OBS and many others have achieved the settings.

Here is the code I am using to try to capture at this rate:

    // Do some grabbing
    cv::VideoCapture video_capture;
    video_capture.set(cv::CAP_PROP_FRAME_WIDTH, 1920);
    video_capture.set(cv::CAP_PROP_FRAME_HEIGHT, 1080);
    video_capture.set(cv::CAP_PROP_FPS, 60);
    {
        INFO_STREAM("Attempting to capture from device: " << device);
        video_capture = cv::VideoCapture(device);

        // Read a first frame often empty in camera
        cv::Mat captured_image;
        video_capture >> captured_image;
    }

    if (!video_capture.isOpened())
    {
        FATAL_STREAM("Failed to open video source");
        return 1;
    }
    else INFO_STREAM("Device or file opened");

    cv::Mat captured_image;
    video_capture >> captured_image;

What should I be doing differently for the Brio?

like image 272
calben Avatar asked Dec 19 '22 01:12

calben


1 Answers

I had the same problem: same camera, couldn't change resolution or fps . After hours of working on this and digging the internet I found a solution: Need to use DSHOW and need to instead read from capture device 1 (instead of 0). Code below for reference

fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
cap = cv2.VideoCapture()
cap.open(cameraNumber + 1 + cv2.CAP_DSHOW)
cap.set(cv2.CAP_PROP_FOURCC, fourcc)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
cap.set(cv2.CAP_PROP_FPS, 60)

sorry I only did this in Python, but I hope the same solution works in c++ I assume you can do something along the lines of

video_capture = cv::VideoCapture(device + 1 + cv::CAP_DSHOW);
like image 95
ffarhour Avatar answered Feb 23 '23 01:02

ffarhour