obs-ffmpeg: Add procedure to save a shorter replay #10260
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds a 'save_duration' procedure to the replay buffer output that allows one to save a shorter part of the replay buffer.
Motivation and Context
There are a few requests out there to have 'multiple replay buffers' which usually means being able to have multiple hotkeys to save replays of different lengths. This was also my use case, I sometimes want to register the last 15 minutes of gameplay, but a lot more often I just want 30 seconds or so. See also this ideas link
The current way to have this are a bit janky at best, you either have to go for a somewhat out of date fork (https://github.com/TheDark/obs-studio), or use scripts that process the replay file after the fact.
This isn't a full implementation of multiple replay buffer lengths, but it makes it a lot easier for an external script to do it and do it consistently.
How Has This Been Tested?
I mostly tested this manually by saving shorter replays manually with a small lua script that just binds a hotkey to save the last 30 seconds. I also tried saving normal replays to confirm there was no effect on the base feature. I'm on a laptop with Windows 11 23H2 (OS Build 22631.3155) and a 3070, which is used for the encoding.
I only touched the code for saving the replay buffer and creating the replay buffer output, so those should be the only parts of the code subject to potential issues.
Types of changes
Checklist: