openframeworks / openframeworks/openFrameworks

ofGstVideoGrabber : Request width and height larger than format selected.

Open
#8,436 0 comments 0 reactions 0 assignees View on GitHub

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;
        }
}

Changing
https://github.com/openframeworks/openFrameworks/blob/32971e8a7e7474c6b598834f0ae25a2f01a404f4/libs/openFrameworks/video/ofGstVideoGrabber.cpp#L717-L722

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.