Introduction
Game streaming from a PC to a Raspberry Pi is possible using Sunshine and Moonlight. Sunshine runs as a server on a Windows PC with an NVIDIA GPU. Moonlight acts as the client on the Raspberry Pi. Together, they create a low-latency streaming setup for local or remote play.
Raspberry Pi 4 and 5 support Moonlight Qt, which receives game streams encoded with H.264 or HEVC. Video decoding, controller input, audio sync, and resolution scaling all happen in real time. The Raspberry Pi OS supports this setup using packages installed from terminal commands.
Sunshine hosts the application library. It allows users to add launchers like Steam, standalone game executables, or even the entire desktop. The system uses a PIN to pair devices securely over a local network. For internet use, users configure VPNs, static IPs, or port forwarding.
Network bandwidth, encoder settings, and display resolution affect performance. Raspberry Pi 5 offers better frame pacing and thermal efficiency than Pi 4 due to improved hardware. Both devices can handle 1080p 60FPS over Ethernet.
Key Takeaways
- Raspberry Pi 4 and 5 can stream PC games using Sunshine and Moonlight over local or remote networks.
- Sunshine runs on the PC and hosts your game library; Moonlight receives the stream on the Pi.
- Ethernet provides the best results, especially for 1080p or 4K streams.
- Pi 5 handles higher resolutions and bitrate better than Pi 4.
- VPNs like ZeroTier or Tailscale help enable secure remote streaming.
- PulseAudio must be running, and GPU memory should be set to 128 MB on the Pi for best performance.
- Sunshine doesn’t require GeForce Experience and supports a wider range of GPUs.
What You’ll Need Before You Start
Setting up game streaming with Sunshine and Moonlight on Raspberry Pi takes a few core pieces of hardware, software, and network setup. Each part matters for stability, input response, and stream quality.
Hardware Checklist
| Item | Purpose |
|---|---|
| Raspberry Pi 4 or Pi 5 | Client device for Moonlight |
| microSD card (32GB+) | OS and package storage |
| Power supply (27W USB-C) | Stable power during streaming |
| HDMI or microHDMI cable | Video output to monitor or TV |
| USB game controller | Game input during streaming |
| Keyboard and mouse | For setup and fallback control |
| Display (1080p or 4K) | Output device for gameplay |
| Case with cooling (fan) | Keeps Pi cool under GPU load |
| Ethernet cable | Network stability over LAN |
| Router (Wi-Fi 5 or 6) | Required for wireless connection |
Note: Raspberry Pi 5 requires dual microHDMI and newer USB-C power. Pi 4 uses microHDMI and lower power input.
PC Host Requirements
- Windows 10 or 11 (64-bit recommended)
- NVIDIA GPU (GeForce GTX 600 series or newer)
- GeForce Experience or Sunshine server
- Game library (Steam, Epic, GOG, etc.)
- Headless dongle (if PC runs without a monitor)
- Audio output device configured
Network Requirements
| Network Feature | Function |
|---|---|
| Ethernet (preferred) | Lowest latency and stable bitrates |
| Wi-Fi (5GHz min) | Usable for short distances |
| UPnP on Router | Helps with automatic port forwarding |
| Internet upload >5Mbps | Required for remote streaming |
| Local IPv4 address | Needed to pair Moonlight with Sunshine |
| VPN or Meshnet | Secure remote access (ZeroTier, Tailscale) |
Operating System (Client)
- Raspberry Pi OS (32 or 64-bit)
- Compatible with Moonlight Qt
- Uses PulseAudio for sound
- Package manager:
apt
Step 1: Set Up the Raspberry Pi
Moonlight requires a functional OS, video output, audio service, and enough GPU memory to decode the stream. Raspberry Pi 4 and 5 both support these features through Raspberry Pi OS with a few adjustments.
Flash Raspberry Pi OS
Use Raspberry Pi Imager:
- Download Raspberry Pi Imager from the official site.
- Insert the microSD card into your computer.
- Select Raspberry Pi OS (64-bit preferred).
- Flash the image to the card.
- Insert it into your Pi and boot.
Optional: Enable SSH and Wi-Fi before first boot
Use the advanced settings in Imager to preload credentials.
Update the OS
After the first boot, open the terminal and run:
sudo apt update && sudo apt upgrade -y
This brings all system packages up to date and ensures driver compatibility.
Adjust GPU Memory
By default, GPU memory may be too low for game decoding. Add this line to your config:
echo "gpu_mem=128" | sudo tee -a /boot/config.txt
Then reboot:
sudo reboot
Enable Audio Output
Moonlight relies on PulseAudio for sound. Ensure the service is running:
systemctl --user enable pulseaudio
systemctl --user start pulseaudio
Test with:
paplay /usr/share/sounds/alsa/Front_Center.wav
Connect Controller and Display
- Plug in your game controller via USB or Bluetooth.
- Use HDMI or microHDMI to connect the Pi to a TV or monitor.
- Set display resolution to 1080p in Raspberry Pi OS display settings for best results.
Step 2: Install Moonlight on Raspberry Pi
Moonlight Qt is the client that runs on the Raspberry Pi. It handles video decoding, audio playback, and controller input. Once connected, it mirrors the game or desktop session from your PC over the local network.
Install Moonlight Qt
Open a terminal and install the package:
sudo apt install moonlight-qt -y
This command installs Moonlight from the Raspberry Pi OS repository. After install, the app can be found under the Internet or Games menu.
Optional: Add a Shortcut
To make launching easier, right-click Moonlight in the app menu and add it to your desktop or taskbar. You can also start it from the terminal by typing:
moonlight-qt
Pair with Sunshine on the PC
Find the local IP address of the PC running Sunshine. On the Raspberry Pi, open Moonlight and select Add Host. Type in the PC’s IP address and press OK. A pairing request will appear with a 4-digit code. Enter that code on the PC when prompted.
Once paired, Moonlight pulls in the application list from Sunshine. If no apps show up, restart both programs and confirm that Sunshine is running on the PC.
Start Streaming
After pairing, select an app, Steam, or the full desktop. Click to start the stream. Choose a resolution and bitrate that matches your display and network speed. Most setups work well at 1080p and 30–60 FPS.
Step 3: Set Up Sunshine on PC
Sunshine runs as the host server. It encodes your screen, launches your games, and sends the stream to Moonlight on the Raspberry Pi. It works best with an NVIDIA GPU, but supports other vendors.
Download and Install Sunshine
Go to the official Sunshine GitHub page. Download the latest release for Windows. Extract the ZIP archive and run the Sunshine.exe file. For automatic startup, right-click the tray icon and enable the “Run on Startup” option.
No installation wizard is needed. Sunshine runs as a standalone executable.
Access the Web UI
After launching Sunshine, open a browser and go to:
http://localhost:47990
Log in using the default credentials. The web UI lets you manage apps, configure bitrate, and adjust resolution. You can change the password under the settings tab.
Add Applications and Desktop Mode
From the web UI:
- Click Apps
- Add a new application (Steam, Epic Games, or any .exe file)
- Set a friendly name, executable path, and working directory
- Use desktop mode if you want full control of the Windows desktop
You can also adjust video and audio settings per app, including resolution, frame rate, and max bitrate.
Set Audio and Controller Devices
Sunshine uses your PC’s default audio output. To test:
- Launch a game
- Confirm that sound plays through the expected device
For controllers, plug them into the Raspberry Pi. Sunshine receives input over the network using the GameStream protocol. No PC-side controller setup is required.
Keep Sunshine Running
Avoid closing the Sunshine tray icon. If you want it always available:
- Enable “Run on Startup”
- Allow through Windows Firewall
- Disable sleep mode on PC
Step 4: Connect and Stream
After pairing Moonlight with your PC, you’re ready to launch a game or the full desktop. At this point, all hardware and software should be connected and configured.
Select an App to Launch
Open Moonlight on the Raspberry Pi. You’ll see the app list pulled from Sunshine. This may include Steam, individual games, or desktop mode. Use your controller or mouse to highlight the one you want, then select it.
Choose Display Settings
Before launching, go into Moonlight’s settings:
- Resolution: Set to 1080p for stability, or 720p on weaker networks
- Frame rate: 60 FPS offers smoother play, 30 FPS saves bandwidth
- Bitrate: Start with 15 Mbps; increase if your network can handle it
Lower settings reduce latency. For Raspberry Pi 4, avoid 4K streams unless the connection is wired and the PC is powerful enough.
Start the Stream
Click the game icon. Moonlight will establish the connection and display the stream on your Pi. Most streams launch fullscreen. If the screen stays black, verify that your Sunshine session is active and the selected resolution is supported by the TV or monitor.
Exit the Stream
Use the default key combo to exit:
Ctrl + Alt + Shift + Q
This returns you to the Moonlight menu. You can remap this shortcut in the Moonlight settings.
Adjust While Playing
If the stream stutters or lags:
- Lower bitrate in Moonlight settings
- Switch from Wi-Fi to Ethernet
- Make sure no other device is using up bandwidth
- Check the CPU usage on both devices
HDMI output should match the display’s native resolution. Audio will come through the monitor or TV if PulseAudio is active and HDMI is selected as the default output.
Optional: Remote Streaming (Outside LAN)
Streaming outside your local network adds a few extra steps. You’ll need to either open ports on your router or use a mesh VPN to connect securely over the internet.
Use Port Forwarding
Most routers support UPnP, but it’s safer to manually forward ports. Log in to your router’s admin page and forward the following from your PC’s local IP:
- TCP 47984
- TCP 47989
- TCP 47990
- UDP 47998
- UDP 47999
- UDP 48000
Assign your PC a static IP or configure DHCP reservation to keep the IP consistent.
Use Dynamic DNS (Optional)
If your IP changes regularly, services like DuckDNS or No-IP let you map a domain name to your dynamic IP address. This way, you don’t have to keep checking the WAN IP.
Secure With VPN or Mesh Network
For safer remote access without port forwarding, install a VPN or mesh system:
- ZeroTier: Creates a virtual LAN across devices
- Tailscale: Uses WireGuard and connects devices with minimal setup
- NordVPN Meshnet: Secure, commercial option with GUI
These tools let the Raspberry Pi see the PC even when they’re on separate networks.
Remote Pairing
When outside the LAN, you must enter the public IP or DNS name into Moonlight manually. Pairing works the same, as long as Sunshine is running and accessible.
Bandwidth and Quality Tips
For remote play, keep these in mind:
- Minimum 5 Mbps upload on PC
- 1080p at 30 FPS is realistic for most connections
- Use 720p if latency is high or the connection drops
- Disable unnecessary background tasks on the PC during streaming
Troubleshooting
Even with everything set up, a few things can go wrong. Most issues are caused by missed steps, weak networks, or unsupported settings. Here’s how to fix the most common problems.
No Video or Black Screen
If Moonlight connects but nothing shows:
- Check that the display connected to the Raspberry Pi supports the selected resolution
- Use 1080p instead of 4K on Pi 4
- Verify Sunshine is running and has the correct app path
- On the PC, make sure a monitor is connected or use a headless display dongle
No Audio
Audio usually runs through HDMI. If there’s no sound:
- Open audio settings in Raspberry Pi OS and set HDMI as the default output
- Confirm PulseAudio is running:
systemctl --user status pulseaudio - Test with a known sound file:
paplay /usr/share/sounds/alsa/Front_Center.wav
Controller Not Working
Moonlight passes controller input back to the PC. If it doesn’t respond:
- Reconnect the controller and restart Moonlight
- Add the user to the input group:
sudo usermod -a -G input $USER - Check if the controller appears in
/dev/input - If using Bluetooth, make sure it’s paired and trusted
High Latency or Stutter
Lag during gameplay usually comes from network issues:
- Use Ethernet instead of Wi-Fi
- Lower the bitrate in Moonlight settings
- Make sure the PC is using hardware encoding (check Sunshine settings)
- Check system load on the PC — streaming and gaming use GPU and CPU
App Not Launching
If a game doesn’t start:
- Confirm the executable path in Sunshine is correct
- Run the game manually once to accept any pop-ups or terms
- Use full desktop mode if individual games won’t launch properly
Differences Between Pi 4 and Pi 5 Performance
Raspberry Pi 4 and 5 can both stream games, but they don’t perform the same. Hardware upgrades in the Pi 5 noticeably affect how smooth and stable your game stream feels.
Video Decoding Capabilities
Pi 5 has a better GPU pipeline with more memory bandwidth. It handles 1080p60 more reliably, especially with higher bitrates. Pi 4 sometimes drops frames at 1080p when bitrate exceeds 30 Mbps.
HEVC decoding is more efficient on Pi 5 due to improved hardware acceleration. On Pi 4, H.264 is more stable, especially over Wi-Fi.
Thermal Performance
Game streaming uses GPU resources. The Pi 5 runs hotter, but it’s more efficient under load. It also throttles less, especially with active cooling.
A Pi 4 with no fan starts thermal throttling after a few minutes of 60 FPS gameplay. A Pi 5 with a small fan handles 1080p for longer sessions without performance dips.
System Responsiveness
During streaming, the Pi 5 keeps desktop interactions more responsive. Opening menus or switching tasks feels smoother. That matters when using desktop streaming mode.
The Pi 4 can lag if background tasks run at the same time as a stream. UI freezes are more common on older builds of Raspberry Pi OS.
HDMI and Display Support
Pi 5 includes dual microHDMI ports with support for 4K60. Pi 4 has 4K30 or 1080p60 per port. If you’re using a 4K TV and want the full resolution, Pi 5 handles it more consistently — but only when wired.
Best Use Cases
Use Pi 4 for:
- 1080p streaming
- LAN play over Ethernet
- Lightweight games or desktop sessions
Use Pi 5 for:
- Higher bitrate streaming
- Faster app switching
- Better Wi-Fi streaming
- Games with fast camera movement or low latency needs
Final Tips
Once streaming is working, a few adjustments can make the experience even better. These tips improve performance, stability, and usability without adding much complexity.
Set a Static IP for Your PC
Your Raspberry Pi connects to the IP address of your PC. If that changes, Moonlight won’t find the host. Set a static IP or configure a DHCP reservation in your router.
Use Ethernet When Possible
Wired connections reduce latency and prevent buffering. If Wi-Fi is your only option, stick to 5GHz and keep the Pi close to the router.
Don’t Skip GPU Memory Configuration
Without gpu_mem=128, the Pi may crash or fail to decode high-resolution streams. This setting helps prevent video glitches.
Avoid 4K Unless Necessary
Both Pis can technically stream 4K, but only Pi 5 does it well, and only with strong Ethernet and a powerful PC. For most setups, 1080p60 provides a better balance of quality and reliability.
Update Often
Software updates fix bugs, improve compatibility, and add features. Run these regularly:
sudo apt update && sudo apt upgrade -y
Also check the GitHub pages for Sunshine and Moonlight for new releases.
Use Desktop Mode if a Game Fails to Launch
Some games don’t launch well directly. Set Sunshine to stream the full desktop, then open the game manually.
Test Audio and Input Early
Before launching your game, play a sound and move the controller. This avoids confusion if one system isn’t responding during gameplay.
FAQ
Can I use a Raspberry Pi Zero or Pi 3?
No. These models don’t have the GPU power or memory bandwidth for smooth game streaming.
Does Sunshine work with AMD or Intel GPUs?
Yes, but GeForce Experience GameStream is NVIDIA-only. Sunshine adds multi-vendor support.
Do I need a monitor connected to my PC?
Not if you use a headless HDMI dongle. Otherwise, Sunshine may not launch games correctly.
Can I stream from Linux instead of Windows?
Yes. Sunshine works on Linux too, but some features (like audio capture) may need extra setup.
Why is the stream laggy on Wi-Fi?
Wi-Fi adds variable latency. Switch to Ethernet for a stable connection and fewer dropped frames.
Can I use a Bluetooth controller on the Raspberry Pi?
Yes, but USB is more reliable. Some Bluetooth controllers may have noticeable input lag.
Will this work over the internet?
Yes, but you need port forwarding or a mesh VPN like ZeroTier. You’ll also need a strong upload speed from your PC.
What bitrate should I use for 1080p?
Start at 15 Mbps. Raise it if the network handles it well. Go lower for Wi-Fi or remote play.
Is it safe to expose Sunshine to the internet?
No. Use VPNs or mesh networks instead of public-facing ports whenever possible.
Can I stream non-Steam games?
Yes. Add any .exe to the Sunshine web UI and it will appear in Moonlight.
References
- Sunshine GitHub Repository
- Moonlight Qt GitHub Repository
- Raspberry Pi OS Downloads
- Tailscale VPN
- ZeroTier
- Tom’s Hardware: Raspberry Pi 5 Overview

