Moonlight-embedded and Luna Launcher

Hi folks.
I’m trying to handle moonlight-embedded with Sunshine server.
I compiled that with the @joakim_s recomendations and works perfec streaming 4k. However, the Luna script fails when I try to enter on any of the applications that Sunshine serves.

Could you give me your help to make it work?

You need to take a look at the log. Also my suggestion is to redirect all moonlight logs into separate file to make debugging easier, like so for launch.sh:

...
moonlight stream -app "$@" >> ~/.kodi/temp/moonlight.log
.....

This file is located in /home/osmc/.kodi/addons/script.luna/resources/launchscripts/custom/launch.sh

This will allow you to look at logs in ~/.kodi/temp/moonlight.log and troubleshoot.

Hi, the log only shows this:

Searching for server...
Connecting to XXX.XXX.XXX.XXX...

I’m using a Vero 4K+ and I have OSMC 2023.12-1, with Kodi 20

On kodi.log i can see this when launching the script:

2024-01-04 18:03:44.845 T:6621    error <CSettingGroup>: unable to create new setting "last_run"
2024-01-04 18:03:44.845 T:6621    error <CSettingGroup>: unknown setting type "hidden" of "launchscript_conf"
2024-01-04 18:03:44.845 T:6621    error <CSettingGroup>: unable to create new setting "launchscript_conf"
2024-01-04 18:03:46.771 T:6627     info <general>: Moonlight binary could not be found. Configuration file saved at /home/osmc/.kodi/addons/script.luna/
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unknown setting type "hidden" of "addon_version"
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unable to create new setting "addon_version"
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unknown setting type "hidden" of "last_run"
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unable to create new setting "last_run"
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unknown setting type "hidden" of "launchscript_conf"
2024-01-04 18:03:46.774 T:6627    error <CSettingGroup>: unable to create new setting "launchscript_conf"
2024-01-04 18:04:48.005 T:6539     info <general>: CActiveAESink::OpenSink - initialize sink
2024-01-04 18:04:48.005 T:6539     info <general>: CAESinkALSA::Initialize - Requested layout FL, FR
2024-01-04 18:04:48.006 T:6539     info <general>: CAESinkALSA::Initialize - set digital codec 0
2024-01-04 18:04:48.006 T:6539     info <general>: CAESinkALSA::Initialize - Attempting to open device "default"
2024-01-04 18:04:48.017 T:6539     info <general>: CAESinkALSA::Initialize - Opened device "default"
2024-01-04 18:04:48.019 T:6539     info <general>: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2024-01-04 18:04:48.020 T:6539     info <general>: CAESinkALSA::InitializeHW - Using data format AE_FMT_S24NE4
2024-01-04 18:04:48.024 T:6539     info <general>: CAESinkALSA::Initialize - speaker layout 0
2024-01-04 18:04:50.968 T:6635     info <general>: Moonlight binary could not be found. Configuration file saved at /home/osmc/.kodi/addons/script.luna/
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "addon_version"
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unable to create new setting "addon_version"
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "last_run"
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unable to create new setting "last_run"
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "launchscript_conf"
2024-01-04 18:04:50.970 T:6635    error <CSettingGroup>: unable to create new setting "launchscript_conf"
2024-01-04 18:04:53.075 T:6520  warning <general>: CGUIWindowManager - HandleAction - ignoring action 7, because topmost modal dialog closing animation is running
2024-01-04 18:04:53.298 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "addon_version"
2024-01-04 18:04:53.298 T:6635    error <CSettingGroup>: unable to create new setting "addon_version"
2024-01-04 18:04:53.298 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "last_run"
2024-01-04 18:04:53.299 T:6635    error <CSettingGroup>: unable to create new setting "last_run"
2024-01-04 18:04:53.299 T:6635    error <CSettingGroup>: unknown setting type "hidden" of "launchscript_conf"
2024-01-04 18:04:53.299 T:6635    error <CSettingGroup>: unable to create new setting "launchscript_conf"
2024-01-04 18:04:53.400 T:6538  warning <general>: CActiveAE::StateMachine - signal: 0 from port: OutputControlPort not handled for state: 7
2024-01-04 18:04:58.400 T:6635    error <general>: ActiveAE::Resume - failed to init
2024-01-04 18:05:07.285 T:6539     info <general>: CActiveAESink::OpenSink - initialize sink
2024-01-04 18:05:07.285 T:6539     info <general>: CAESinkALSA::Initialize - Requested layout FL, FR
2024-01-04 18:05:07.285 T:6539     info <general>: CAESinkALSA::Initialize - set digital codec 0
2024-01-04 18:05:07.285 T:6539     info <general>: CAESinkALSA::Initialize - Attempting to open device "default"
2024-01-04 18:05:07.292 T:6539     info <general>: CAESinkALSA::Initialize - Opened device "default"
2024-01-04 18:05:07.292 T:6539     info <general>: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2024-01-04 18:05:07.293 T:6539     info <general>: CAESinkALSA::InitializeHW - Using data format AE_FMT_S24NE4
2024-01-04 18:05:07.295 T:6539     info <general>: CAESinkALSA::Initialize - speaker layout 0
2024-01-04 18:05:07.817 T:6650     info <general>: Moonlight binary could not be found. Configuration file saved at /home/osmc/.kodi/addons/script.luna/
2024-01-04 18:05:07.820 T:6650    error <CSettingGroup>: unknown setting type "hidden" of "addon_version"
2024-01-04 18:05:07.820 T:6650    error <CSettingGroup>: unable to create new setting "addon_version"
2024-01-04 18:05:07.821 T:6650    error <CSettingGroup>: unknown setting type "hidden" of "last_run"
2024-01-04 18:05:07.821 T:6650    error <CSettingGroup>: unable to create new setting "last_run"
2024-01-04 18:05:07.821 T:6650    error <CSettingGroup>: unknown setting type "hidden" of "launchscript_conf"
2024-01-04 18:05:07.821 T:6650    error <CSettingGroup>: unable to create new setting "launchscript_conf"

