Sunshine · game streaming

Also known as: Sunshine game stream host

On this page 7

Sunshine is an open-source, self-hosted game streaming host: software installed on a gaming computer that captures the screen, encodes it as video in real time and streams it, together with audio, to client devices running Moonlight. It sits beside cloud gaming in the same family of technologies, but instead of renting a remote data-center server, the player turns their own PC into the streaming server.

Sunshine implements a host compatible with the NVIDIA GameStream protocol, which Moonlight was originally built for. When NVIDIA retired GameStream support from GeForce Experience, Sunshine became the most common way to keep using Moonlight, and it also works with AMD and Intel graphics, not only NVIDIA cards. It is sometimes described simply as a Sunshine game stream host.

How Sunshine streams a game

Sunshine streams a game by running a capture, encode and transmit loop for every frame. It grabs the rendered desktop or game output, passes it to a video encoder, packetizes the result and sends it over the network, while it receives input from the client and injects it back into the host system.

  1. Capture: the host grabs frames through Desktop Duplication on Windows, or KMS, X11 or Wayland capture on Linux.
  2. Encode: a hardware encoder compresses each frame to H.264, HEVC or AV1.
  3. Transmit: video and audio travel mostly over UDP, with forward error correction to tolerate packet loss.
  4. Input: Moonlight sends mouse, keyboard, touch and gamepad events back, and Sunshine creates virtual input devices on the host.
  5. Decode: the client decodes the stream in hardware and shows it with minimal buffering.

Because every stage adds delay, the total motion-to-photon latency depends on the encoder, the network and the client decoder. On a wired local network the added delay is commonly in the range of a few milliseconds to about 20 ms, which most players do not notice outside competitive shooters.

Encoders, codecs and platform support

Sunshine relies on the graphics card’s dedicated video encoder so that streaming costs little game performance. A software encoder exists as a fallback, but it loads the CPU heavily and suits only low resolutions or weak hosts.

EncoderHardwareNotes
NVENCNVIDIA GeForce and RTX cardsMature, low latency, AV1 on newer generations
AMFAMD Radeon cardsHEVC recommended, AV1 on recent models
Quick SyncIntel integrated and Arc graphicsEfficient, AV1 on Arc and newer chips
VA-APIAMD and Intel on LinuxStandard Linux video acceleration interface
Software (x264, x265)Any CPUHigh CPU load, last resort
Encoder backends used by Sunshine

Codec choice is a trade-off between efficiency and compatibility. HEVC and AV1 deliver better image quality at the same bitrate than H.264, but the client must decode them in hardware. Sunshine runs on Windows and Linux, with macOS support considered less complete, and supports HDR streaming when host, encoder and client all handle 10-bit video.

CodecEfficiencyClient support
H.264Baseline, needs the most bitrateNearly universal
HEVC (H.265)Roughly 30-40% better than H.264Most modern devices, needed for HDR
AV1Best efficiency of the threeRecent GPUs, phones and TVs only
Codec comparison for Sunshine streams

Sunshine compared with other ways to stream games

Sunshine belongs to the local or self-hosted streaming category, and its value becomes clear next to commercial cloud gaming and other remote play tools in the same Topic.

OptionWhere the game runsKey difference
Sunshine with MoonlightPlayer’s own PCOpen source, any game or desktop, any GPU vendor
Steam Remote PlayPlayer’s own PCBuilt into Steam, simpler, fewer tuning options
PlayStation Remote PlayPlayer’s PlayStation consoleConsole only, Sony clients
GeForce NOWData-center serverSubscription, no local hardware needed
Shadow PCRented full cloud PCComplete remote Windows machine
Sunshine and related game streaming options

The main advantage of Sunshine is control and cost: no subscription, no game library restrictions and full access to the host’s installed games, launchers and mods. The main limitation is that the host PC must be powered on and reachable, and image quality outside the home depends on the host’s upload bandwidth.

Setting up and tuning a Sunshine host

A Sunshine host is configured through a local web interface, by default on port 47990, where the administrator sets credentials, pairs clients and defines applications. Pairing uses a PIN shown in Moonlight and entered on the host, which establishes a trusted certificate between the two devices.

  • Applications list: entries such as Desktop or Steam Big Picture, optionally with commands that run before and after a session, for example changing the display resolution.
  • Network ports: TCP 47984, 47989 and 48010 plus UDP 47998-48000 must be reachable; for internet use a VPN such as WireGuard is safer than opening ports.
  • Virtual gamepads: on Windows a virtual controller driver lets games see an Xbox-style pad.
  • Display matching: streaming at the client’s native resolution and refresh rate avoids scaling blur.

Bitrate is the most important quality setting. As a rough guide, 20-40 Mbps for 1080p at 60 fps and 50-80 Mbps for 4K over HEVC give clean images on a wired network, while Wi-Fi often needs lower values to stay stable.

Limitations and common problems

Most Sunshine problems come from the network or the host display configuration, not from the software itself. The table lists typical symptoms and fixes.

SymptomLikely causeFix
Stutter and dropped framesCongested Wi-Fi or excessive bitrateWired connection, lower bitrate, 5 GHz or 6 GHz band
Black screenNo active display or wrong capture methodDummy display plug or virtual display driver
Blurry imageResolution mismatch or low bitrateMatch client resolution, raise bitrate
Cannot connect remotelyPorts closed or carrier-grade NATVPN mesh or proper port forwarding
Game rejects inputAnti-cheat blocks virtual devicesCheck game support, use another title
Typical Sunshine streaming issues

Security deserves attention: exposing the web interface to the internet is a real risk, so it should stay on the local network. Some games with strict anti-cheat also treat virtual input with suspicion.

The idea in brief

Sunshine is a free program that turns a gaming computer into a personal streaming station. The computer runs the game, and Sunshine sends the picture and sound to another screen, such as a laptop, phone, tablet or television, much like a live video call.

When the player presses a button on the far device, the press travels back to the computer instantly. The result is that heavy games can be played on light devices, as long as the home network is fast and steady.

A practical scenario

A player keeps a desktop PC with an RTX graphics card in a home office but prefers to play on the living-room television. She installs Sunshine on the PC, connects it to the router by cable and pairs a Moonlight client on the television box with a four-digit PIN.

She streams at 4K and 60 fps using HEVC at 60 Mbps, adds Steam Big Picture as an application and sets a pre-launch command that switches the PC display to 3840 x 2160. Her controller connects to the television box, and Sunshine presents it to games as a virtual Xbox pad. Measured added latency stays near 10 ms, so action games feel responsive, and the result is console-like play on the couch without buying a second gaming machine.