Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Moonlight: Game streaming client for Sunshine and NVIDIA GameStream #6303

Merged
merged 24 commits into from
Apr 29, 2023

Conversation

mtekman
Copy link
Contributor

@mtekman mtekman commented Apr 11, 2023

Add Moonlight game streaming client

This is the embedded version suitable for RPI, based on their debian bullseye build.

The installation and deinstallation script is based on the setup script shown on their packages page.

In terms of documentation, I'm not sure what's really needed. People can just run moonlight list and it will automatically look for any broadcasting services and try to match and pair, as given in their Usage section on their wiki.

@MichaIng MichaIng changed the title Dietpi-Software | Moonlight DietPi-Software | Moonlight Apr 11, 2023
@MichaIng MichaIng added this to the v8.17 milestone Apr 11, 2023
@MichaIng
Copy link
Owner

Many thanks for your contribution. I'll go though it in detail in a few hours. Does it internally use pip for something or why do you install it explicitly? The official installer script does not do that.

@MichaIng MichaIng self-requested a review April 11, 2023 13:35
@mtekman
Copy link
Contributor Author

mtekman commented Apr 11, 2023

Hey, good question. From the detect_os_modern_python function in their script it checks for pip, but I believe this is purely to detect the OS, so it's likely not necessary. I will drop it.

@mtekman
Copy link
Contributor Author

mtekman commented Apr 11, 2023

One thing I'm not sure about is that moonlight only works if dtoverlay=vc4-fkms-v3d is set in config.txt (and then after a reboot).

I've seen several mentions to modifying this via G_CONFIG_INJECT during installation, but I'm not sure how to "unset" it back to what it was during uninstallation.

dietpi/dietpi-software Outdated Show resolved Hide resolved
dietpi/dietpi-software Outdated Show resolved Hide resolved
dietpi/dietpi-software Outdated Show resolved Hide resolved
dietpi/dietpi-software Outdated Show resolved Hide resolved
@MichaIng
Copy link
Owner

Check out how we enable fake KMS for Amiberry:

/boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d

IMO no need to revert this on uninstall since we do not know whether legacy graphics or full KMS is wanted. Fake KMS is actually quite fine for compatibility: DRM/KMS is available but some legacy graphics APIs as well (like DispmanX).

dietpi/dietpi-software Outdated Show resolved Hide resolved
dietpi/dietpi-software Outdated Show resolved Hide resolved
@MichaIng
Copy link
Owner

MichaIng commented Apr 15, 2023

Okay, while there is a "debian" path for this repo an both "support" all architectures, everything is empty aside of the "raspbian" armhf and arm64 ones. So it is ARM-only and probably even only for Raspberry Pi. However let's adjust it and test on other ARM SBCs.

Also the Bookworm suite is empty, so we need to try the Bullseye packages on Bookworm systems then.
EDIT: Nope does not work as it depends on libssl1.1 while Bookworm ships libssl3.

dietpi/dietpi-software Outdated Show resolved Hide resolved
@mtekman
Copy link
Contributor Author

mtekman commented Apr 20, 2023

I just purged, set to fpkms, and did the gpumem split to 76, then rebooted.

libcec.so.6: cannot open shared object file: No such file or directory
libcec.so.6: cannot open shared object file: No such file or directory
Failed to initialize libcec interface

CEC seems to be baked into the moonlight-embedded for the RPi... but then when I do ldd /usr/bin/moonlight libcec is not in the list of required libraries...

I'd add moonlight-qt as additional/dedicated install option, not as replacement.

Will they be installed together then, or will users choose?

@MichaIng
Copy link
Owner

MichaIng commented Apr 20, 2023

CEC seems to be baked into the moonlight-embedded for the RPi... but then when I do ldd /usr/bin/moonlight libcec is not in the list of required libraries...

I found the same, even every other moonlight library does not show libcec via ldd. I guess it is loaded on demand. However, this does not break the streaming, does it? In my case logs just continued went on after the "missing libcec" error, so it does not seem to be required.

Will they be installed together then, or will users choose?

Dedicated install option, so you can select either one or the other or both. I didn't check whether the packages can be installed concurrently, but I wouldn't know any reason why not.

@mtekman
Copy link
Contributor Author

mtekman commented Apr 20, 2023

Yeah, that's the thing -- it otherwise looks like it finds the stream and connects the mouse and keyboard inputs successfully, it's just somehow unable to find a device to render the video to (I've tried this both from the console and from X11)

Okay, so I guess another PR is in order :-)

I have both installed at the moment. One thing I want to test is whether I can have moonlight-qt and kodi running with the same dtoverlay, but maybe that'd be more relavant for another PR

@MichaIng
Copy link
Owner

It is not ARMv6 compatible: moonlight-stream/moonlight-embedded#867

- DietPi-Software | Moonlight: The armhf binary packages are currently not compatible with ARMv6: moonlight-stream/moonlight-embedded#832
@MichaIng
Copy link
Owner

I recognised that Moonlight does not seem to natively support an accelerated A/V decoder available with the 64-bit RPi kernel: https://github.com/moonlight-stream/moonlight-embedded/blob/master/moonlight.conf#L57-L66

  • OMX (OpenMAX) is only available with the 32-bit kernel and basically a deprecated legacy API.

I'm not sure how the auto detection works, but there is nothing else available (and listed in the config file) outside of an X11 session and without SDL. So there is two things to test:

dietpi-software install 6 # Install X11
startx /usr/bin/moonlight stream -app Desktop -platform x11 HOST # should be possible to omit -platform here, but to be failsafe

and

apt install libsdl2-2.0-0
moonlight stream -app Desktop -platform sdl HOST

