Moonshine:让你将游戏从电脑串流到任何运行 Moonlight 的设备上。
Moonshine: Lets you stream games from your PC to any device running Moonlight

原始链接: https://github.com/hgaiser/moonshine

Moonshine 是一款专为搭配 Moonlight 客户端使用的 Linux 独占游戏流式传输主机程序。与其他解决方案不同,Moonshine 在独立的合成器中运行每个流,因此在串流期间,主机电脑仍可完全用于执行其他任务。它支持无头模式(无需连接显示器)、硬件加速编码(H.264、H.265 和 AV1)、10 位 HDR 以及环绕声。 Moonshine 专为 Linux 构建,要求 GPU 支持 Vulkan 视频编码(NVIDIA RTX、AMD RDNA2+ 或 Intel Arc)以及 `systemd`。用户可以配置单个应用程序,或使用自动扫描程序扫描 Steam 和桌面文件。虽然它具备独特的隔离功能,但其功能丰富程度不及 Sunshine,且缺乏应用级加密。因此,Moonshine 仅适用于局域网环境;如果必须通过互联网进行串流,则应使用 Tailscale 或 WireGuard 等安全 VPN。安装主要通过 AUR 进行,配置通过 `toml` 文件管理。

``` Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Moonshine:让你将游戏从 PC 流式传输到任何运行 Moonlight 的设备上 (github.com/hgaiser) 8 分,由 wertyk 发布于 2 小时前 | 隐藏 | 过往 | 收藏 | 2 条评论 帮助 tetrisgm 1 分钟前 | 下一条 [–] 我不太清楚这与在 Linux 主机上运行 Sunshine 有什么区别。 回复 SpecialistK 5 分钟前 | 上一条 [–] 由于它不会接管桌面(根据常见问题解答),这对于无头机器来说听起来非常棒。遗憾的是,它需要这么现代的 GPU 和我首选的 Alpine Linux 所不提供的 $feature。但这不应削弱它所带来的前景。 回复 考虑申请 YC 2026 年秋季批次!申请截止日期为 7 月 27 日。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索: ```
相关文章

原文

CI

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.

  • 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, H.265, and AV1 encoding using the GPU.

⚠️ AV1 Warning: AV1 encoding is experimental and has issues on NVIDIA GPUs that cause frame sizes to grow over time (see issue). This should be fixed in driver version 595.44.3.0. Until then, stick with H.264 or H.265.

  • HDR support: True 10-bit HDR streaming for supported games.
  • Full input support: Mouse, keyboard, and gamepad (including motion, touchpad, and haptics).
  • Audio streaming: Stereo and surround sound (5.1/7.1) with low-latency Opus encoding.
  1. Linux only. Tested on Arch Linux, but it's been reported to work on other Linux distributions too.
  2. systemd. Required for launching and managing application processes. Almost all modern Linux distributions include it by default.
  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.

The simplest method is to install through the AUR using:

To run Moonshine for your user:

  1. Enable user lingering:

    sudo loginctl enable-linger $USER

    This allows Moonshine to run applications in the user's session even when the user is not logged in.

    If your user is always logged in when you want to stream, you can skip this step.

  2. Enable the service to start on boot and run immediately:

    sudo systemctl enable --now moonshine@$USER

The following dependencies are required to build:

sudo pacman -S \
   clang \
   cmake \
   gcc-libs \
   glibc \
   libc++ \
   libevdev \
   libpulse \
   libxkbcommon \
   make \
   mesa \
   opus \
   pkg-config \
   rust \
   shaderc \
   vulkan-headers \
   wayland

Then compile and run:

cargo run --release -- /path/to/config.toml

A configuration file is created automatically if the path you provide doesn't exist. When using the AUR package, it defaults to $XDG_CONFIG_HOME/moonshine/config.toml.

When you connect with Moonlight for the first time, it will show a PIN. A notification will appear on the host that you can click to open the pairing page, or you can visit it manually at http://localhost:47989/pin .

You can also pair from the command line:

curl -X POST "http://localhost:47989/submit-pin" -d "uniqueid=0123456789ABCDEF&pin=<PIN>"

Each application runs in its own isolated streaming session. Add them to config.toml like this:

[[application]]
title = "Steam"
boxart = "/path/to/steam.png"  # optional
command = ["/usr/bin/steam", "steam://open/bigpicture"]
  • title: The name shown in Moonlight.
  • boxart (optional): Path to a cover image.
  • command: The command to run. First entry is the executable, the rest are arguments.
  • pre_command (optional): Commands to run before launching the application. Each entry is a separate command, executed in order. Runs synchronously — the session waits for all to finish.
  • post_command (optional): Commands to run after the streaming session ends. Each entry is a separate command, executed in order. Runs synchronously — the server waits for all to finish.

Example:

[[application]]
title = "Steam"
command = ["/usr/bin/steam", "steam://open/bigpicture"]
pre_command = [
    ["/usr/bin/systemctl", "stop", "conflicting.service"],
    ["/usr/bin/nvidia-smi", "pstate", "50"],
]
post_command = [
    ["/usr/bin/nvidia-smi", "pstate", "performance"],
]

Scanners automatically detect installed applications so you don't have to add them manually.

Steam scanner — finds all installed Steam games:

[[application_scanner]]
type = "steam"
library = "$HOME/.local/share/Steam"
command = ["/usr/bin/steam", "-bigpicture", "steam://rungameid/{game_id}"]

Desktop scanner — finds applications from .desktop files:

[[application_scanner]]
type = "desktop"
directories = [
  "$HOME/.local/share/applications",
  "/usr/share/applications",
]
include_terminal = false
resolve_icons = true
  1. How does this compare to Sunshine?
    • Sunshine supports more platforms and has more features overall. Moonshine is Linux-only.
    • Moonshine runs each streaming session in its own isolated environment, separate from your desktop. This means your host PC stays usable while you stream, and it works without an active desktop session.

Moonshine is not designed for use on public networks. 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.

Do not expose Moonshine ports directly to the internet.

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.
联系我们 contact @ memedata.com