[Unofficial] moonlight-embedded

.189 moonlight gui and v4l2 driver

  • decoder stays loaded - “Unload the decoder on exit” setting is gone,
  • faster menu - the menu responds immediately,
  • Updates: a newer CoreELEC 22 nightly (4460192f) and an updated video decoder driver.

Thank you skupi and vortex for all your work. Both work much better than moonlight on android on my am6b+.

I’m curious what performance others are getting. With default sunshine/apollo/vibeshine (tested them all, default settings), I get about 7-10 ms of decode time on the am6b+ with HEVC, 4k and 60 fps. It’s just beyond the range of usable for me. I wonder if other people are getting the same performance. Most of the settings are latency optimized on client side..

latency optimized on host* side sorry.

I’ll look at mine next time I go on, with my setup everything is fairly smooth and quite playable, its not quite as smooth as using Moonlight on my Intel i3 NUC with fairly entry level Iris XE Graphics, but certainly quite a positive experience for the brief times I get to play for 30 mins or so.

For decoding at 60 fps, the window is approximately 16 ms… Anything shorter than that has no impact on performance…

This even provides a reserve of resources for host-side encoding, network latency…

This means there is also some margin for performance.

Of the delay stems from the television itself—it is the primary culprit. However, enabling “Game Mode” on your TV (or whatever it might be called on your specific model) can significantly reduce overall input lag.

Interesting. Yes game mode is a must.

@skupi

I’ve been trying to get HDR10 working with your Moonlight build on my Ugoos AM6B+ running CoreELEC 22 (October 21 nightly), streaming from VibeShine using a Windows HDR virtual display.

HDR seems to work correctly on the PC side. VibeShine automatically enables Windows HDR when streaming starts, and Moonlight’s debug overlay reports that it’s receiving a 10-bit HDR stream.

However, the image on my TCL TV looks very washed out and the TV never switches into HDR mode.

I checked the HDMI output through SSH while streaming, and it reports:

Colour depth: 10-bit
Colourspace: YUV422
EOTF: SDR
Colourimetry: BT.709

Moonlight is receiving an HDR stream, CoreELEC is still sending an SDR signal to the TV.

Regular HDR10 video playback through Kodi on the same device works perfectly. The TV correctly switches into HDR mode. So it seems specific to Moonlight rather than a CoreELEC or TV issue.

The Moonlight log also contains these messages:

DRM: this connector has no BT2020_YCC colorspace
DRM: the host sent no HDR metadata, leaving the display to guess

Would this be something that needs additional support in your DRM/V4L2 implementation? I’m happy to test any changes or provide additional logs.

Thanks for all your work on this build!

I have a similar issue with @vortex fork - not triggering my TV’s HDR mode. Also vortex, one thing on my wish list is for moonlight to auto activate game mode on my tv, which is something skupis fork does. It’s a huge qol thing!

As soon as I finish testing the HDR mode and it’s working correctly, it will be added—just like other features. A bit later on.

I’m also testing a working version of scrcpy for CoreELEC—though I’m not sure if it’s actually needed… You can simply connect a phone or a second set-top box and use its browser and apps; it launches extremely quickly, as if everything were installed directly within CoreELEC. That said, there are some issues regarding DRM/Widevine, and I suspect this will lead to numerous questions that I won’t be able to answer openly…

Thanks for the report. HDR can’t work on the plain DRM path. The CoreELEC HDMI driver gives DRM no way to switch the TV into HDR, and the frames there are 8-bit.

In the add-on settings, turn on “Capture buffers from the display driver” (UVM). It’s only visible at the Advanced or Expert settings level. With it on, frames reach the display as amlogic vframes, the same way coreelec does, keeping 10-bit and the HDR signalling. It’s off by default, in next version I will make it on by default.

Keep “Video backend” on drm, which is the default. The aml backend is still being tested and may not work yet.

TV game mode (ALLM) did works for you? Could you tell me more? My Philips doesn’t support ALLM. The fallback for older HDMI 1.4 TVs (the “Game” content type flag) doesn’t switch it either, so I’d really like to know how it works on supported TV.

I’m on your latest version and I don’t see that setting or expert settings option anywhere.

yes ALLM seems to work as my tcl qm7k triggers game mode (it’s on auto detect mode, so it’s normally off on kodi) and the ALLM checkmark is there.

You can change this setting in Kodi under moonlight settings.
Press and hold Select/OK, or press Menu on the Moonlight icon in Kodi. When the context menu appears, choose Settings.

It’s not part of Moonlight’s interface settings, those applies to the streaming protocol.

In the next release i will enable UVM by default.

.197 moonlight gui
The aml backend now works, so the V4L2 decoder driver addon is no longer required. Pick the backend that works best for you in the addon settings (kodi interface).

  • Video threads get priority, possibly smoother picture
  • Decoder shows frames as soon as they’re ready
  • Late frames are skipped
  • New setting: Picture straight to the screen (experimental, drm)
  • Settings the running backend doesn’t use are greyed, value kept
  • Statistics show ALLM and decoder mode
  • aml: statistics on screen, same pad combination
  • aml: picture works
  • aml: fix for H.264 above 1080p
  • aml: stalled decoder recovers instead of freezing
  • AV1: fix for no picture, drm and aml
  • HDR: colours fixed when the PC isn’t in HDR
  • Refresh updates computer status without reloading the menu
  • Menu shows the video backend in use

EDIT:

drm: V4L2 decoder, our own frame pacing like Moonlight on Android (latency or balanced). H.264, HEVC and AV1 work. No HDR.

drm + UVM: like drm, with full 10-bit HDR. AV1 shows pink here, so the stream falls back to HEVC - will try to solve it. After turning UVM off, restart Kodi.

aml: CoreELEC’s own decoders thx @vortex . H.264, HEVC and AV1 work, with 10-bit HDR.

All three switch the TV to the stream’s mode and show statistics. Pick drm + UVM for HDR, or aml for AV1 with HDR.

That did the trick.

Am I correct in assuming using AML isn’t currently working with HEVC at 4k60? When I tried it seems to only be displaying 1080p since its blurry, even though I have 4k selected.

AML was experimental in previous versions, but the latest version is working properly now. I’m still checking a few issues with AV1 and frame packing. I should have an updated version with AML and the DRM backend working later today or tomorrow.

EDIT:

update is uploaded

Thanks a lot skupi.

Unfortunately, the blurry picture issue I previously reported with AML is still present with your latest version.

It looks like the AML HEVC decoder correctly receives 3840×2160 at 60 fps, but the actual HDMI output remains at 1920×1080 120 Hz (confirmed through both sysfs and modetest). Kodi system settings are configured for 4K60. I should also mention that when I launch moonlight the gui is in 1080p120.

I gave the log to chatgpt and it noted these entries:

UI: connector 129, CRTC 89, 1920x1080@120

UI: aml keeps the display, plane cleared to transparent

AML: codec_init 3840x2160 rate 1600

AML: /sys/class/video/axis = 0 0 1919 1079

So AML correctly initializes the 4K60 decoder, but retains a 1080p120 HDMI output instead of switching to 4K60. Perhaps the issue starts with the Moonlight GUI selecting or inheriting the wrong display mode?

I should mention the Moonlight GUI starts at 1080p120 with both backends, but DRM correctly switches the HDMI output to 4K60 when the stream begins. AML doesn’t switch and remains at 1080p120 throughout.

Another thing skupi.

I’m having issues with Sunshine’s automatic resolution switching.

I’m using virtual display (VDD) on Windows which is defaulting to 800×600 when activated from moonlight. I configured sunshine to force 3840×2160 at 60 Hz but the resolution never changes when starting a stream.

Sunshine logs show:

Warning: Sunshine is configured to change resolution manually, but the "Optimize game settings" is not set in the client! Resolution will not be changed.

It looks like the client isn’t sending the sops (Optimize Game Settings) flag. I checked the add-on settings and ui.conf, but couldn’t find an option to enable it.

Would it be possible to enable this flag by default or expose it as a setting?

it was late, i don upload new version of moonlight gui only driver :slight_smile: check 197

.198 moonlight gui

  • sops added

Perfect! Amlogic decoding, working allm, working hdr, multichannel audio, its all working great. It’s everything I needed! Thank you so much!

Only thing is the OSD doesnt show decode latency for AML.

I’m curious now how the two pipelines compare, which one is actually better.