I’ve modified the script a little, the result is the same as in the default command:

#!/usr/bin/sh

killall -STOP kodi.bin

mv /home/osmc/.kodi/temp/moonlight.log /home/osmc/.kodi/temp/moonlight.log.old
/home/osmc/moonlight stream -platform aml -4k -verbose -config ./moonlight.conf -app "$@" > ~/.kodi/temp/moonlight.log

killall -CONT kodi.bin

I’m unsure if Luna, un modified for OSMC, will be able to run. Since mediacenter is restared as soon as kodi.bin dies, I guess that Luna script will probably have a hard time.

On another note, seems like there has been some regression somewhere. Used to have it working on my Vero4k, but I cant get picture any more, i can hear the audio stream and my controller effects the gameserver. But in short, getting the video stream to display is still a small cunandrum. Working on it when I have some spare time.

But what used to work for me, was ssh in and run something liek this:
sudo sysemctl stop mediacenter : pskill -9 kodi-bin
Then start moonlight from ssh session.

But as of a while back, you can get audio and controls to stream, but video is still a bit of a humbug for me…

Ok, I’m thinking about creating some shortcuts from kodi interface to start moonlight. How can we do it from kodi? Which commands should I use?
There is another script adapted to OSMC for this purpose?

For me it works as is (without kodi restart), I had only to point it to the right moonlight executable, which is self-compiled.

For some reason it works only with setting of codec on h.265, while actual encoding is happening in h.264 (my GPU do not support h.265 hardware encoding). More details is on the github issue: https://github.com/moonlight-stream/moonlight-embedded/issues/573

Can you share your launch.sh from luna script?

#!/usr/bin/sh

killall -STOP kodi.bin

cd /usr/src/moonlight-embedded/build
#./moonlight stream -app "$@" -4k -fps 60 -bitrate 80000 >> ~/.kodi/temp/moonlight.log
./moonlight stream -app "$@" >> ~/.kodi/temp/moonlight.log
#./moonlight stream -app "$@" -1080 >> ~/.kodi/temp/moonlight.log


killall -CONT kodi.bin

Not working for me.
I’m thinking if we can modify luna script based on Steam Link OSMC launcher:

@me6 which version of OSMC and Kodi are you using?

They way I solved this issues before(my addons “root console on TV” and “X-windows with chrome”),
I make Kodi start a bash script, that opens another another bash script, in virtual terminal and switches to that VT.Mean while the first script shutsdown mediacenter process and then hard kill kodi.bin and waits for return of the virtual terminal and restarts mediacenter process again.

Now it’s been a few years since I ripped this launch technique from the original RetrOSMC, which launched Retropie on a Pi2, running Osmc. I’ll gladly guide you through the process, but we should perhaps do it in PM instead of a public thread. I myself haven’t looked at those scripts for almost 5 months.

You’ll find links to the X-windows installer, here on the forum. The installer isn’t that special, but it copys the zip containing launcher addon and a the other folder needed for the nested bash scripts., this was done while I hardly knew how addons were supposed to be packaged.

@tomasdeltell feel free to PM me, if you have any questions. Mean while I will start to focus on getting Moonlight-embedded running again on both 4k(+) and V.