[Unofficial] moonlight-embedded

@smg04 - I’ve updated the binaries with v2. I’m just testing some things… Ofcoarse!! Haha. I don’t know how I missed that! Well, I could have just added ‘echo 1 > /sys/class/video/disable_video’ into the moonlight-heartbeat.sh shell script… Which I’ve done for peace of mind. Interestingly ‘killall -STOP kodi.bin’ doesn’t work from python. It prevents further commands from running. I’ve reverted back to using ‘systemctl stop kodi’. Now I’m curious, do you know whether ‘pausing’ kodi with ‘killall -STOP kodi.bin’ really frees up the memory it’s consumed? Since it’s still active on screen screen in a frozen state (naturally). I guess it doesn’t matter too much since it doesn’t work when issued via Luna’s python scripts, and thus; I’m unable to use it without taking many steps back…

killall -STOP kodi.bin will not free up any memory. It will just pause the execution of the process. Check out the definition for SIGSTOP. The idea of sending SIGSTOP to Kodi is to preserve its state after you’re done with moonlight. Bascially, after you continue execution with killall -CONT kodi.bin you are sending SIGCONT which continues the execution of the process from stopped state. Because the execution is just paused, it will continue where it left off and you can change game instantly. When you use systemctl stop kodi the process stops running and it will clean out the memory, but it needs to re-load once you stop using moonlight.

There’s no really a better answer, in my opinion you can leave systemctl stop kodi for now and later on we can try making the “preserve Kodi state” as an alternative option.

smg04 - Blackscreen issue is still occurring… See attached debug output. ALSA or Enet? debug.txt (55.9 KB)

I’m also going to send you my modified luna script package. Let’s try and figure out this black screen issue before we release something. Sometimes I can quit out if I’m quick. Just it’s literally a short window, and you quite often miss it thinking it’s still initiating the stream. I’ll have to reboot the device usually.

I’ve also updated Luna with some nice icons I created. Kept a couple of the ‘better’ stock ones.

Everyone else… Hold tight. We’ll release something shortly… :slight_smile:

1 Like

I’d be keen to test this out for you as I currently boot into the Android OS on my X96 Air to play games.

I did try putting this on using your KODI method, and can open LUNA but when i choose Add Host nothing happens.

1 Like

Same here, I’ve been trying with Luna but nothing happens here too

Hello everyone.
Sorry for the inconvenience. @stickman89 and I are working on a new Luna add-on which will be more compatible with CoreELEC boxes as well as making the whole process a lot smoother. The current version has a lot of small bugs which makes the whole experience unpleasant to say the least. When I first published this, everything was implemented fast with no error checking, meaning it would only work on few setups, hard coded. It was published just so I could compile a list of all the possible bugs and to see if the binaries work on all CoreELEC systems…
Until we find solutions for the current bugs we won’t publish the next alpha/beta release. Thank you for testing! I hope we can bring back the moonlight project to the CoreELEC repos!

4 Likes

Fingers crossed as this will be really great if Moonlight will work within CoreELEC without having to reboot to Android each time.

Will this be able to support surround sound functionality too without issue? as I know this is over multichannel LPCM, even though my AVR supports it and it works fine via CoreELEC it doesn’t work when booted into Android.

Thanks a lot, this is the only feature I was missing and waiting so bad on CE. Also because I can’t anymore boot into android because my box enters in recovery for some weird reason… Anyway, I’d suggest you to focus on H265 codec since it works way way better than 264 on Moonlight: it reduces stutters and latency. Again, thanks a lot for your work guys! You can count on us for testing :slight_smile:

Hello everybody. I’d like to announce my contribution, the last piece, and thus completing the puzzle. Massive thanks to @smg04 for the running back and forths via PM, tirelessly committing himself to patching, compiling and testing the moonlight binary; whether at his own accord or at my request. He has honestly been a pleasure to work/communicate with. Whether @smg04 or myself. Lots of effort has gone into working out the obvious kinks and hurdles where longstanding bugs nested, compatibility issues reared or from new features that were implemented. Anyway, without further ado…

You can find my updated Luna package here:


Direct Download: https://github.com/stickman89/Luna/releases/download/v0.6.5-alpha/script.luna-0.6.5-alpha.zip

Installation via Addons > Install from zip file

Couple this with @smg04 's latest binary package: -moonlightv7.tar.gz at the time of writing

Transfer moonlightvX.tar.gz to /storage on your CoreElec device using any method of your choice
Using SSH change directory to /storage with: cd ~
Now issue command tar -xvf moonlightvX.tar.gz (where X in the filename is the version number)
Followed by: cd moonlight
And lastly chmod +x moonlight

Now run Luna from Add-ons > Program add-ons and configure via Settings; ensuring to ‘Pair Host’ after entering ‘Host IP’. Follow onscreen prompts where your PIN is diclosed, and peruse your Shield Library via ‘Games’; launching with select. Profit.

Disclaimer: This is best experienced on CoreElec’s stable builds. NG builds, aside from being experimental, do not offer the best performance for Moonlight at the moment.

ZeroTier usage requires installation via Entware. Ensure to configure and authenticate your CoreElec device on your ZeroTier network at least once beforehand. You can find documentation online.
Example: /opt/bin/zerotier-cli join your_network_id

Please note: Init scripts are not required for ZeroTier. Just enable ‘ZeroTier Connect’ via Luna. Set the ‘Host IP’ to your hosts ZeroTier assigned address within Luna > Settings and ZeroTier will automatically initiate a connection before game launch, and close the connection on session disconnect.

Best Regards,

stickman89 [:s89:]

2 Likes

Hello everyone! :wave:

I am happy to announce @stickman89 and I are ready to announce a first beta release of moonlight-embedded!
The last few days we’ve been working on Luna, patching up bugs and making the UX more pleasant.

