how to determine incoming fps / resolution

Tommy.Schell

New Member
Hi,

Is there a way to determine actual incoming fps / resolution of a source ?

I've tried:

// for incoming fps:
double fps = obs_get_active_fps();

// for incoming resolution:
obs_video_info ovi;
obs_get_video_info(&ovi);
*width = ovi.base_width;
*height = ovi.base_height;


But the above seem to be tied to the Video settings in the menu.

Thanks a lot, Tommy Schell
 

RytoEX

Forum Admin
Forum Moderator
Developer
You may want to have a look at PR 1053 for possible ways to get the FPS of a source. I think that you can use obs_source_get_width/obs_source_get_base_width and obs_source_get_height/obs_source_get_base_height get the source resolution.
 

Tommy.Schell

New Member
Thank you.

The obs_source_get_width / get_base_width and get_height / get_base_height seem to be similarly tied to
the Video settings.

I guess that is partly the purpose of the Video settings, is to tell OBS what the source's incoming frame rate / resolution
is supposed to be ? (i.e., OBS does not readily auto-detect these things)

Thanks, Tommy Schell
 

RytoEX

Forum Admin
Forum Moderator
Developer
The obs_source_get_width / get_base_width and get_height / get_base_height seem to be similarly tied to
the Video settings.

I guess that is partly the purpose of the Video settings, is to tell OBS what the source's incoming frame rate / resolution
is supposed to be ? (i.e., OBS does not readily auto-detect these things)

I've checked these functions using breakpoints in Visual Studio. As far as I can tell, those functions return the original width/height of the source before any scaling happens. Have you tested these in code yet? What kind of sources are you trying to get info from? They do rely on the source having properly implemented get_width and get_height functions.

The Video Settings (found in Settings > Video) are used to set the drawing canvas size for OBS and the scaled output size of the frame to send to the encoder. I'm pretty sure that OBS has to know the incoming size/resolution of sources to do any kind of source scaling and transformation.
 

Tommy.Schell

New Member
I did test this in code, and the functions seemed to always return whatever I had set in the Base (Canvas) Resolution setting.

But it was with a source that had a non-standard resolution.
Perhaps that's the problem.
I'm going to investigate a bit more with a more standard source.
Thanks for checking into this.
 

RytoEX

Forum Admin
Forum Moderator
Developer
What kind of source are you testing this with? What values do you expect to see for the source's width and height?
 

NLeseul

Member
The implementation of obs_source_get_base_width() just passes through whatever value is provided by the .get_width callback configured for the source (unless the source is a filter or a transition). I've used this in my plugin work, and it definitely behaves as expected.
 
Top