How I Got Sunshine/Moonlight Working On My Headless Windows 11 PC

This is less a tutorial and more a collection of notes on how I managed to get this working, mainly because I figure at some point I'm going to reinstall Windows and I'll need to know how I did things. Unless I go ahead with my plan to install Linux, in which case I won't need these notes. Anyway, let's dig in... Step The First - Install Sunshine Source:  https://github.com/LizardByte/Sunshine Just... Follow the instructions there. Download the thing, install the thing, set a password, and get moving. Step The Second - Install The Virtual Display Driver Source:  https://github.com/itsmikethetech/Virtual-Display-Driver Again, follow the instructions on the page. One step they leave out is edit the option.txt  to include the resolution/refresh rate you want. I suppose you could go so far as to remove all the ones you won't  be using, but I didn't because maybe Windows will need to fall back to a different resolution because it's being weird. But make sure the ...

Streaming Setup, Trouble Shooting, and Solutions

This is probably going to be a little dry for a post, but I figure I should document the problems and solutions somewhere, in the hopes that when I have them again I can refer to my notes to fix them - and in the off chance it helps someone else as well.

The Setup

Nothing super fancy - Using Stream Labs OBS on my rig.

The Problem(s)

When streaming from SLOBs, I was getting two different, yet related, issues.

The first issue was when streaming for any "modern" game, or a game that used the GPU in any significant way, SLOBs was dropping frames like mad. On my end, the frame rate for the game was a steady 60 fps+ (or in some cases, 120 fps+), but SLOBs was not able to get out of the low 10s.

If SLOBs was the active window, or the window with focus, it was sending a steady 60fps to Twitch. The moment it lost focus, the frame rate tanked.

The other, related, issue was if I had the webcam active, SLOBs took yet another performance hit.

The Troubleshooting

I adjusted the priority of the process, setting it to "highest" in the advanced settings tab, and this only partially fixed the issue.  I also changed from GPU to CPU rendering for the SLOBs video, and although it's CPU usage went up, CPU usage for the PC overall never got above 30% total, while GPU was pegged at 100%.

The Solution


Setting the refresh rate of my monitor to 60Hz. That's it, that's what fixed it.

Once I set that, it worked. I could play whatever I was trying to play, either at 1080p or 1440p, with the webcam enabled, and SLOBs was more than happy and able to pump out the full 60 fps to Twitch.

But switching the refresh rate every time I wanted to stream was a pain in the ass, so some automation was called for.


A friend of mine pointed me at 12 Noon Display Changer, a bit of freeware which does what it says on the tin: It changes your display settings without having to muck about in menus.

I created a small Powershell script to have it set the refresh rate down to 60Hz, and then launch SLOBs.  Once SLOBs exits, Display Changer automatically sets the display back to max refresh rate (in my case 144Hz).  I then set up a function on my Stream Deck to run that Powershell script.

Below is the Powershell script for anyone who may need it:

#Windows PowerShell Script to launch Display Changer, set the refresh rate to 60hz, and then launch SLOBS

#Using information found at:
#https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx

#Program to launch
$CMD = 'D:\Program Files (x86)\12noon Display Changer\dc64.exe'

#First argument will be to tell dc64 to set the display rate to 60hz
$arg1 = '-refresh=60'

#Second arugment will be to pass the location of SLOBS so it can be launched

$arg2 = 'D:\Program Files\Streamlabs OBS\Streamlabs OBS.exe'

#Now we put it all together and run the dang thing

& $CMD $arg1 $arg2



And here's what's needed to get it running via the Stream Deck:

powershell -ExecutionPolicy ByPass -File D:\scripts\launch_stream_60.ps1