There are sometimes questions about whether certain changes to the cadence of frame capture w/ OBS would be beneficial, with some vague definition of "beneficial".
This (really, really bad) python script attempts to emulate the way OBS's game capture and compositing pipeline works and gather some stats about it. This can help allow testing of different algorithms for frame capturing, and easier study of the overall capture behavior.
Currently we require an input script that is a capture from
PresentMon, to provide realistic game frame timings for analysis. Several
sample files are included in the pmcap
subdirectory.
The current OBS behavior can be summarized as such, where obs_ouput_interval
is how often OBS generates new frames for output (e.g. this would be 0.01666666 seconds for 60fps):
Game capture hook:
- A game calls
present
for each game frame, at an arbitrary rate - The game capture hook intercepts these calls. If it has been longer than (obs_output_interval / 2) since the last frame was captured, the hook copies the game's frame to shared texture memory.
- The capture hook passes on the
present
call to the driver
On the OBS side, running independently:
- The compositor is invoked to generate a new output frame every
obs_output_interval
- At the time, whatever frame was most recently captured by the game capture hook is used in the compositing
The ultra-short version: ./sim.py --presentmon-file <filename>
A very non-exhaustive list:
- Need to make the architecture a bit more agreeable to having pluggable frame generation sources, game capture algorithms, etc
- One big outstanding question is: how do we manage command-line parameters for those various things? We can have multiple different subsystems, and each subsystem can have a handler that can take an arbitrary set of configuration options, and I'm not sure how to wrangle the CLI options for that.
- Maybe just make everything use a config file?
- Reconsider output formats. Not sure what's useful here
- Graph rendering with various bits might be nice
- Figure out a list of other test modes/algorithms might be useful
- Figure out a good way to figure out if a given frame pacing/set of captured frames/whatever is better or worse than another