[Unofficial] moonlight-embedded

[Update]

  • updated moonlight-embedded to the latest upstream with new Amlogic optimizations
  • experimental hdr support
  • update launchscripts for new decoder updates

script.luna-1.2.0-matrix.150.zip (2.7 MB)

If i try this version in CE 20 beta 1, it crashes :frowning:

Does Luna crash or moonlight when you run it through ssh?
I think executable flag is not set correctly on all files causing it to crash… Try running launchscripts again.

I updated from 19.5 rc2 to 20 beta 1 but can’t connect via SSH to test, if moonlight itself is crashing. I need to fix the ssh problem first. I guess installing CE 20 from scratch is better than updating from 19 to 20.

[quickfix]

  • fix a bug where sometimes stream is not displayed and screen is black

script.luna-1.2.0-matrix.151.zip (2.7 MB)

Hi smg04. I was able to fix my ssh issue and did some tests:

All of your scripts are still not working on my CE 20 beta 1 setup. Only the script / version from luizkun ( script.luna.1.44_modded_2.zip) is working (but i need to copy the libcrypto.so.1.1 file to the lib folder first).

I tried all launch scripts of your version, but none of these fix my issue. I see the games list and if I start one of them, my controller disconnects and nothing is starting. I see still the overview of the luna options (quickplay and so on). I need to reconnect the controller and pressing the disconnect combination to return to KODI.

So what has luizkun added/changed in his launch script, compared to your included launch scripts? Can you maybe add the launch script of luizkun also in your release? Just copy the launch script from his version to your latest release did not work for me (see 2nd logfile output)

Here is the output of the logfile:

Request https://192.168.0.152:47984/launch?uniqueid=0123456789ABCDEF&uuid=13db7364-c796-4ddb-88af-3881f89df179&appid=84297552&mode=2560x1440x60&additionalStates=1&sops=0&rikey=3220ee031039c678542f8a867c1ccdca&rikeyid=1858382939&localAudioPlayMode=0&surroundAudioInfo=196610&remoteControllersBitmap=0&gcmap=0
Response:
<?xml version="1.0" encoding="UTF-16"?><root protocol_version="0.1" query="launch" status_code="200" status_message="OK"><DisplayHeight>720</DisplayHeight><DisplayWidth>1280</DisplayWidth><EnhancedStreamMode>1</EnhancedStreamMode><HdrMode>0</HdrMode><RefreshRate>60</RefreshRate><avkey>ok</avkey><gamesession>4a3acf05c891a901ef4a4241c3e3b0ae</gamesession><rikey>ok</rikey><sessionUrl0>rtsp://192.168.0.152:48010</sessionUrl0><wssignaling>0</wssignaling></root>

Stream 2560 x 1440, 60 fps, 80000 kbps
RTSP port: 48010
Initializing platform...done
Resolving host name...done
Initializing audio stream...done
Starting RTSP handshake...Audio port: 48000
Video port: 47998
Control port: 47999
done
Initializing control stream...done
Initializing video stream...done
Initializing input stream...done
Starting control stream...done
Starting video stream...Using display thread for amlvideo pipeline
done
Starting audio stream...done
Starting input stream...done
Received first audio packet after 0 ms
Initial audio resync period: 500 milliseconds
Received first video packet after 0 ms
Detected Wireless Controller (050000004c050000e60c000000810000) on /dev/input/event2 as Sony DualSense 
Detected Wireless Controller Motion Sensors (050000004c050000e60c000000810000) on /dev/input/event3 as Sony DualSense 
Ignoring accelerometer: Wireless Controller Motion Sensors
Assigned Wireless Controller as player 1
Detected Wireless Controller Touchpad (050000004c050000e60c000000810000) on /dev/input/event4 as Sony DualSense 
Not mapping Wireless Controller Touchpad as a gamepad
Stopping input stream...done
Stopping audio stream...ENet wait interrupted
Control stream connection failed: -1
done
Stopping video stream...Display thread terminated
done
Stopping control stream...ENet peer acknowledged disconnection
done
Cleaning up input stream...done
Cleaning up video stream...done
Cleaning up control stream...done
Cleaning up audio stream...done
Cleaning up platform...done

If i copy the launch script from luizkun to your latest release, i get the following output in the log file:

Moonlight Embedded 2.5.3 (AML;ALSA;PULSE;EMBEDDED)
Connecting to 192.168.0.152...
Request http://192.168.0.152:47989/serverinfo?uniqueid=0123456789ABCDEF&uuid=81a20254-c8dd-484d-bec4-056f5c1fabd2
Response:
<?xml version="1.0" encoding="UTF-16"?><root protocol_version="0.1" query="serverinfo" status_code="200" status_message="OK"><AuthenticationType>1</AuthenticationType><ConnectionState></ConnectionState><CurrentClient>0</CurrentClient><GfeVersion>3.26.0.154</GfeVersion><GsVersion>gs_04_46_31648965</GsVersion><HttpsPort>47984</HttpsPort><LocalIP>192.168.0.152</LocalIP><LocalIPs><Address>192.168.0.152</Address></LocalIPs><LoginState>2</LoginState><MaxLumaPixelsH264>1721324928</MaxLumaPixelsH264><MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC><Mode>0</Mode><PairStatus>0</PairStatus><ServerCapability>3895</ServerCapability><ServerCodecModeSupport>3843</ServerCodecModeSupport><ServerColorSpaceSupport>2</ServerColorSpaceSupport><SupportedDisplayMode><DisplayMode><Height>2160</Height><RefreshRate>60</RefreshRate><Width>3840</Width></DisplayMode><DisplayMode><Height>2160</Height><RefreshRate>30</RefreshRate><Width>3840</Width></DisplayMode><DisplayMode><Height>1080</Height><RefreshRate>60</RefreshRate><Width>1920</Width></DisplayMode><DisplayMode><Height>1080</Height><RefreshRate>30</RefreshRate><Width>1920</Width></DisplayMode><DisplayMode><Height>720</Height><RefreshRate>60</RefreshRate><Width>1280</Width></DisplayMode><DisplayMode><Height>720</Height><RefreshRate>30</RefreshRate><Width>1280</Width></DisplayMode></SupportedDisplayMode><accountId>975870C4CE165DDEFBAED96BAA87CA6C8B4F64EB359FD1A8E94376E0A14DE53C</accountId><appversion>7.1.446.0</appversion><currentgame>0</currentgame><gamelistid>e2208238775b4d12796e35a21350832e</gamelistid><gputype>NVIDIA GeForce RTX 2080 Ti</gputype><hostname>FUSION-WS</hostname><mac>D8:5E:D3:A2:57:C7</mac><numofapps>0</numofapps><resyncSuccessful>0</resyncSuccessful><state>MJOLNIR_STATE_SERVER_AVAILABLE</state><uniqueid>bb5763dd-2dd9-47d3-879c-f4659a192831</uniqueid></root>

Request https://192.168.0.152:47984/serverinfo?uniqueid=0123456789ABCDEF&uuid=30b21752-8a2e-4dc5-8fa5-c84533848be6
Response:
<?xml version="1.0" encoding="UTF-16"?><root protocol_version="0.1" query="serverinfo" status_code="200" status_message="OK"><AuthenticationType>1</AuthenticationType><ConnectionState></ConnectionState><CurrentClient>0</CurrentClient><GfeVersion>3.26.0.154</GfeVersion><GsVersion>gs_04_46_31648965</GsVersion><HttpsPort>47984</HttpsPort><LocalIP>192.168.0.152</LocalIP><LocalIPs><Address>192.168.0.152</Address></LocalIPs><LoginState>2</LoginState><MaxLumaPixelsH264>1721324928</MaxLumaPixelsH264><MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC><Mode>0</Mode><PairStatus>1</PairStatus><ServerCapability>3895</ServerCapability><ServerCodecModeSupport>3843</ServerCodecModeSupport><ServerColorSpaceSupport>2</ServerColorSpaceSupport><SupportedDisplayMode><DisplayMode><Height>2160</Height><RefreshRate>60</RefreshRate><Width>3840</Width></DisplayMode><DisplayMode><Height>2160</Height><RefreshRate>30</RefreshRate><Width>3840</Width></DisplayMode><DisplayMode><Height>1080</Height><RefreshRate>60</RefreshRate><Width>1920</Width></DisplayMode><DisplayMode><Height>1080</Height><RefreshRate>30</RefreshRate><Width>1920</Width></DisplayMode><DisplayMode><Height>720</Height><RefreshRate>60</RefreshRate><Width>1280</Width></DisplayMode><DisplayMode><Height>720</Height><RefreshRate>30</RefreshRate><Width>1280</Width></DisplayMode></SupportedDisplayMode><accountId>975870C4CE165DDEFBAED96BAA87CA6C8B4F64EB359FD1A8E94376E0A14DE53C</accountId><appversion>7.1.446.0</appversion><currentgame>0</currentgame><gamelistid>e2208238775b4d12796e35a21350832e</gamelistid><gputype>NVIDIA GeForce RTX 2080 Ti</gputype><hostname>FUSION-WS</hostname><mac>D8:5E:D3:A2:57:C7</mac><numofapps>0</numofapps><resyncSuccessful>0</resyncSuccessful><state>MJOLNIR_STATE_SERVER_AVAILABLE</state><uniqueid>bb5763dd-2dd9-47d3-879c-f4659a192831</uniqueid></root>

GPU: NVIDIA GeForce RTX 2080 Ti, GFE: 3.26.0.154 (gs_04_46_31648965, 7.1.446.0)
Platform AMLogic VPU
Loading mappingfile gamecontrollerdb.txt
Detected Wireless Controller (050000004c050000e60c000000810000) on /dev/input/event2 as Sony DualSense 
Detected Wireless Controller Motion Sensors (050000004c050000e60c000000810000) on /dev/input/event3 as Sony DualSense 
Ignoring accelerometer: Wireless Controller Motion Sensors
Detected Wireless Controller Touchpad (050000004c050000e60c000000810000) on /dev/input/event4 as Sony DualSense 
Not mapping Wireless Controller Touchpad as a gamepad
Not mapping meson-ir as a gamepad
Not mapping cec_input as a gamepad
Ccodec_init amstream version : 2.0
EVIOCGRAB failed with error 16
Error: cannot keep up

I updated to coreelec20 and some of the nexus builds of luna and it was still very stuttery.

This N2+ has huge potential with the gpu having 4x the horsepower of the rpi4b gpu but its closed source driver performance is really bad comparatively. So it’s getting outperformed by something that is about 25% of it’s power.

I moved back to coreelec19.5 and the 151 matrix build posted 8 days ago and accidently removed my configs of luna. I discovered the pairing functionality is currently broken between luna and sunshine. Clearing out the configs of moonlight-qt on the pi and setting it up from scratch lets me know that the client and server side pairing still works, just not on the luna client. No matter which version of luna I use, it wont pair anymore. It just says pairing failed or already paired, it never generates a pairing code.

So current status seems to be not working at all, and if there are grand-fathered in pairing keys to make the pairing work, it doesnt perform well.

also, why is the coreelec repo version 143 and the current 151

You’re right about the version on repo, I just haven’t updated it since I still don’t have a stable version!

I really don’t like the fact that my device works but it doesn’t work on all CoreELEC devices and now devices outside are broken too.

If someone had the time, I would like someone to test a few configurations. But you should use the latest version so CoreELEC 20 would be required.

But as you’ve also noticed it, getting this to work is not easy since closed source means no documentation on why it is underperforming…

Also, RIP my box just died. So I can no longer test stuff :sob:

I can help you test, as my n2+ has been rotated out of use in favor of the pi4b as a gamestream reciever. I do *nix based dev-ops support irl so can probably help you develop to some extent if need be, i can do some scripting and packaging but cant code things as deep as C or rust

Just let me know

edit: In an earlier post you said you are just compiling for 20 now, but the latest post is script.luna-1.2.0-matrix.151.zip

matrix is 19, so is this mislabeled or this one really for 19? I think 20 is called nexus

matrix is added from the Luna version (the addon). The addon does not have anything new for nexus. It would probably be best if I removed matrix there so it was more clear.

Thanks, missed that!

For what it is worth, I can pair moonlight with sunshine from the cli

EDIT: I have managed to get a full blown stream up and going from cli with

moonlight stream -app Desktop -verbose -mapping /storage/.kodi/addons/script.luna/bin/gamecontrollerdb.txt -1080 -fps 60 -bitrate 15000 -codec h265 -audio hw:0,0

and manually running a few of the script lines

CoreELEC:~ # echo 1 > /sys/class/graphics/fb0/blank
CoreELEC:~ # echo 0 > /sys/class/video/disable_video
CoreELEC:~ # for X in /sys/bus/usb/devices/*

do
# echo “Discovered: $X”
if [ -e “$X/idVendor” ] && [ -e “$X/idProduct” ]
then
echo “Resetting device: $(cat “$X/idVendor”) : $(cat “$X/idProduct”)”
echo 0 >“$X/authorized”
echo 1 >“$X/authorized”
fi
done
Resetting device: 05e3 : 0610
Resetting device: 05e3 : 0620
Resetting device: 1d6b : 0002
Resetting device: 1d6b : 0003

(the 0 into framebuffer1 seems unneccessary)

Im not sure if it’s upstream updates to amlogic drivers or the new coreelec20, but 15mbps is much less stutter on the same cave i’ve been clearing over and over to test with in elden ring. Its only very slight now. We’re talking <5fps long stutters before to hiccups where it only hits 40 for a split second. It’s still much worse than where the pi4b stabilizes around 28mbps with only 25% of the horsepower, but with things being closed source, it kind of is what it is.

So I’ve tested things as far as getting moonlight-embedded and sunshine talking and a fully operational stream, its just the luna frontend doesnt seem to be getting any traction when it tries to do things. So things seem much less broken than they seemed earlier

When these hiccups occur, do you see any output in the SSH? Does it drop audio packets or something like that?

Oh it’s constantly dropping audio stuff, it doesn’t seem to coincide with the frame rate drops though

hi. my first time with luna but getting error in host addres process (host addres working in other system). CE matrix and last addon downloaded from post

i am reading about manually connect but how to do?

greetings and thanks