openframeworks / openframeworks/openFrameworks
ofGstVideoGrabber : Request width and height larger than format selected.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
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;
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in libs/openFrameworks/video/ofGstVideoGrabber.cpp at the linked lines and trace how the selected format is used by initGrabber(). Reproduce the case on Linux Mint with a 720p webcam while requesting 1920x1080; done means the camera opens using a supported format without manual format iteration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- audio-video-rtc, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100