- DietPi-Software | Moonlight: ARMv8 (64-bit) packages are available on Bullseye only
@mtekman
Copy link
Contributor Author

mtekman commented Apr 24, 2023

None of those above commands worked for me, sadly

How do we proceed with this? Shall I just rewrite this PR to be moonlight-qt instead, which I think has a greater compatibilitywith other devices?

@MichaIng
Copy link
Owner

Can you clone the branch and create a new PR? I do not want to give up on the non-X approach which should be generally preferred. I'll be able to test on RPi 2 this week, and if it fails the same way, we can report to Moonlight devs to see where the problem is or whether it is a bug.

- DietPi-Software | Moonlight: Update to use ID 207, as 206 is now used by openHAB already
@MichaIng
Copy link
Owner

MichaIng commented Apr 29, 2023

It works here. I'm currently remote-controlling my laptop with my RPi 2, connected via Moonlight embedded 😃. Using

moonlight pair 192.168.1.14
# Typing the returned PIN into Sunshine web interface, then
moonlight stream -app=Desktop 192.168.1.14

With 192.168.1.14 being the Sunshine host.
This was a clean DietPi install, accepting the 76 MiB GPU memory offered during install, then reboot.
Quite a nice alternative to VNC and similar, ähm, no it's the wrong way round 😄. Still nice.

Alternatively one can modify /etc/moonlight.conf and run:

moonlight /etc/moonlight.conf

Not sure why it does not load this pre-installed config file automatically 🤔. However, with this, we should add a nice systemd service and an autostart option, so it runs with a dedicated unprivileged user, loads the default config files and optionally can be started automatically at boot and/or after login.

Max functional resolution was 1080p 60 Hz. Sadly 1440p (native resolution of my monitor) didn't work. But I guess this is expected unless you use at least an RPi 4.

Is there some magic key (combo) to exit Moonlight? Currently the only way I know is killing the process via SSH. In both cases: a failed startup as well as while streaming.

I'll merge this for the beta now. We can further test and polish during beta, and find our why it does not work in your case @mtekman.

- DietPi-Software | Moonlight: Fix libcec install. It is not necessarily needed but mutes an error during Moonlight startup and of course might enable some HDMI control features
@mtekman
Copy link
Contributor Author

mtekman commented May 2, 2023

Hey, wow I was AFK for a while and didn't see any of these.

Made it to v8.17 - and I can't believe you got it working! 🎉

@mtekman mtekman deleted the moonlight branch May 2, 2023 20:50
@MichaIng
Copy link
Owner

MichaIng commented May 2, 2023

More testers are however highly welcome 🙂.

disconn3ct added a commit to disconn3ct/DietPi that referenced this pull request May 3, 2023
* dev: (75 commits)
  v8.17 (MichaIng#6362)
  v8.17
  v8.17 (MichaIng#6328)
  v8.17
  v8.17 (MichaIng#6356)
  v8.17
  v8.17
  v8.17
  v8.17
  v8.17 (MichaIng#6355)
  v8.17
  v8.17
  v8.17 (MichaIng#6353)
  v8.17
  v8.17
  v8.17
  v8.17 (MichaIng#6339)
  v8.17 (MichaIng#6303)
  v8.17
  v8.17
  ...
@MichaIng MichaIng mentioned this pull request May 5, 2023
@MichaIng
Copy link
Owner

MichaIng commented May 6, 2023

@mtekman
I just found: https://nvidia.custhelp.com/app/answers/detail/a_id/5436/~/gamestream-end-of-service-notification
Does this mean the info that Moonlight is a client for NVIDIA GameStream is obsolete, as it doesn't exist anymore, and instead Sunshine is the only streaming server option now? Or are there other compatible streaming server solutions?

Reminds me that Steam Link was another software requests which got quite many votes on FeatHub. Since Moonlight also supports Steam when connected to a Sunshine instance (but I didn't test this yet), we have at least an alternative with this combination now. And as I know what a complete mess the Steam implementation on Debian is, I cannot imagine that Steam Link is so much better and hence probably Moonlight is the even much better solution, clean, slim, open source.

@mtekman
Copy link
Contributor Author

mtekman commented May 9, 2023

AFAIK, Moonlight is still compatible with the Gamestream protocol as it was before the end of service announcement. So people who didn't upgrade their GeForce Experience should still be able to stream to Moonlight using GameStream. I don't think the protocol was too hard to re-implement and so Sunshine was born to get around this.

Nvidia are now pushing hard their shield tablets which get streams from their own cloud computing service, so I think that whatever new streaming protocol they're implementing (probably with some encryption baked in) probably won't be such an easily understandable protocol like GameStream was, meaning Moonlight probably won't be compatible with anything Nvidia are doing on the cloud right now (?)

As for SteamLink, it looks like they're using something called RemotePlay on the server side of things, and are picking it up on the client side via SteamLink apps. Moonlight is apparently implemented as an app in Steamlink, but it's not clear if Moonlight itself can use RemotePlay streams.

I found this one single mention of using Moonlight to pick up RemotePlay streams, but it's still not clear to me if this is something that Moonlight actually supports.

TL;DR - Yes, Sunshine is realistically the main open streaming server solution for gaming right now, and Moonlight is the main client, which potential support for RemotePlay

This is just my personal perspective on this, I could be dead wrong.

@MichaIng
Copy link
Owner

So people who didn't upgrade their GeForce Experience should still be able to stream to Moonlight using GameStream.

As far as I understand the Moonlight wiki entry about this, it is not possible anymore to use even older NVIDIA GameStream apps.

However, of course Moonlight works with Sunshine independently and other GameStream compatible streaming host servers are possioble, I was more asking since we explicitly name "NVIDIA GameStream" in the install options description, which is weird if this service is dead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants