-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
ofGstVideoGrabber : Request width and height larger than format selected. #8436
Copy link
Copy link
Open
Milestone
Description
Testing on linux mint 22.1 and the nightly.
I have an older 720p webcam. When I request 1920x1080 for more compatibility with newer devices, the old one fails to open. Without having to loop through formats and do a manual check, was hoping it would select a format resolution that it does support and open it.
Testing with the following code opens the camera be adjusting the w and h variable if it is too large for the format.
ofGstVideoFormat format;
if(internalPixelFormat!=OF_PIXELS_NATIVE){
format = selectFormat(w, h, attemptFramerate, internalPixelFormat);
ofLogNotice("ofGstVideoGrabber") << "initGrabber(): selected device: " << camData.webcam_devices[deviceID].product_name;
ofLogNotice("ofGstVideoGrabber") << "initGrabber(): selected format: " << format.width << "x" << format.height << " " << format.mimetype << " " << format.format_name << " framerate: " << format.choosen_framerate.numerator << "/" << format.choosen_framerate.denominator;
if( format.width < w ) {
ofLogNotice("ofGstVideoGrabber") << "initGrabber(): setting the width to " << format.width;
w = format.width;
}
if( format.height < h ) {
ofLogNotice("ofGstVideoGrabber") << "initGrabber(): setting the height to " << format.height;
h = format.height;
}
}
Changing
openFrameworks/libs/openFrameworks/video/ofGstVideoGrabber.cpp
Lines 717 to 722 in 32971e8
| if(internalPixelFormat!=OF_PIXELS_NATIVE){ | |
| format = selectFormat(w, h, attemptFramerate, internalPixelFormat); | |
| ofLogNotice("ofGstVideoGrabber") << "initGrabber(): selected device: " << camData.webcam_devices[deviceID].product_name; | |
| ofLogNotice("ofGstVideoGrabber") << "initGrabber(): selected format: " << format.width << "x" << format.height | |
| << " " << format.mimetype << " " << format.format_name << " framerate: " << format.choosen_framerate.numerator << "/" << format.choosen_framerate.denominator; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels