I just want to get started, what do I need to download?
If you don't need the nitty gritty details of how it all comes together, here are the basic requirements and steps to get up and running.
- Download and install Sunshine on the host machine.
- Download and install ViGEmBus on the host machine if you want controller support. This is entirely optional, but strongly recommended.
- Download and install Moonlight on the client device.
- Launch Moonlight on the client device and connect to the Sunshine host.
- Adjust the resolution, framerate, and bitrate as needed.
What is in-home streaming?
In-home streaming lets you run apps or play games from your computer directly on another device like a TV, phone, or tablet. It captures and streams your computer's audio and video in real time. It also sends inputs like mouse clicks, keyboard presses, touchscreen taps, or gamepad commands back to your computer. It's similar to remote desktop but optimized for smooth, real-time interaction.
With a strong network connection and devices that can handle the encoding and decoding, you can stream 4K HDR content at 120 FPS with nearly unperceivable milliseconds of delay.
What are Sunshine and Moonlight?
Sunshine is a streaming server that captures and encodes the video and audio from your computer, then streams it to devices like laptops, phones, media boxes, and even certain game consoles. Moonlight, on the client device, decodes this stream and makes sure it plays smoothly on your screen.
Platforms like Parsec and Steam In-Home Streaming may be slightly easier to setup, but Sunshine and Moonlight offer what is arguably the best performance and image quality on the market.
What you'll need for a smooth experience
For the best possible experience, you'll want both the host and client on a wired connection but you can definitely get great results on wifi as long as the network is capable.
However, I've never had good results having both the client and host on wifi. If that's all you have, don't let that discourage you. There are some settings you can adjust to reduce the overhead and handle network dips.
You'll also need compatible hardware. The host machine needs to be powerful enough to encode the video in realtime without significantly degrading performance, and the client needs to have the hardware that can decode that stream quickly. In general, the faster the devices, the less input delay you'll feel as it will cut down on processing time.
Ideally, you want both devices to support AV1 or H.265/HEVC hardware decoding. There are fallback encodings, like H.264, available should you be using older devices, but these aren't as effecient.
Limitations
There's a couple of things you should keep in mind when it comes to streaming:
- Encoded audio formats like Dolby Atmos and DTS are not supported. Surround sound in 5.1 or 7.1 channels is only possible via PCM.
- Media with digital rights management (DRM) cannot be captured or streamed.
- Expect some visual degradation. The amount will vary with the encoder, bitrate, and quality settings.
- There will always be some latency. It's usually not enough to cause issues but you probably won't be playing any competitive shooters while streaming.
- High quality streams can require a lot of bandwidth and decently powerful hardware.
Installing and configuring Sunshine
Installation
Sunshine is available on Windows and offers builds for various Linux flavors. Assuming you're on Windows, you'll have the option to either install the full package or run it portably:
- The full installation package (sunshine-windows-installer.exe) will configure Sunshine as a service which will allow it to run on the login screen. The full package also includes the Steam audio device drivers and other useful tools. By default, this is the installation I recommend for ease of use.
- The portable package (sunshine-windows-portable.zip) can be run locally without administrative permissions, but it lacks some of the features the full installation provides.
After the installation, and unless configured otherwise, Sunshine will run a web service for its UI on port 47990. You can access is by navigating to https://localhost:47990
on the host machine's browser.
You'll need to select a user ID and password on your first login. Take into consideration that an attacker would have full access to your machine if cracked, so take the time to choose secure ones.
Audio sink
The audio sink (not to be confused with audio sync) is the audio device Sunshine will capture from. When you connect to Sunshine, it automatically sets this device as your output.
By default, the audio sink is set to the Steam Virtual Audio Speaker, which is a virtual device that essentially has no physical speakers attached to it, which prevents audio from playing on the host machine when streaming.
Should you need to use another output, a list of available devices can be found by running audio-info.exe in the Sunshine tools folder, by default located at:
C:\Program Files\Sunshine\tools\audio-info.exe
Note that audio-info.exe cannot be run directly and should be launched from a command prompt or via PowerShell. An easy way to do this is to a command prompt and drag the executable into the window.
Virtual sink
Think of the virtual sink as an extra audio pathway you can use if you want to separate certain sounds or mix additional audio without impacting what's streamed. For example, it can be used to keep specific sounds local to the computer or to mix in other audio for streaming.
By default, the virtual sink is configured to use a silent device (the Steam Virtual Speaker) and for regular use, leaving it as-is will work perfectly well.
HEVC and AV1 Support
HEVC (High Efficiency Video Coding), also known as H.265, usually delivers better quality at lower bitrates than H.264, but it does require hardware support. The good news is that most modern devices can handle it. If your client device seems to be struggling, try turning off HEVC in the Advanced settings to see if it helps. Just keep in mind that HDR streaming requires HEVC to be enabled.
AV1 is a relatively newer codec that can, if you believe the marketing hype, can deliver up to 30% better performance than H.265 at the same bitrate. If both your host and client devices support it, AV1 can offer smoother streaming with fewer visual artifacts. From what I've found, AV1 support was added starting with the Nvidia RTX 30 series and the AMD RX 6800 series, but it's a good idea to double-check what your specific devices can handle.
Advanced encoding settings
In the vendor-specific encoding tabs are series of preset quality and compression settings. Unless your devices are struggling to encode or decode the stream, or you want to improve the image quality at the expense of an increase in input delay, leave these as-is. They've already been optimized to offer the fastest response.
With that said, in most cases you should be able to bump up the quality presets by one or two with little impact. This is very much dependant on your own configuration but it may be worth trying if image quality is a concern.
Use realtime priority in hardware accelerated gpu scheduling
Hardware-accelerated GPU scheduling (HAGS) is a Windows feature that lets the GPU manage its own scheduling, instead of relying on the CPU. This can help reduce latency and CPU load, often improving performance in certain games.
That said, on NVIDIA devices under heavy load, HAGS can sometimes interfere with real-time video encoding. When this happens, the video stream might suddenly freeze while the audio keeps playing.
From what I understand — and I could be wrong here — the issue may come down to competing real-time tasks. When the GPU is low on memory, the task scheduler and the video encoder might fight for resources. Disabling the "Use Real-Time Priority in Hardware-Accelerated GPU Scheduling" setting lowers the video encoder's priority from "realtime" to "high." This can stop the stream from crashing, though it might introduce stuttering or lag during heavy GPU usage.
Controller support
If you plan on using a controller, you'll need to install ViGEmBus on your host. The driver emulates a peripheral and is compatible with Sunshine. It does not require any configuration or customization. Install it and you're done.
ViGemBus is being retired due to a copyright dispute, but should still work fine until a viable alternative is made available.
Network buffers
There are a few optimization guides floating around Reddit that suggest increasing your network adapter's TX (transmit) and RX (receive) buffer sizes. In networking, these buffers temporarily hold outgoing (TX) and incoming (RX) data. They help smooth out data flow and reduce the chance of packet loss, especially under heavy network load.
- Large buffers can introduce delays, since data might sit in the buffer longer before being sent or processed. This added latency can be noticeable in real-time applications like gaming.
- Smaller buffers reduce latency but can increase the risk of data loss if the buffer overflows, especially on slower or congested networks.
Unless your network is really struggling and you're seeing a lot of dropped packets, don't mess with buffer sizes. Sunshine and Moonlight already use Forward Error Correction (FEC) to handle packet loss during streaming. If you're having issues, try bumping up Sunshine's FEC value and see if that helps.
Installing and configuring Moonlight
Installation
Moonlight is available on phones, TV boxes, consoles, Linux, Windows, and various other systems. I won't go into the specifics for its installation but its all very straightforward. For the sake of this article, I'm assuming your client is a Windows machine but the configuration is pretty much the same for all platforms.
Its installation does not require anything in particular.
Adding a host machine
When you first launch Moonshine, it should automatically discover active Sunshine installations on your network. If that's not the case, as it often is for me, you can manually add a device using the host machine's network IP.
When connecting to a host for the first time, Moonlight will generate a four-digit security PIN that has to be entered in the Sunshine GUI's "PIN" section to validate the connection. You should only have to do this once.
Resolution and framerate
The resolution and refresh rates specified here refer to the client's video stream and will not impact the host machine. For example, if your host is sending out a 4K signal but your client can't display that, you can compress it down to 1080p to save on bandwith and processing.
Where possible, try to match the client and host resolutions to avoid scaling. If you're streaming to a mobile device, you can adjust this setting to match the device's resolution if desired.
Bitrate
The optimal bitrate depends largely on the resolution, framerate, network speed, and the capabilities of the host and client. Moonlight will provide a suggestion as you change the resolution and refresh rates but I find these to be pretty conservative and can usually be bumped up quite a bit.
If the host and clients are both on a wired connection and have decent hardware, you can consider setting the bitrate to 60-80 or higher, depending on the resolution. In my experience, a 4K stream at 60 frames per second will start seeing diminishing returns around the 120 Mbs range, but you can go much higher (up to 500 following a recent update) if you want to keep compression artifacts to a minimum.
As a general rule, try Moonlight's suggested rate and increase it a little if you find the image quality isn't up to par.
The greater the bitrate, the greater the bandwidth and processing power required to encode and decode the stream. If your devices or network struggle to keep up, reduce the bitrate, resolution, and/or frame rate.
V-sync
As it can potentially add a slight input delay, v-sync should only be enabled if you're experiencing tearing. In my experience, this is typically more of an issue on client devices with 60hz displays than it is at 120hz or higher.
Where possible, try to match the host and client's refresh rates ratios. For example, if the host outputs 144hz but the client can only display 60hz, change the host to 120hz so it divides cleanly (2:1) to 60hz on the client to prevent tearing and juddering.
Keep in mind that encoding framerate is variable. That is to say that if there's a lot of movement on screen, the framerate will adjust to match. No movement, no need to encode new frames since the image is the same. This fluctuation can cause tearing. It's a lot more apparent when doing remote work than it is playing games, so your mileage may vary.
You should disable your game's vsync options when streaming.
Decoder settings
Unless you're using an old client that does not support hardware video decoding, leave these as-is. On connection, Sunshine and Moonlight will automatically negotiate and figure out what encoder to use.
If your device struggles with H.265, you may find some respite with H.264 at the cost of image quality. Conversely, some devices may find that H.264 offers lower latency than H.265 so give it a shot!
Surround sound
To get surround sound on the client, adjust the number of channels in Moonlight's Audio Settings accordingly. The host's audio sink must be able to output the number of desired channels. The default device, Steam Virtual Speaker, supports up to 7.1 channels.
If you've specified a custom audio device as the audio sink, you may need to configure Windows to output to the correct number of channels as well.
Encoded bitstream signals like Dolby Digital, DTS, and Atmos are not supported. Surround sound is only possible via PCM in 5.1 or 7.1.
Virtual displays
If you want to stream with your monitor turned off or need features, resolutions, or refresh rates that your current display doesn't support, virtual displays can bridge the gap. In short, virtual displays trick your PC into believing a monitor is plugged in, which in turn can be captured by Sunshine.
On the hardware side, there are physical dummy display plugs that connect via HDMI, DisplayPort, or USB-C. Dummy plugs are inexpensive, can be purchased online, and are the simplest way to create a virtual display at the cost of limited features.
Software solutions like SudoVDA and Virtual Display Driver are viable options as well and are relatively quick and painless to setup.
There's also a fork of Sunshine, Apollo, that includes a built-in virtual display, amongst other interesting features, that may streamline the process.
Accessing Sunshine through the internet
By default, Sunshine can only be accessed from machines on the local network. However, it can be configured so you can connect to your machine from anywhere.
Exposing a remote desktop solution to the internet is not something you should do carelessly. If compromised, it could allow full control your PC. Use complex, unique passwords and usernames to prevent brute force attacks.
In most home networks, enabling external access only requires that you enable Sunshine's UPnP setting. Universal Plug and Play (UPnP) automatically configures your network, adds a rule to the firewall, and forwards connections to the appropriate ports automatically. To enable the feature, navigate to the Sunshine GUI and enable UPnP in the General tab. You should not need any other software, nor any other networking solutions like Tailscale.
Should your network not support UPnP, you'll need to manually configure your firewall and forward network traffic to the machine. The following table outlines the ports Sunshine needs to operate.
Description | Port | Protocol |
---|---|---|
HTTPS | 47984 | TCP |
HTTP | 47989 | TCP |
Web | 47990 | TCP |
RTSP | 48010 | TCP |
Video | 47998 | UDP |
Control | 47999 | UDP |
Audio | 48000 | UDP |
If you need to configure Sunshine to utilize ports other than the default set, check the Sunshine Documentation guide for more information.
Once everything has been configured, you'll need your public IP address. You can use web-based services like What Is My IP to find it. Use that address when adding a new PC in Moonlight. If you've already added that machine from your local network, it should automatically add the public IP to the existing configuration.
Useful shortcuts
Depending on the platform you're using, there are a few shortcuts available in Moonlight that can be quite helpful. You can find a full list of them on the Moonlight Github wiki but I've listed the ones I use regularly below.
Gamepad
Shortcut | Description |
---|---|
Start (Hold 2 secs.) | Toggle virtual mouse mode |
Start + Select + L1 + R1 | Disconnect the client |
PC/Windows
Shortcut | Description |
---|---|
Ctrl + Alt + Shift + D | Minimize the client window |
Ctrl + Alt + Shift + Q | Disconnect the client |
Ctrl + Alt + Shift + M | Toggle mouse capture mode |
Ctrl + Alt + Shift + S | Toggle on-screen performance display |
Ctrl + Alt + Shift + X | Toggle fullscreen/windowed mode |
Ctrl + Alt + Shift + Z | Toggle spcial key capture (alt-tab and the like) |
See also
-
How to configure Sunshine to automatically match the client's display resolution
Eric Niquette | Niquette.ca
-
How to configure Sunshine to automatically switch displays
Eric Niquette | Niquette.ca
-
How to reboot, shutdown, or log off from your PC with Moonlight and Sunshine
Eric Niquette | Niquette.ca