[Unofficial] moonlight-embedded

That’s the one. Well, same name slightly different link. Also a differnt file size. Will try that and report back

That was definitely a different version of the add-on. Not sure why that isn’t the one in the releases. Now the logs are showing a 400 error when trying to connect, but that’s a step in the right direction. Will try rebooting host and see if that helps.

Rebooted everything, confirmed kodi device and my desktop were able to communicate, disabled the firewall, packet capture shows some traffic between kodi and desktop on ports 47984 and 44822, but the logs are still showing nvhttp.py is returning 400 bad request. Gamestream is turned on, so I’m still confused as to what would be holding this up.

Edit: Loaded up moonlight on my phone to make sure there wasn’t anything wrong on the desktop and it can connect with no issue.

Further update: I can manually run moonlight pair while SSHd and get it to pair to my pc. Running luna through kodi shows my list of games and selecting one will run the intro video and launch the game, but kodi has a black display. At least I’m getting somwhere.

Hopefully final edit: removed the moonlight folder and unpacked the most recent one listed here in case I was running one of the older ones while messing with this. I have video now! Appreciate the help and hope someone else gets use out of me struggling.

Hello everyone! :wave:

Hereby I am announcing new version of moonlight-embedded & Luna for CoreELEC users.
I have managed to setup CoreELEC toolchains and moonlight-embedded is now completely built using CoreELEC toolchain. There’s also support for in-addon binaries added in Luna, which means…

Big news for Matrix users!

You no longer have to use a download script for moonlight!
Binaries are now shipped with the addon itself :partying_face:!

What about Leia users?

I don’t maintain Leia version of Luna, I’ve moved to Matrix and I have no boxes with Leia version. @stickman89 please notify me if you want to continue maintaining Luna for v18 Leia, I’ll help you with setting up in-addon binaries.

How to upgrade Luna

Check out the first post for more information. This upgrade will only work for v19 Matrix.

  1. SSH into your tv box and delete /storage/moonlight folder, use command:
    rm -rf /storage/moonlight
  2. Download Luna for v19 Matrix (link above). You have to download ZIP file that starts with script.luna.
  3. Install addon in Kodi. (If there’s an error, uninstall old version and reinstall)
  4. Do initial setup if required (setup Host IP, additional settings)
1 Like

Hi all,

I’m using the latest osmc with Kodi Matrix, but can’t make it working, the log only says:
[INFO] Connect to x.x.x.x…
Connect to x.x.x.x…
[ERR] Platform ‘auto’ not found

and nothing happens.

I can sort of start it from CLI, however all platform but ‘fake’ produces the error message above.

osmc@rpi4:/storage/moonlight$ ./moonlight stream -app firefox -platform fake x.x.x.x
[INFO] Connect to x.x.x.x…
Connect to x.x.x.x…
Initializing platform…done
Resolving host name…done
Initializing audio stream…done
Starting RTSP handshake…done
Initializing control stream…done
Initializing video stream…done
Initializing input stream…done
Starting control stream…done
Starting video stream…done
[INFO] Allocating alsa hardware parameters…
[DEBUG] Initialize HW parameters…
[DEBUG] Set access to interleaved…
[DEBUG] Set format to S16_LE…
[DEBUG] Set rate near 4288690720…
[DEBUG] Set channel count to 2…
[DEBUG] Set period size to -6276568…
[DEBUG] Set buffer size to -6276572…
[DEBUG] Setting new HW params 1955708160…
[DEBUG] Allocating new SW params…
[DEBUG] Initialize new SW params…
[DEBUG] Setting SW avail mid to 2880…
[DEBUG] Setting SW start thresh to 2880…
[DEBUG] Setting new SW paremters…
[DEBUG] snd_pcm_prepare()…
Starting audio stream…done
Starting input stream…done
Received first audio packet after 0 ms
Received first video packet after 300 ms

Any tips what am I doing wrong?

This is CoreELEC forum

Hi. Using kodi matrix and get this error when trying to pair.

GameDb provider is disabled.

EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                               Error Type: <class 'ValueError'>
                                               Error Contents: 400 BAD REQUEST
                                               Traceback (most recent call last):
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 62, in get_server_info
                                                   self.verify_response_status(response)
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 54, in verify_response_status
                                                   raise AssertionError(status_code + ' ' + status_message)
                                               AssertionError: 400 BAD REQUEST
                                               
                                               During handling of the above exception, another exception occurred:
                                               
                                               Traceback (most recent call last):
                                                 File "/storage/.kodi/addons/script.luna/addon.py", line 293, in <module>
                                                   plugin.run()
                                                 File "/storage/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 338, in run
                                                   items = self._dispatch(self.request.path)
                                                 File "/storage/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 312, in _dispatch
                                                   listitems = view_func(**items)
                                                 File "/storage/.kodi/addons/script.luna/addon.py", line 188, in pair_host
                                                   config_controller.pair_host()
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/controller/configcontroller.py", line 61, in pair_host
                                                   message, state = self.moonlight_helper.pair_host(pair_dialog)
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/util/moonlighthelper.py", line 120, in pair_host
                                                   return RequiredFeature('connection-manager').request().pair(dialog)
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/connectionmanager.py", line 9, in pair
                                                   server_info = nvhttp.get_server_info()
                                                 File "/storage/.kodi/addons/script.luna/resources/lib/nvhttp/nvhttp.py", line 71, in get_server_info
                                                   raise ValueError(e)
                                               ValueError: 400 BAD REQUEST
                                               -->End of Python script error report<--

I was not able to reproduce this issue, though it might be Nvidia changed something. Could you please note your nvidia gpu, driver and GFE version (also windows version)?

I’ll take a look if there’s any particular updates on the Nvidia side.

i have the same problem on pairing. I pair by ssh connection on /storage/moonlight/ use ./moonlight pair

Its possible to add mouse emulator, like on android moonlight version pushing long start button?

also is it possible to add real-time performance stats while streaming?

GTX 960 2GB
461.72
3.23.0.74
Windows 10 Pro N (Media Feature Pack installed), 19042.1110

ahh on /storage/moonlight is old pkg :slight_smile: new one is in addon folder.

@smg04 i have some problems with micro stuttering on 60fps i saw someone mention about that before.

Are you planning to compile new version of moonlight-embedded?

i get something like that on log:

[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[WARN] Dropped 38 frames!
[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[ERR] EAGAIN triggered, trying again…
[WARN] Dropped 30 frames!

wired connection,

Try turning on alternative algorithm in Luna settings or increase your packet size (this only works on wired). Both should fix the issue but one will have better performance depending on your box.

@skupi any updates?

Today I did some tests and noticed Parsec was up to 10 frames (avg 5-7) better than moonlight on my S905D box. I was using an Intel decoder on a different machine, so Parsec just might be better optimized in that case. I am doing a small research on the decoding process to check if there’s anything that could be optimized, but at this point it looks like its very very good.

If you use the alternative decoding algorithm, on 1080p60 I couldn’t notice any difference in speed, but it was more stable.

The setting is located at:

Settings -> Advanced -> Use alternative Amlogic decoder algorithm (leave checked)

For 4K it might be better to increase the packet size, though I have no 4K outputs for testing.

still small micro stutter, periodic :slight_smile: so its strange its periodic

My box is X96 Max S905x2

On moonlight on my android TV, philips with MT cpu :slight_smile: i have similar problem, but there is an option never drops frame. And it helps, stutter is gone, but i get to 40ms decoding time, terrible :smiley: On coreelec i achieved us time :smiley: i feel it better but that stutter is annoying. I ask you before about that option but moonlight-embedded looks like dont have that option.

Iam wonder what that option is doing in moonlight client for android.

On alternative decoding i get no error in log, but after some time i get micro stutter, but no errors in logs. I read you post about test sample of h265 but iam not sure how to run it.

So finally i tried many options worst is that micro stutter happen periodic. Sometimes restart of stream help, so it must be something with decoder looks like.

@matthew6870 Please test new version.

[v0.7.1.1] Fixed an issue where misssing pairing keys would cause a 400 BAD REQUEST error, breaking the pairing process.

1 Like

smg04 could you compile new moonlight its 2.5.0 now

how you compile it, on coreelec? or on other box?

Behavior changes:

  • -surround and -remote now require an argument
  • -unsupported is now default to match other Moonlight clients. Use -nounsupported to get the old behavior
  • -packetsize now defaults to 1392 on LAN connections to match other Moonlight clients
  • 60 FPS streaming is now the default at all resolutions