Regarding G-Sync, OBS and RetroArch

I have a conundrum with these three factors that I’d like some advice on.

I have a G-Sync monitor that works flawlessly with RetroArch. I set my display rate to the estimated refresh rate value given by RA, turn on “Sync to exact content framerate” and every game I play from any system works flawlessly. I get perfectly smooth scrolling and no audio pops/crackles whatsoever.

The issue with this is that many retro games before the GCN/PS2/XBOX era never ran at a perfect 60 FPS, but instead fluctuated around the 60 Hz mark, meaning that when I try to capture game footage from older consoles and handhelds that either run slightly above or below 60 Hz, I get irregular frame pacing and judders on my OBS recordings. This is unfortunately just the nature of trying to capture sources that don’t exactly match the output OBS prefers for a 60 FPS recording.

One solution that isn’t ideal but works almost perfectly for getting smooth recordings is to manually set my display rate to 60 Hz in RA. Doing this allows my monitor to automatically toggle to 60 Hz as soon as RA is launched, and every game I play then has perfectly mirrored output to OBS. The issue with this, though, is that I’m having issues with certain games having audio popping. So far the most notable example is Donkey Kong Country 2; I haven’t tested any other SNES games yet, but I think that SNES games usually output to 60.100 Hz and this discrepancy from the display rate being 60 Hz is causing the audio buffer to keep overflowing every few seconds (please let me know if I’m completely wrong on this).

I also tried keeping my monitor at its reported display rate in RA, but turning “Sync content to exact framerate” off so G-Sync does not have an effect, but this is oddly the worst solution so far; RA automatically sets my refresh rate from the estimated 239.70 Hz to 60.100 Hz to match the output of DKC2, but the game has far more frequent and louder audio popping than when I just ran it at 60 Hz (frequent but lesser popping) and with “Sync to exact content framerate” enabled (zero popping).

N64 games are also causing strange pacing issues. I’ve tried recording Mystical Ninja Starring Goemon in an area which has an estimated 59.94 FPS but also occasionally jumps just over 60 FPS, and the pacing issues are horrible on OBS with “Sync to exact content framerate” on. Running the game at a display rate of 60 Hz is perfect; no audio pops, OBS is smooth as butter.

The most bizarre thing is that by alt-tabbing out of RA and simply playing it out-of-focus (so it’s not in exclusive fullscreen anymore) seems to fix these problems entirely. I can run the game with G-Sync active to eliminate pops (even though it’s no longer active once the window is not focused) and OBS plays nicely as well. I have no clue what alt-tabbing is doing to the refresh rate itself aside from disabling G-Sync, but it’s clearly helping.

Any advice on why alt-tabbing seems to work so far (with what I’ve tested, at least) or how else to balance all three entities would be greatly appreciated!

1 Like

I believe using RetroArch’s default settings with your monitor set to 60 Hz will provide the best recording experience. This will re-time all content to 60 Hz and dynamically resample the audio to keep the buffer from emptying/overfilling, thereby avoiding pops/clicks.

I would recommend moving/renaming your main retroarch.cfg temporarily so it creates a new one with default settings, see if that achieves your goals, and, if so, use the -c path/to/config.cfg command line switch (through a shortcut or .bat launcher) to have a specialized recording mode that you can launch into for that vs your normal works-best-for-you-alone mode.

1 Like

Thanks for the response, I’ll try the configuration tip soon; do you have any idea why I get audio popping on DKC2 at 60 Hz?

that’s usually due to the buffer issue you described, but that’s exactly what RetroArch’s dynamic rate control is designed to deal with, so something is happening your settings to disable it, which is why I suggested working from defaults.

Gotcha, I’ll give it a try soon and report back.

You’re using gsync wrong. Your should use the highest Hz, not 60. Gsync doesn’t work well if you put your monitor at a lower Hz. If you have a 144Hz monitor for example, use 144Hz in retroarch.

1 Like

^ This. If you do that, then disable “Sync to Exact Content Framerate”, RetroArch should output an exact 60FPS, which Gsync will sync to. And then your recording should be 60FPS too.