On the main post you will find the simplified details on how to setup moonlight binaries and Luna.
To make it more easy, I have designed a simple script that will do all the work for binaries for you.

So, to set up your moonlight binaries, SSH into your box and paste this line:

wget https://gist.githubusercontent.com/TheChoconut/fe550f8c19c11f71a85841f135eddecb/raw/ -qO - | bash

The script will download the latest moonlight binaries from my personal Dropbox and will extract the package to the right destination.
After that finishes, you can exit out of SSH and set up Luna.

Download Luna from GitHub releases:

Direct download: https://github.com/stickman89/Luna/releases/download/v0.6.5-alpha/script.luna-0.6.5-alpha.zip

Install Luna addon (Addons -> Install from ZIP -> script.luna.zip).
Set up your Luna addon by entering your Host IP in the script settings and Pair with Host.
After pairing, configure your wanted settings (resolution, framerate, etc.)

Your game library is accessible in ‘Games’, selecting a game will launch the game with the previously selected settings.
Luna for now forces codec h265 as it currently performs better than h264.

Disclaimers/known bugs:

  1. As noted by @stickman89, moonlight-embedded doesn’t always play nicely with Amlogic-ng builds.
    There seems to be a bug in the decoder, where the performance is very bad if the frame size in bytes is very small.
    I am not sure if this is a kernel or libamcodec bug, but the performance on my box (running S905D) greatly improved with Amlogic build.
    This is not a definite behaviour, please test it on your boxes even if they are running Amlogic-ng build.

  2. Sound has been poorly tested. Even though I couldn’t hear any noticeable difference after we made a sound change in code,
    logs show us that sometimes not all sound frames are played (which means it might build up latency or not play it at all).
    Even when log spams sound errors, I didn’t notice any problems with sound.
    Surround sound is also untested. I have no way of testing it, so it either works or it doesn’t.

I have noticed a great improvement in both latency and stream quality when using moonlight-embedded instead of moonlight-android. I hope you will notice it too!
Thank you for testing this project. And thank you @stickman89 for helping me make this project a lot more awesome then it ever was!!

Best regards,
@smg04

2 Likes

Have managed to install and pair no problem and start streaming my desktop, although unfortunately have no sound :frowning:

Hi @Adam86.

Can you provide the moonlight.log generated inside your /storage/moonlight folder please?

Thanks.

OMG guys, you did an AMAZING job on this! I’ve unfortunately tried it only for few minutes but the streaming is absolutely way better than the android version!! I hope it’ll get some new features in future like the streaming over 50mbps and resolution higher than 1080p, since the Moonlight’s upscale is really good!
Thanks again, I’ll share my thoughts about issues in the next days. In the meanwhile could you please tell me how to stop the streaming and go back to Kodi interface? I can’t find any command to to this through SSH. Sometimes I need it, for example when I just want to use my desktop without running any game or when some crash happens during the gaming session.

1 Like

Thank you for kind words!

We totally forgot to mention it, I’ll make sure we leave a tip somewhere (maybe while the game is loading?)…

To close your streaming session, use Ctrl+Alt+Shift+Q (keyboard) or Play+Back+LeftShoulder+RightShoulder (controller).

Bitrate >50mbps and custom resolutions are also a thing you can set up in Luna. Check out settings and set your custom resolution and increase the bitrate. Be careful about increasing bitrate and resolutions though, it’s possible at some point I will have to increase the frame buffers for 4k.
There probably won’t be any more modifications to Moonlight’s video section. Code will be modified only if 4k is possible by optimizing sending frame to the Amlogic decoder. Before that, I need to find out why Amlogic-ng decoder doesn’t like our code.

Also, if you want to stream the entire desktop, there’s a trick in GFE. Check out this documentation:

Testers,
please, please, please, send the following information to report your success with Moonlight.

CoreELEC build:
Device / chipset:
Resolutions @ framerate tested:
Performance:
(if you test >1080p or higher bitrates, you can also attach aml_decoder.stats instead of performance, write here if you experience any jitter/very low framerates/stutters etc.)
Sound: Stereo / Surround, working / not working
Logs (if something is broken):

  • dmesg output
  • /storage/moonlight/moonlight.log

This input is very valuable, thank you a lot for testing moonlight!

I’ll add higher than 1080p resolutions without having to define it as a custom one to Luna for the next release. I’m not sure how well some SOCs will handle it though. Also, @smg04 - I’ll be setting up that config file you pre-prepared for us automatically based upon user’s settings. I’ll PM you and we can discuss it.

@Adam86 - In the next release you will be able to switch between audio modes: ‘default, sysdefault and pulse’ from Settings. Hopefully one of these will work for you… Default is sysdefault.

Sounds like some really good functionality will be coming our way in the future.

I’ll try it again tomorrow and will send some logs over to you to review.

Would be awesome if sound works, especially if it comes out in LPCM multichannel.

Thanks for your reply sir. I’ve already set my desktop with that trick but unfortunately I couldn’t stop the stream with both keyboard and controller combination (also because I’m not sure where play and back are located on dualshock 4)

Anyway I looked for higher res and bitrate into settings without success

@RunAway - It should just be ‘Start + Select + L1 + R1’ to disconnect a session for dualshock controllers. Bitrate stuff is already in Settings… Just go to Settings > Advanced > Enable Custom Bitrate (Toggle on). Then set the bitrate manually below. Finally, select ‘Ok’ to save.

1 Like

Thanks a lot, that combination worked on DS4. Instead for Mbps I still can’t go higher than 50 sadly. Anyway I’ve done some tests, everything seems great here on my Nexbox A95X, the sound is ok too but I hear here and there some “crackling”. Nothing too bad but I’ll report with logs as you said before :slight_smile: