[HowTo] Moonlight-Embedded (former Limelight) using Luna Launcher

or you can use the git that dodslaser made it makes all of this out of the box

https://github.com/dodslaser/moonlight-osmc

if you dont sort it out ill make a small python addon for kodi that launches moonlight

Thanks - i’ll give it a go and see how it works out

@Toast Update: So I eventually hacked and slashed my way and got it up and running using the script from dodslaser. My wireless 360 controller wasn’t working properly so i ended up setting xboxdrv to boot at start, making it up as I went along.

The weird thing is that the streaming seems actually worse than the setup I had running with my Pi1 using Raspbian. That’s even with setting the streaming to 30fps. I had hoped for 60fps by using the settings from here: https://github.com/irtimmer/moonlight-embedded/issues/81#issuecomment-90366446

i.e.
force_turbo=1
h264_freq=333

But as a separate issue I think i’ve got power issue for my Pi2 since I keep getting the rainbow square (new Power supply on the way) and it keeps sort of crashing

These overclock settings apparently make the streaming playable at 60fps and don’t void the warranty but ideally they would be set when streaming starts and turned off when streaming stops (if that’s possible with these settings?)

In any case I haven’t even got to the part where I’ve set some sort of shortcut within osmc since the stream is very unreliable at the moment - the controller is also not working correctly.

I’d have preferred to get your instructions up and running since I think they compile from sources which to my untrained eye seems like a better approach? In any case, the controller needs to work properly and another reason I messed with xboxdrv is so the lights stopped flashing on my controller.

Tomorrow I’m going to do a fresh install and try the script from dodslaser again…

Would be great if there was a literal step-by-step list of commands to run that worked on a fresh installation of OSMC on the Pi2. I didn’t even really know which directories I should put some files as it’s not specified so just had to guess. Thanks for your help so far @Toast - looking forward to seeing how all this progresses so hopefully I can actually play some games!

1 Like

To add shortcut to your home screen go to skin settings > add shortcut then in “custom action”(I don’t know how it’s called in English, I’m using different language) type

System.Exec("sudo sh ~/moonlight/moonlight.sh")

not sure if you’re suppose to run it as sudoer, but it worked for me. Save and then you will be having it on your main screen. Give it a while after clicking it takes some time to stop mediacenter.

I also have issues to run it smoothly in 1080@60. I’ve got huge screen stuttering and a lag making gaming impossible. Not to mention visible compression artifacts. I tried built-in osmc OC setting to turbo, faster SD card, ethernet connection but with no luck. I’m starting thinking whether my GTX660 is capable to stream 1080p at 60.

Looking forward to your tests with better power supply :smile:

@marcello Thanks for clarifying how to make the shortcut :smile:

I’m holding off before attempting to start again from scratch until my new power supply arrives. I’m taking no chances and got the “official” one from RS components. Hopefully I’ll have a stable base to work from then.

If I can’t somehow manage to get a fairly streamlined setup going from within OSMC I might just have to go the dual boot approach I’ve seen elsewhere and somehow figure that out to get OSMC running and then reboot to load up the streaming part (possibly using retropie as I’ve seen others do). Maybe running Raspian on the Pi1 is the reason for getting such surprisingly good results from that and I think OSMC runs something different? I did do a firmware update on the Pi1 too so maybe that helped too… I don’t know. The issue I’m having as I’ve mentioned (quite a few!) times now is that while there are some super great people here and on other forums and websites helping us all out with their own time and for free, providing us with help and code, sometimes the instructions given assume a level of knowledge I just don’t have (yet!). I did start a n00b guide, hoping to save others time but gave up when I ran into error after error. Honestly, if an installable, updateable and configurable addon appears for this I’ll be over the moon (and will donate for sure if that’s the done thing). In the meantime… I’ll figure something out!

updated moonlight_watchdog.sh add it too your home folder

#!/bin/bash
 sleep 30
	while [ true ]; do
	VAR1="$(pgrep moonlight)"
	    xbmc-send -a 'Notification("Info","Starting Moonlight")'
	    if [ ! "$VAR1" ]; then
	if [ "$(which xboxdrv)" ]; then
	    xbmc-send -a 'Notification("Info","Microsoft XBox 360 Controller found")'
	    sudo pkill xboxdrv
	    /usr/bin/xboxdrv --config /home/osmc/xbmc.ini --silent --autofire RT=25 --autofire LT=25 --autofire du=200 --autofire dd=200 --autofire dl=500 --autofire dr=500 & 
	fi
	if [ "$(which wiimote)" ]; then
	    sudo /usr/bin/wiimote
	fi
	sleep 1
	    sudo openvt -c 7 -s -f clear
	    sudo openvt -c 7 -s -f echo "Moonlight quit... Starting KODI."
	sleep 1
	    sudo openvt -c 7 -f clear
	    sudo su -c "sudo systemctl restart mediacenter &" &
	sleep 1
	    exit
	else
	    sleep 2
	fi
done

and here is a launcher for it instead of a shortcut installed it via addons > install from zip file in kodi

https://gitlab.com/swe_toast/retrosmc_addons/blob/master/script.moonlight.launcher.zip

all thats missing now is ps3 config the most common controllers are covered

1 Like

@dodslaser added your git repo to the howto, just wondering how you launch with moonlight.conf file?

What do you mean by good results? Simpler setup procedure or overall performance? I don’t think you would get any performance boost with dual boot. When you stop mediacenter service it’s no longer using PI resources so all of them would go to moonlight.

AFAIK OSMC runs on top of the latest debian jessie. I’ve got exactly the same results running moonlight on Raspbian Wheezy and OSMC. I’m slowly starting to think that Steam Link could be only good solution for 1080@60 :confused:

I don’t think that is going to work ? I assume you’re trying to display a popup notification ?

In which case you would want something like:

xbmc-send -a 'Notification("Info","Microsoft XBox 360 Controller found")'

(The first argument is the notification header, the second the notification body. An optional 3rd argument is the minimum time to display the alert, in milliseconds)

I just use source on the conf in stream.sh.

I’m currenrly working on packaging for a PPA, and automating that process, so I haven’t done much in terms of features. I’ll probably write up a launcher plugin for Kodi when I’m done with the packaging stuff.

Edit: Thanks for adding my repo to the guide by the way.

Well I initially experimented by installing noobs on my Pi1 from which I then manually set up Moonlight using various sources of information on the net. When I finally got it working, I was actually amazed to find that the experience on my lowly Pi1 was much better than expected. Games were playable. Lag was there but just about small enough to be ignored with use. I could see that the image quality suffered at times and attributed that to the underpowered Pi1 since I tested using both powerline network connection and a direct ethernet cable to my router. Obviously SSHing into my Pi1 wasn’t really practical and I thought that the Pi2 and OSMC were the ideal setup for streaming in this way. I was expecting a small but noticeable boost in graphical quality (or at least less of the compression artifacts and stutters) and maybe a little less lag.

Setting up with OSMC and my Pi2 I have to say I’m not getting the benefits I expected compared to my Pi1. I’m still glad I got my Pi2 and am looking forward to setting up and using OSMC but given that 1080p at 60fps is going to be difficult if not impossible to achieve I’m a little disappointed even though it’s mentioned in many places that this is all experimental and early stages. It does seem that there are people out there that have reported great results by using the overclocking mentioned previously but ideally that needs to be enabled as Moonlight starts and disabled when streaming stops for most people - we don’t really want to run at full speed all the time.

7hunderbug mentions great performance: (Raspberry pi 2 · Issue #81 · moonlight-stream/moonlight-embedded · GitHub) but also mentions using the Java process - which I think is different to what’s used here?

I can see in my head how it all works but my ability to implement it is severely lacking. Hopefully either @Toast or @dodslaser will eventually put together something that does all of this for OSMC in a fairly automated and optimised way? Seems like they’re still working on things so that’s good news and I’ll keep checking back and tinkering with my Pi2.

I wonder if it would also be possible to dynamically assign more memory to the graphics on the Pi2 when Moonlight is launched or if that would help generally?

Maybe the Steam link would be the best way in the end to get this all working? Shame… I’ve even been looking at a mini android box to try the streaming with since the issue with the Pi2 is mostly the graphical restriction it seems. But then that would be more experimental and money cost that might not be ideal either… Wonder when the Steam box is going to be available?

1 Like

So I’ve started a Google Doc attempting to provide full step-by step instructions (I’m SSHing into OSMC from Windows using Putty) from scratch for other n00bs like me using what ended up being a combination of reordered and tweaked instructions from this thread and @dodslaser git page. I did try initially just using the instructions from the git scripts page by @dodslaser but it came up with too many warnings about dependencies etc. My doc is messy and incomplete and in the end it messed up anyway (I manually updated the moonlight-watchdog.sh with the most recent scriptposted from @Toast and it didn’t go smoothly - main issue still is that my wireless 360 controller not working/configured

Google Doc with instructions

I’m going to leave this for now and maybe try Raspian to see how that works out :disappointed: until maybe there are some updates to the scripts. If this doc is useful then I’ll update it or amend it if there are problems or suggestions or I can even make it editable if that would help?

p.s. I did previously use the xbox.map file downloaded from here: http://embedded-software-architecture.com/?page_id=140

Use the following command when in the /opt/moonlight-osmc directory:

wget https://raw.githubusercontent.com/RoelofBerg/moonlightpisteambox/master/xbox.map

and used it in the moonlight arguments by editing the config file and adding: -mapping xbox.map

in addition to following the instructions here: Home · moonlight-stream/moonlight-embedded Wiki · GitHub

To get my wireless xbox 360 controller working without flashing lights

But getting it all working together with the scripts provided, and within osmc is at the moment, not something I can do

1 Like

@DBMandrake tnx writing shell scripts when tired sure makes for a perfect fuckup :smiley:

Are you on a pi2? What deps is it complaining about? I’ve only tested against the latest osmc from the windows installer on a pi1. The installer script might be a bit messy, and since I’m working on debian packaging I don’t want to put a lot of time into fixing the installer.

If irtimmer would just fix the deps for osmc this whole thing would be a lot easier. I’ve submitted a pull request for this, but he hasn’t replied. He might want to keep it on raspbian for compatibility reasons. In that case I’ll have to do custom builds, which will take even more time.

A few things I should point out:

  • I’m doing this on my free time (which I don’t have a lot of right now)
  • The code in the github repo is going to change. A lot. Whats there now should be considered very much alpha, and is mainly my quick and dirty approach to getting it working at all.
  • For now I place all scripts in /opt/moonlight-osmc and the config in /home/osmc/.moonlight-osmc/ This might change. Not sure yet.
  • I probably wont fix stuff in the master branch for a while, or add new features to it. All my work is going into debian packaging and getting a repo up if possible. The current state of this project is available in the development branch, which is probably broken and not working as of now.
  • I don’t know if “official” support for osmc in irtimmers package for moonlight-embedded is going to be a thing or not yet, but if he doesn’t add that maintaining this project will be a bit more time consuming (and therefore behind on updates).
  • Once I finish debian packaging I’m going to try to get it to work on controller support and maybe a kodi launcher.
1 Like

Everyone is doing this on their free time :slight_smile: still waiting on a answer about how to launch withn a conf file like the one in your repo

1 Like

I know, it was the not having a lot of it part that I wanted to stress. I would love to have some more time to put into this project, as it would be really cool to make it easy to set up and have it working well in osmc. I might be able to finish debian packaging this week. I’m nearly there. From there automating it for the future should be easy, and make future releases smother.

As for the config, I use the source command (or rather the shorthand version, .) in stream.sh. It looks something like this:

. /home/osmc/.moonlight-osmc/moonlight-osmc.conf

This sources the variables I set in moonlight-osmc.conf (it actually executes it within stream.sh, hence the #!/bin/sh in moonlight-osmc.conf)

1 Like

Sorry for very late reply. Yep I’m on the Pi 2. I’ve actually given up for the time being since all my experiments, while genuinely fun, were also very frustrating. Ended up with annoying “stutter” during otherwise great quality game streaming that despite hours of tweaking settings on the Pi2 and my network settings and my computer i just couldn’t eliminate. Others have no such issues it seems… I’ve recently installed Windows 10 so hoping to see how the streaming is with that. The only game I had running was GTAV so maybe it’s the game itself but I was so so close and yet so far. Thanks so much for the time you do spend on this stuff to then share it with others. Hopefully some day soon the stars will align and this streaming stuff will work fairly cleanly and amazingly well (agan, we’re very very close I think).

I can’t from memory remember the warnings or errors I was getting. If it would help me testing anything I’d be happy to help although I would guess things have moved on since?

Ah, I see. Moonlight seems to put more stress on the system in general in my experience. I played Far Cry 4 on max settings with no problems, but with moonlight its barely playable. The C rewrite is definitely better tho.

I’ve been pretty busy lately; my home server is misbehaving. I’ve managed to get some things done with my project still. I’ve completed setting up for Debian packaging, and I now have a apt repo. Irtimmer merged my patch for OSMC, so next release will have official support for installing from his apt repo on OSMC. Until then I’ve mirrored the debs on my repo with OSMC support added.

Take a look at my github repo for install instructions. If you get any errors while installing you can just ask me here or open an issue on github and I’ll look into it.

EDIT: Problem Solved: I had to Issue “sudo modprobe snd-bcm2835” then moonlight opens up on the Raspberry PI.

Hi,

I just went through the Compiling Holocaust and I need help.

I have a problem with moonlight-embedded and moonlight-osmc on the latest OSMC version running on raspberry Pi 1.

When I issue the command: “moonlight stream myhostIP”, GameStream opens on my Desktop PC and not on the raspberry Pi. I have created a issue on GitHub here: GameStream opens on Desktop PC and not on the Raspberry PI · Issue #220 · moonlight-stream/moonlight-embedded · GitHub

Anyone knows how to solve this issue?

Also I wonder why noone just uploads a working image containing OSMC and moonlight with everything setup just right? Wouldn’t that be easier and more efficient for everyone rather than having to put everyone through the Linux Compiling Holocaust?! I have already wasted several days trying to setup moonlight on my raspberry pi. For a Windows user it is a major PITA to find out how to resolve all these missing dependency issues and all the other issues you encounter while compiling stuff for linux (does someone really wonder why Windows is more successfull than Linux?). It would be easier to just write a image to a sd card and boot. I don’t wanna know how to compile or install moonlight. I just want it to work.

Just thinking out loud and trying to let off steam and cooling off from the Compiling Holocaust. :wink:

Is OSMC raspbian … NO… read before doing stuff… start from the beginning… and do it right