I know, I mentioned in my post that G-Sync itself at native refresh rate (240/239.970 Hz) works flawlessly with all games. The issue isn’t with getting G-Sync to work, it’s with getting the recordings to be as smooth as possible in OBS.

So I just finished running some tests at my estimated refresh rate (239.970 Hz) with “Sync to Exact Content Framerate” (STECF to make life easier) on and off over different systems/cores to see what happened across both RA and OBS:

  • NES and SNES cores automatically set the refresh rate to 60.099 Hz (matching console output), which caused nasty frame juddering on OBS and horrible noise crackling.
  • N64 core set the refresh rate to a clean 60.000 Hz; no noise popping and minimal (if any) frame issues.
  • GBA and Genesis cores didn’t change my refresh rate at all; they had no audio problems, but would often overshoot the 60 FPS mark and cause the same frame issues as NES/SNES, which leads to my key takeaway:

Games that do not exceed 60 FPS in any circumstance have minimal issues with OBS capture. This holds true even if STECF is enabled for full G-Sync benefit.

The main problem is getting any game to just run at exactly 60 FPS; everything seems to cap out at 59.86 when the window is focused (exclusive fullscreen with G-Sync indicator on), or 59.90 FPS when I alt-tab out of RA to make it out of focus but still playable (G-Sync indicator changes to “Normal”). Running at native refresh rate with STECF enabled actually caps SNES and NES games at the 60.1 FPS mark, so if I can figure out how to reach 60 on the dot, that’ll solve everything.

Another important side note for anyone else who might come across this: if STECF is enabled and the game is running around, say, ~34 FPS (e.g. DK64’s intro animation after the DK rap but before the main menu), the OBS preview will look incredibly choppy as it is also displaying at an identical Hz as the game’s framerate (despite being on a secondary monitor that should remain fixed at 144 Hz). The OBS preview is completely misleading in this state; the recordings are still perfectly smooth when played back, and further shows that problems only arise as soon as the framerate exceeds the recording capture rate of 60 FPS. This even happens in any modern titles such as L4D2, which has an intro sequence that plays at 24 FPS and thus also makes my other monitor run at 24 Hz alongside my actual G-Sync monitor when G-Sync is enabled (not idea why on Earth this is the case, but it’s easy to see based on the audio meters running at a similar framerate). The recordings thankfully came out perfect regardless.

All I need to do now is figure out how to stop SNES games like DKC2 from popping occasionally at 60 Hz. @hunterk I tried to use the default configuration file, but it never saved my changes between the main menu and cores. It also has weird default settings like running in windowed mode by default and having windowed fullscreen enabled instead of exclusive. I’ll try taking another look tomorrow to see if the audio pops still happen on a default config.

Try disabling g-sync, then also disable the “sync to exact” option in RA, and then when running the display at 240Hz set the “vsync swap interval” to 4 in the RA video synchronization settings.

Also, in OBS, use 59.94FPS instead of 60 since it’s unlikely your monitor is actually using exactly 240Hz. It’s usually something like 239.8Hz or so.

When you do all that, you should be able to still get good input lag (due to 240Hz scanout speeds) but the sync to 59.94FPS should be quite good (due to vsync swap interval of 4.)

Btw, make sure you don’t use the Vulkan driver for this. Use glcore or DX11. Vulkan doesn’t properly support vsync swap interval.

Finally, to test your true effective refresh rate, you can use this test:

https://www.testufo.com/refreshrate

Turn g-sync off in the NVCP before you do this. Even if g-sync is not actually active, it does affect the Hz of the monitor very slightly if it’s enabled in the nvidia panel. You should be able to tell if you do the test twice. Once with g-sync off and once with g-sync on in the nvcp.

2 Likes

Thanks for the info!

I’m having trouble understanding how the swap interval tip will work. With both G-Sync and STECF off, wouldn’t RA automatically set my refresh rate to the console output as it already does now (i.e. NES/SNES being set to 60.099 Hz, N64 at 60, etc.)? Or does the swap interval setting change that process by keeping my estimated refresh rate intact without the core modifying it on game load?

Wouldn’t the 59.94 FPS suggestion result in similar frame pacing issues? At most the games seem to be capped at 59.90 FPS, so there’s still a mismatch between the desired and captured framerates. It’d also be more of a pain for YouTube/Twitch to do any frame conversions down the line if they’re forcing 60 FPS playback, too.

I am in fact using Vulkan, primarily because of the ParaLLEl RDP for my N64 core which doesn’t use other graphics drivers (plus I have my shaders for all cores set up under slang, IIRC). If I do get round to testing these, which is preferable between glcore and DX11?

That refreshrate test showed that my G-Sync refresh rate was ~239.678 Hz, and G-Sync disabled = ~239.974 Hz, which is very close to the estimated refresh rate reported in RA (239.970 Hz). I had no idea G-Sync could cause that discrepancy.

Disabling “sync to exact content framerate” and using either 60Hz mode with swap interval 1, or 240Hz with swap interval 4, will make the games run at your monitor refresh rate, or at one quarter of your monitor refresh rate. They will not run at 60.1, or anything else.

This should improve OBS capture and make the games smoother without stutters. Just try it and see if helps.

What swap interval would I use for a 360hz monitor? I see it only goes up to 4.

edit: Tried 240hz (gsync disabled) with swap interval 4 and there is noticeable stuttering with both glcore and d3d11 in the 240p test suite using genesis plus gx.

For 360Hz you need swap int 6. I don’t know why RA only allows up to 4 though.

I don’t know why it stutters for you. Maybe you have the “preferred refresh rate” set to “highest” in the nvcp and thus get 360Hz instead of 240? Or maybe you forgot to disable the “sync to exact” option in RA?

Also, are you trying to fix OBS issues? Because if not, you should get best results with gsync at 360Hz instead.

I’m trying to use fixed refresh for the cores that don’t play nice with gsync such as n64 and dreamcast. These cores also have pretty high input lag at 60hz so I would like to see if I could reduce that by using a higher fixed refresh rate.

I have the monitor display the current refresh rate and it’s definitely at 240. I also have the “sync exact” option disabled.

If you also have g-sync disabled in the nvidia panel, then it should work. I don’t know if there’s an issue with 240Hz. I have a 165Hz display, and it works fine here if I use 120Hz and swap int 2 as a test. I’m on Linux though.

I just saw this right now:

https://github.com/libretro/RetroArch/issues/6219

So it seems at least DX11 swap int was broken? It’s fixed now so maybe try latest nightly.

I finally got round to testing and found a solution!

TL,DR: Disable G-Sync in Nvidia Control Panel.

@RealNC your tip about G-Sync slightly changing the refresh rate of the monitor turned out to be the key. With G-Sync on, my estimated refresh rate on the testufo site was 239.678 Hz; with G-Sync off, it was 239.974 Hz, so a rough difference of ~0.296 Hz.

In pretty much any case outside of RetroArch, this straight-up doesn’t matter, but with RetroArch it makes all the difference when it comes to getting as close to 60 FPS as possible. The reason I was capping out between 59.86 - 59.90 FPS was simply because of G-Sync being enabled in NVCP, even if I wasn’t using STECF in RA.

Disabling G-Sync (Fixed Refresh Rate option) in NVCP fixed this low FPS cap.

Now my recordings are 99% perfect.

My games now consistently hit around 59.99 FPS, which is more than acceptable for both playing and recording purposes. There are some extremely minor frame issues in OBS every so often as it doesn’t seem to be an exact 60 FPS, but it’s nowhere near as noticeable or detrimental as having G-Sync on. So, big thanks to RealNC for telling me about that G-Sync refresh rate offset!

My only question now is whether it’s better to use native refresh rate or just 60 Hz (both with swap interval set to 1, as 4 caused some audio stutters on N64 games with Vulkan in use). SNES still sets itself to 60.100 Hz, for example, but having G-Sync disabled means it no longer gives off any audio pops because the small (but significant for RA) deviation is now minimised. I imagine the input lag should be functionally identical between both options, too.