Using OBS Studio for Instant Replay
OBS is typically used for streaming, but it actually is a great tool for screen recording in general as well as instant replays in game. Once installed, open OBS up. It will capture audio by default, but you will manually need to add your video source (i.e., your desktop). To do this, make sure you are on the main screen of OBS studio. It will look like this
Now, click the + button in the "Sources" section -> Display Capture. A "Create/Select Source" Dialogue will open. Make sure that "Create new" is the option that is checked, and hit OK. You can just hit okay in the next dialogue too, which just asks you to select your screen, unless you have multiple monitors. In that case, you'll have to select your main one.
You should now be back on the main OBS screen again, but now it will show your screen.
Now, open up OBS's settings by using the button at the bottom right hand corner of the window, just above the exit button. There are only a few sections of the settings that we are going to want to worry about: General, Output, Video, and Hotkeys. I will cover them below. Only change the settings I am mentioning below, unless you know what you're doing.
Video
Set the "Base Resolution" to be whatever your monitor's resolution is. I have a 1440p monitor, so I selected the 1440p option from the dropdown.
Set the "Output Resolution" to whatever resolution you'd like your instant replays and recordings to be at. Higher resolutions will look better, but will take up more space on your drive, and will take longer to upload. I keep mine at 1920x1080, aka 1080p.
Set "Common FPS Values" to be what framerate you'd like your videos to be at. I find that for gameplay footage, 60 seems to be enough. The higher this is, the bigger your file size will be as well, so take that into consideration.
Output
Here we only want to worry about the Recording section, and the Replay Buffer section.
Recording Path: click browse and set this to wherever you wish your replays to be saved to.
Recording Quality: Honestly just keep it at "High Quality, Medium File Size." You can toy around with the other ones if you want to but this is a good compromise between quality and file size.
Recording Format: mp4
Enable Replay Buffer: This is important! Check this box.
Maximum Replay Time: Set this for however many seconds you want your replays to be. I have mine set to be 5 minutes (300 seconds), and then I'll manually go back and trim them down to be just the action I'm looking for.
Maximum Memory (Megabytes): 2gb (2048mb) is fine for this. If you are recording less than 5 minutes, you'd probably also be fine cutting this down to 1gb (1024mb).
Hotkeys
Only one setting you need to change here. Scroll down to the hotkey for "Save Replay," click on it, and set it to whatever you want to press to trigger a replay. I like Control + Alt + S, as it's easy to transition to from having my fingers on WASD.
General
In the System Tray section, check every box.
OBS is now set up and ready to record! Well, almost.
It would be kind of annoying if every time we started up our computer, we'd have to search for OBS, start it up, start the replay buffer, and then minimize it again. That's way too much of a hassle and there's an easy solution which I will walk you through. Note: I am using Windows 11 to do this but the process is the exact same to do it on Windows 10 or 7.
Search for Task Scheduler
On the right side of the screen, click "Create Basic Task"
Name it whatever you would like
Select "When I Log On" as the trigger
Select "Start a Program" as the action
For program, click browse, and locate where OBS is installed. Typically, this is "C:\Program Files\obs-studio\bin\64bit\obs64.exe".
Add an argument called --startreplaybuffer. This will make sure OBS is ready to save replays as soon as you boot up.
For "Start in," enter the folder you found OBS in. This would be "C:\Program Files\obs-studio\bin\64bit\" in most cases.
Now OBS is actually ready to record!
You can click through now to finish. Restart your computer, and if you open your system tray, you'll find OBS with a little red dot on it, indicating that instant replay is active. To save an instant replay, simply use the keybind that you assigned earlier to be "Save Replay".