[Unofficial] moonlight-embedded

Yeah i guess it was my system config in the end… but weird that it worked fine with moonlight on my laptop.
Seems to be stable now tho and surving reboots as well.

Input lag is no issue.
30fps streaming works great, almost never drops below that. 60fps is another topic tho, framerate is very inconsistent and ranging betwenn 40-60fps on coreelec. Changing between 720p or 1080p stream doesnt change this. No dropped frames because of connection (atleast thats what luna is reporting).

Im not looking on running e-sports titles :wink: mainly want to use this for emulating games that wont work natively like gamecube/wii/wii u and stuff like that.
Made my test using a 60fps jump and run and sadly this ruins the experience with streaming with 60fps, better to switch to 30 as it is more consistent.

H265 definatly works a bit better, noticed this as well. Playing arround with bitrate settings made it worse as far as i have tried yet :slight_smile:

As I saw from logs it is using alternative decoding algorithm, which helps the whole code run on some unsupported devices. Now @stickman89 designed Luna for Kodi Leia, which I see you are using, but lately I haven’t heard from him and he hasn’t updated some things. I have updated to Kodi Matrix and updated Luna for Matrix with many many other optimizations. Because Leia addon is not yet update, try the following.

When you write ./moonlight you will see a help screen.
If parameter -altdecalgorithm is on the list, try using that algorithm for small packet sizes. To use the algorithm, just specify it in the parameter list, as in:
./moonlight stream Steam -1080 -fps 60 -altdecalgorithm
If the algorithm is not specified, then you are already using it now. Then try increasing the packet size.

Im running Version 2.4.10-master-9f78c90 , the -altdecalgorithm option is not listed.
Im also getting the following warnin [WARN] Amlogic decoder will use optimized algorithm for small packet sizes. Set packet size to at least 1536 to disable.

packetsize doesnt really seem to matter for me and even bitrate settings dont really change performance, for example 5000 vs 20000 has a huge change in quality, stutters the same tho. Shouldn’t a lower bitrate also improve decoding performance and therfore reduce stuttering? Or am i getting this wrong.

Sorry to bother you so much with this :slight_smile: maybe the device is the issues

How do i quit Moonlight properly if the Shortcuts are not working?

I connect my Controller via a USB Kabel to my PC and only Stream the Picture to my Box.
But when i try to quit Moonlight via the Shortcut it does not work.
I tried both the Controller and Keyboard Shortcut.

Is there a way to quit it via ssh?

@C0nvert

Button combination for ending the stream won’t work if your controller is directly connected to the HOST. This combination is monitored for by the client. Your android tv box.

To quit via SSH:

./storage/moonlight/moonlight quit

1 Like

On my S912 box with Coreelec 9.2.7, I installed luna 6.6.4. But can’t install thru internal Luna’s Setup Moonlight PKG ,instead I used putty to ssh into the box and run the command with the moonlight_lasted file in storage folder. And i can see the all the files in the “storage\moonlight” folder.

Paring says error please refer to log. I enabled debug in luna , but i can’t find log. where to find the log? what should i do next?

Is it because of the Nvidia new driver? I had to update to moonlight3.1.1 on my laptop, and new android /ios app on my phones. So may be old moonlight-embedded not working?

After the latest GeForce Experience update (3.22.0.28) moonlight-embedded will crash with the following error, which breaks this Kodi addon:
Starting RTSP handshake...RTSP message too long RTSP DESCRIBE request failed: -1 failed: -1

This is currently being tracked in irtimmer/moonlight-embedded#810

@smg04: can you please compile/updated your moonlight-embedded with the fix :slight_smile:

Update is on the way, I actually thought about changing the submodule but there were many changes so I was unsure if it would work. I am testing the binaries, if it works, I’ll push an update, otherwise please wait for updates from official moonlight-embedded from irtimmer.

Test these binaries. They didn’t work for me, but no major errors showing up, maybe it was an unlucky test… I will debug it at some point tomorrow.

SSH and extract using tar -xvf moonlight_latest.tar.gz on /storage. Good luck!

moonlight_latest.tar.gz (1.4 MB)

Thanks for the fast reply. I will test the update later today and will provide you the feedback.

@smg04 your fixed version is working with 3.22.0.28 :slight_smile:

thanks a lot for the fast fix

not working on 3.22.0.32 ,S912

I am running 3.22.0.32, it was working for me on these binaries. If it doesn’t work for you, try rebooting the tv box and/or host PC. Sometimes if nvstreamer.exe is running (which means a GameStream session is already running), it fails to resume the session and the streams don’t work. You can try killing that process if it doesn’t work, though for me it was working by simply starting the game in Kodi. Good luck!

If more people test this, I will push it as official new release.

moonlight_latest.tar.gz (1.5 MB)

Thanks for the quick update. i tried, still cannot pair host. there might be sth wrong on my end. I’ll try reinstall luna and moonlight

Really appreciate that time is being taken to get something like this added, but I can’t for the life of me get it to work. Been messing with it for the better part of 2 hours now and figured I would make an account to report my logs and see if anyone has any insight.

Running coreelec 19.1-matrix_rc2, nvidia gfe3.22.0.32 and have tried the official release moonlight as well as the one just posted.

Trying to pair my machine displays an error telling me to check logs. Logs show as follows:

2021-04-23 13:23:37.505 T:7798     INFO <general>: initializing python engine.
2021-04-23 13:23:37.920 T:7798    ERROR <general>: /storage/.kodi/addons/script.luna/resources/lib/di/featurebroker.py:31: YAMLLoadWarning: calling yaml.load_all() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
                                                 for feature in features:

2021-04-23 13:23:38.019 T:7798     INFO <general>: [script.luna] [CoreService] - initialized
2021-04-23 13:23:38.116 T:7798    ERROR <general>: /storage/.kodi/addons/script.module.urllib3/lib/urllib3/connectionpool.py:997: InsecureRequestWarning: Unverified HTTPS request is being made to host '<redacted>'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
                                                 warnings.warn(

2021-04-23 13:23:38.121 T:7798     INFO <general>: [script.luna] RegExp couldn't find a match in the XML string ...
2021-04-23 13:23:38.122 T:7798     INFO <general>: [script.luna] Trying to encode as: UTF-8
2021-04-23 13:23:38.123 T:7798    ERROR <general>: [script.luna] Building ETree from XML failed: syntax error: line 1, column 0. Offending string follows ...
2021-04-23 13:23:38.123 T:7798    ERROR <general>: [script.luna] BAD REQUEST
2021-04-23 13:23:38.125 T:7798    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                               Error Type: <class 'ValueError'>
                                               Error Contents: Building ETree Failed
                                               Traceback (most recent call last):
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 262, in build_etree
                                                   etree = ET.fromstring(self.re_encode_string(xml_string))
                                                 File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
                                                 File "<string>", line None
                                               xml.etree.ElementTree.ParseError: syntax error: line 1, column 0

                                               During handling of the above exception, another exception occurred:

                                               Traceback (most recent call last):
                                                 File "/storage/.kodi/addons/script.luna/addon.py", line 354, in <module>
                                                   game_controller.get_games()
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/controller/gamecontroller.py", line 20, in get_games
                                                   game_list = self.moonlight_helper.list_games()
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/util/moonlighthelper.py", line 181, in list_games
                                                   return RequiredFeature('nvhttp').request().get_app_list()
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 151, in get_app_list
                                                   applist = self.get_app_list_from_string(str(response.content, "utf-8"))
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 156, in get_app_list_from_string
                                                   etree = self.build_etree(xml_string)
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 267, in build_etree
                                                   raise ValueError("Building ETree Failed")
                                               ValueError: Building ETree Failed
                                               -->End of Python script error report<--

2021-04-23 13:23:38.500 T:7798     INFO <general>: Python interpreter stopped

I feel like I have to be missing something, but if anyone has any suggestions to get this working I am open to it.

Disable game provider TheGamesDB in the addon settings, it seems that it doesn’t work for you…
I wrote the provider and didn’t test it as much so it’s possible its buggy…

I’m confused as I don’t seem to have an addon by that name or see a setting in Luna’s settings for it. If it makes any difference I’m using the version of luna found here GitHub - TheChoconut/Luna: Luna Script for Kodi as the other one wouldn’t install.

Luna settings → Helper → Enable TheGamesDB as Game Information Provider

Only options I have under Helper are clear game cache, delete pairing key, and setup moonlight pkg

Did you download this → https://github.com/TheChoconut/Luna/archive/refs/heads/matrix.zip?