Skip to content
프로젝트

소개

Moonlight 클라이언트를 위한 헤드리스 스트리밍 서버로, Rust로 작성되었습니다.

기타 프로젝트

이 수치를 측정하는 방법

What you can do

  • Isolated streaming sessions: Each stream runs in its own compositor, completely separate from your desktop environment. Your host PC can still be used for other things while you stream.
  • No monitor required: Works on headless servers — no HDMI dummy plug needed.
  • Hardware video encoding: H.264, HEVC and AV1 on the GPU, and PyroWave for the browser stream.
  • HDR: HDR10 (10 bits, PQ) for games that support HDR.

측정된 스타 증가

in 24h
+4
in 7 days
+12
in 15 days
+23
in 1 month
+59

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

CI

Moonshine 🌙

Moonshine lets you stream games from your PC to any device running Moonlight. Your keyboard, mouse, and controller inputs are sent back to the host so you can play games remotely as if you were sitting in front of it.

Features

  • Isolated streaming sessions: Each stream runs in its own compositor, completely separate from your desktop environment. Your host PC can still be used for other things while you stream.
  • No monitor required: Works on headless servers — no HDMI dummy plug needed.
  • Hardware video encoding: H.264, HEVC and AV1 on the GPU, and PyroWave for the browser stream.
  • HDR: HDR10 (10 bits, PQ) for games that support HDR.
  • Full input support: Mouse, keyboard, touchscreen, pen/stylus, and gamepad (including motion, touchpad, and haptics).
  • Audio streaming: Stereo and surround sound (5.1/7.1) with low-latency Opus encoding.
  • Your game library: Scanners find the games of Steam, Lutris, Heroic, the Epic Games Launcher, Bottles and Faugus, and your desktop applications.
  • Gamepads per stream: Each application runs in a sandbox that sees only the gamepads of its own stream.
  • Web control panel: Pair devices, manage applications, change settings and watch live stream statistics.
  • Stream in the browser: Play from the control panel in Chrome, Edge or Firefox, with nothing to install. On a fast network, the PyroWave codec gives the least delay.

The Moonshine control panel during a stream

More screenshots

The Applications page of the control panel The Clients page of the control panel The stream page of the control panel

Requirements

  1. Linux only, x86_64, with glibc 2.39 or newer (for example Ubuntu 24.04+, Debian 13+, Fedora 40+).
  2. bubblewrap and unprivileged user namespaces, for the sandbox that every application runs in. The packages install bubblewrap; moonshine healthcheck checks both.
  3. A GPU with Vulkan video encoding. NVIDIA RTX, AMD RDNA2+, or Intel Arc.
  4. Moonlight v6.0.0 or higher. Compatibility with older versions or unofficial ports is not guaranteed.

Quick start

  1. Install Moonshine with the install script.
  2. Open the control panel at http://localhost:47990 .
  3. In Moonlight, select the host (or add it by its IP address). Moonlight shows a PIN.
  4. Type the PIN on the Clients page of the control panel. For other ways to pair, see Pairing with a client.
  5. Select Steam (or a game) in Moonlight to start streaming.

Installation

Run the install script as your normal user (not with sudo). It asks for sudo when it needs it:

curl -fsSL https://github.com/hgaiser/moonshine/releases/latest/download/moonshine-install.sh | bash

The script picks the installation method for your system:

System Method
Arch, CachyOS, EndeavourOS, Manjaro, ... The moonshine-bin AUR package, with paru, yay or makepkg
Debian, Ubuntu, Linux Mint, Pop!_OS, ... The release .deb, with apt
Fedora, Nobara, ... The release .rpm, with dnf
Bazzite, Silverblue, Kinoite and other Fedora Atomic distros The release .rpm, layered with rpm-ostree (reboot after install)
SteamOS, and every other distro The release tarball, unpacked into /opt/moonshine
NixOS Nothing: use the NixOS module

It checks each download against the release's SHA256SUMS. It then offers to do the steps in Enable the service for you.

  • Upgrade: run the script again. It keeps the method of the current installation.
  • Uninstall: curl -fsSL https://github.com/hgaiser/moonshine/releases/latest/download/moonshine-install.sh | bash -s -- --uninstall
  • Preview: add --dry-run to see the method and the commands, without changes.
  • Choose the method: add --method aur|deb|rpm|ostree|opt.

Run the script with --help for all options.

Manual installation

Download the package from the releases page, install it, then do the steps in Enable the service.

System Command
Arch yay -S moonshine-bin
Debian / Ubuntu sudo apt install ./moonshine_*.deb
Fedora / RHEL sudo dnf install ./moonshine-*.rpm
Fedora Atomic (Bazzite, Silverblue, ...) sudo rpm-ostree install ./moonshine-*.rpm, then reboot

To build from source, see BUILDING.md.

NixOS

Moonshine and its services.moonshine module are in nixpkgs. The module does all the steps in Enable the service, so skip them.

services.moonshine = {
  enable = true;
  user = "alice"; # must be declared in users.users
  # Required: the default application points at /usr/bin/steam, which doesn't exist on NixOS.
  settings.application = [
    {
      title = "Steam";
      command = [ "/run/current-system/sw/bin/steam" "-steamos3" "steam://open/bigpicture" ];
      steam_integration = true;
    }
  ];
  # Opens the ports on these interfaces only; see Security below.
  # firewallInterfaces = [ "tailscale0" ];
};

See all options at search.nixos.org. This repository is also a flake that builds the latest commit. See nix/README.md.

Enable the service

The install script and the NixOS module do these steps for you. Do them yourself after a manual installation.

  1. Enable user lingering, so Moonshine can run applications when you are not logged in:

    sudo loginctl enable-linger $USER
    

    If you are always logged in when you stream, you can skip this step.

  2. Start the service now and on boot:

    sudo systemctl enable --now moonshine@$USER
    
  3. Gamepad support when streaming headless (no active desktop session): add your user to the input group, then log out and back in:

    sudo usermod -aG input $USER
    

    The streamed game must be able to read the virtual gamepads that Moonshine creates. With an active desktop session, your user already has this access, so you can skip this step.

Configuration

The service reads ~/.config/moonshine/config.toml. Moonshine creates this file on the first start. The default configuration streams Steam Big Picture and finds your installed Steam games, so most users do not have to change anything.

Control panel

Open the web control panel at http://localhost:47990 . With it you can:

  • See the stream that runs now, with live graphs of latency, bitrate and frame rate, and stop it.
  • See the health checks, and run them again.
  • Pair new devices with their PIN, and rename or unpair paired devices.
  • Add and edit applications and scanners, and hide scanned applications from clients.
  • Change settings. Each setting shows if it applies now, at the next stream, or after a restart.
  • Read the logs, and download a report for bug reports.
  • Stream an application in this browser (see Streaming in the browser).

The control panel writes its changes to config.toml and keeps your comments in place. By default, only this computer can open it. To open it from other devices, add their address range:

[ui]
allowed_networks = ["127.0.0.1/32", "::1/128", "192.168.1.0/24"]

[!WARNING] Anyone who can open the control panel can add applications, which run commands as your user. Only add address ranges that you trust. The control panel has no password.

Set enabled = false in the [ui] table to turn the control panel off. To open it through a reverse proxy, see TIPS.md.

Streaming in the browser

Select Play at the top of the control panel's menu, or open http://localhost:47990/play . It works in Chrome, Edge and Firefox.

The advanced options set the resolution, frame rate, bitrate, HDR, video codec, audio channels and the captured mouse (raw for games, or accelerated for desktop work). By default, the stream uses the size of the screen, 60 fps and the bitrate that Moonlight would use. HDR, the codec and the audio are automatic: the stream uses what both this computer and the browser support. Turn on Remember these options for this application to use other options for one application, for example a lower resolution for a demanding game. PyroWave is a codec for the browser stream only: a wavelet codec that the GPU encodes and the browser decodes with WebGPU, for the least delay. It needs 5 to 10 times the bitrate of the other codecs (about 125 Mb/s at 1080p60), so use it on a wired network. Select it in the advanced options, with full chroma (4:4:4) if you want sharp text. Only Chrome and Edge show HDR in HDR. Show statistics shows the frame rate, bitrate, decode time, round trip and loss on top of the stream; Ctrl+Alt+Shift+S shows or hides them during the stream.

  • The stream uses UDP port 47990: open it in the firewall.
  • From other devices, the page uses HTTPS with a self-signed certificate, so the browser warns the first time. To use your own, set certificate and private_key in [ui].
  • To turn it off, set streaming = false in [ui].

Pairing with a client

Besides the Clients page of the control panel (see Quick start), you can click the notification on the host, or open http://localhost:47989/pin , and type the PIN there. To pair without a browser, see TIPS.md.

Adding applications

Each application runs in its own isolated streaming session. Add them in the control panel, or in config.toml:

[[application]]
title = "Steam"
command = ["/usr/bin/steam", "-steamos3", "steam://open/bigpicture"]
steam_integration = true

See SCANNERS.md for all fields of an application, and TIPS.md for practical recipes.

Application scanners

Scanners find installed applications, so you don't have to add them one by one:

  • Steam: installed Steam games (on by default).
  • Desktop: applications from .desktop files.
  • Lutris, Heroic, Epic Games Launcher, Bottles and Faugus: games from these launchers.
[[application_scanner]]
type = "steam"
library = "$HOME/.local/share/Steam"
command = ["/usr/bin/steam", "-steamos3", "-bigpicture", "steam://rungameid/{game_id}"]

See SCANNERS.md for the options of each scanner.

Sandbox

Moonshine runs each application in a sandbox made with bubblewrap:

  • A game sees only the gamepads of its own stream, not the computer's own controllers (unless the application has host_gamepads = true).
  • With the rules 60-moonshine.rules and 72-moonshine-isolation.rules installed (the packages do this), the desktop's user does not get the stream's gamepads either. Steam Input's virtual controllers stay in the stream too.
  • Stopping a stream stops every process of the application, also processes that run in the background.
  • Applications can have a profile.
  • When systemd is installed, each sandbox gets its own systemd user manager and session bus, in a private $XDG_RUNTIME_DIR. Applications that run systemctl --user, such as start-cosmic, then work, and they do not change your desktop's session. This needs Delegate=yes and DelegateSubgroup=main in Moonshine's service (the packaged [email protected] has them); without them, Moonshine logs a warning and the applications use the desktop's session bus.

More device nodes for the applications, if the sandbox hides them:

[sandbox]
devices = ["/dev/uhid"]

Without bubblewrap or unprivileged user namespaces (see Requirements), Moonshine does not start; moonshine healthcheck shows the cause. On Ubuntu, the .deb installs an AppArmor profile that allows them. The sandbox is not a security boundary: it keeps well-behaved games away from the wrong controllers. See TIPS.md for the details and the requirements.

Troubleshooting

  • Run moonshine healthcheck to check the GPU, codec support and ports. Add --config ~/.config/moonshine/config.toml to also check your configured ports and GPU.
  • Read the logs with journalctl -u moonshine@$USER, or on the Logs page of the control panel.
  • If an application does not start, see Debug a failing application.
  • When you report a bug, attach the report from the Logs page of the control panel.

FAQ

  1. How does this compare to Sunshine?

    Sunshine supports more platforms and has more features. Moonshine is Linux-only, and runs each stream in its own compositor instead of capturing your desktop.

  2. Can I use Moonshine to stream to two clients simultaneously?

    This is currently not a supported feature and not a focus of Moonshine. If you are interested in adding support for this, feel free to open an issue or discuss on Discord.

Security

Moonshine is not designed for use on public networks. Do not expose Moonshine ports directly to the internet. The underlying GameStream protocol has limitations that mean traffic is not fully encrypted at the application level.

If you need to stream over the internet, use a VPN such as Tailscale, WireGuard, or ZeroTier.

Contributing

Bug reports and pull requests are welcome on GitHub. To build Moonshine yourself, see BUILDING.md. See CHANGELOG.md for the changes in each release.

Acknowledgement

Moonshine's video codecs and its compositor are two projects of their own: pixelforge and ferriscope. This wouldn't have been possible without the incredible work by the people behind the following projects:

  1. Moonlight, without it there would be no client for Moonshine.
  2. Sunshine, which laid a lot of the groundwork for the host part of the API.
  3. Inputtino, for a thorough implementation of input devices.
  4. magic-mirror, for inspiration of using Vulkan and a Wayland compositor for headless streaming.
  5. gamescope, which ferriscope, Moonshine's compositor, is a port of.
  6. PyroWave, the wavelet codec that pixelforge and the browser stream use.

License

Moonshine is licensed under the BSD 2-Clause License.

관련 프로젝트 살펴보기

불러오는 중…