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

Worked out really good! Almost no dealy over wifi either! Thank you so much!

@diagonali , My Xbox360 wired controll worked directly without configruation.

:disappointed: I’m so disappointed right now. I finally got everything working just the way it’s meant to (with the help and great work of the guys setting all this stuff up for us) and now I’m having a lot of issues with the quality of the stream, as fart as I can tell, because of the slow networking speeds of the Raspberry Pi. I had previously bought a Raspberry Pi 2 but since it wasn’t all that much of an upgrade to the Pi1 as I’d hoped, I sold it.

I’ve tried everything I can think of to improve the stream quality and stability. iperf 3 is giving me:

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.150, port 43608
[  5] local 192.168.0.90 port 5201 connected to 192.168.0.150 port 43610
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec  3.83 MBytes  32.1 Mbits/sec
[  5]   1.00-2.00   sec  3.62 MBytes  30.3 Mbits/sec
[  5]   2.00-3.00   sec  3.74 MBytes  31.4 Mbits/sec
[  5]   3.00-4.00   sec  3.77 MBytes  31.6 Mbits/sec
[  5]   4.00-5.00   sec  3.66 MBytes  30.7 Mbits/sec
[  5]   5.00-6.00   sec  3.83 MBytes  32.1 Mbits/sec
[  5]   6.00-7.00   sec  3.79 MBytes  31.8 Mbits/sec
[  5]   7.00-8.00   sec  4.04 MBytes  33.9 Mbits/sec
[  5]   8.00-9.00   sec  3.95 MBytes  33.1 Mbits/sec
[  5]   9.00-10.00  sec  3.59 MBytes  30.1 Mbits/sec
[  5]  10.00-10.07  sec   233 KBytes  25.9 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.07  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.07  sec  38.0 MBytes  31.7 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

Which seems decent enough? Does anyone who is successfully streaming think those speeds look ok?

I’m not otherwise sure if some of the streaming settings if I could tweak them would help. I’ve also ordered an official Raspberry Pi power supply which should rule out stability problems. I’ve had really good results on this Pi 1 previously running Raspian and Moonlight so not sure what the problem could be under OSMC, if any.

Any ideas that could help would be appreciated. I realise the Pi1 is underpowered for this kind of thing anyway, but like I mentioned, I did have very good results previously, I just need to figure out if it’s a network or software or even settings issue.

Hey,

I managed to install moonlight-embedded and moonlight-osmc successfully on my OSMC Jessie build. However, nothing happens when I try to start moonlight-osmc from the Kodi add-on. I can start the stream successfully by typing moonlight-osmc in SSH console. The stream quality and FPS seem to be fine.

Any ideas on how I could fix the Kodi add-on? I have setup the IP Address, resolution and FPS, and disabled controllers. I can also see the “moonlight” icon. Nothing just happens when I try to start it up (before I setup the IP Address, it told me that I must set it up).

EDIT:

dpkg -s moonlight-osmc tells me that I have version 0.2.3-1 installed. Is that correct? I installed it using sudo apt-get install -y moonlight-osmc from the http://repo-dodslaser.rhcloud.com/ wheezy main repository.

Try downgrading you Nvidia drivers, specifically the Geforce Experience components.

Sounds weird if that is the issue. I can start Moonlight normally by typing moonlight-osmc in SSH console and I have confirmed it works. It is just the Kodi Add-on that doesn’t work for me.

@Haapavuo Don’t use the deb from my repo. I’ts an old version and I’m taking it down. Use the .deb on the releases page on gh.

Okay, thank you. That helped.

However, it seems I have a huge latency on Raspberry Pi 2 (about 5 seconds) moonlight-embedded / moonlight-osmc. I can see controller input after ~5 seconds later but on PC screen it is instant. Also on my Android tablet I can see no latency at all and all the games are totally playable.

I have tried setting fps to 30 and 60, resolution to 1080 and 720, bitrate limit even to 1 Mbps, Host optimizations on and off. Nothing seems to help, it is always the same ~5 second latency. Anyone else experiencing this? Hints how to fix it?

My RasPi is on WLAN network but so is my Android tablet so that shouldn’t matter. Unless the USB WLAN dongle on RasPi creates the latency just for fun…

@Haapavuo I had that latency problem too. Lowering the resolution did the trick for me. Do you get the same latency if you try without the controller? I’ve seen a lot of posts claiming latency and lag when using a controller. I think it’s a moonlight thing anyway.

My controller is connected to my PC, not to my Raspberry Pi. It is an Xbox One Wireless controller. I have also tried using a wireless mouse that is connected to the Raspberry Pi but it didn’t help. The whole feed is about 5 seconds too late.

I will try to lower the resolution again to see if it helps. However, it’s kinda unfortunate if we can’t play in full hd even though the Raspberry Pi 2 should be fully capable of doing that.

Okay, I rebooted my RasPi 2 and tried to set the 720p resolution again, and it worked. No more latency issues, even with unlimited bitrate.

I still have one more problem: Some games are crashing. For example, Borderlands 2 crashes always when I start loading my save game by pressing Continue in the main menu. This causes a extremely long error message to be shown: http://i.imgur.com/NJ8YWTC.png

Anyone else having this kind of issues? Borderlands 2 works well when streamed to my Android tablet though. I am using Windows 10 on the streaming host.

EDIT: Just updated to GeForce Experience version 2.7.4.10. Borderlands 2 seems to work when I don’t have my controller attached to my PC… But if I have my Xbox One controller attached so that Steam knows it, Borderlands 2 crashes when it loads a save game. This is really weird… I’d love to know what causes this… Is it the controllers wireless audio streaming feature or what…

EDIT2: I have the same behaviour on my Android devices when I use the controller: Borderlands 2 crashes. But when the controller is not attached to my PC, everything works. Moonlight on Android has a wired Xbox One controller driver, and that actually works and Borderlands 2 doesn’t crash. So this seems to be a bug in the GeForce Experience and/or Xbox One Controller Wireless driver. Maybe I should try to connect the Xbox One controller to RasPi instead, with USB cable of course. Is that supported yet?

Hi Guys.

it’s seems to work for me quite well, with previous version of moonlight-osmc I’ve got some issues but the were rather not so important. By modifying **moonlight-osmc.sh **and **moonlight-osmc-watchdog.sh **files I was even able to make my xboxdrv switch from keyboard emulation to xbox360 layout, and get back to keyboard once play was finished.

However with version 0.3.3 I have difficulties with finding the appropriate spot for putting my two scripts: start_kodi.sh and start_steam.sh. They both kill the current xboxdrv driver and load a new one with defined config file.

I take a look into new moonlight-osmc unfortunately nothing ring a bell to me.

The appropriate place would be the systemd unit file (/lib/systemd/system/moonlight-osmc@.service).
Add an ExecStartPre= for the script that switches to xbox360 and then an ExecStopPre= for the script that switches back to keyboard. Start moonlight using sudo systemctl start moonlight-osmc@<HOST IP>.

hi, thanks for the idea.
Unfortunately it doesn’t work for me at all. The end result is that xboxdrv is completely killed. Maybe my scripts are wrong (although they worked with previous version. Can you take a look?

Modified moonlight-osmc@.service

[Unit]
Description = Service for launching moonlight streams in OSMC on Raspberry Pi (1 and 2)
Conflicts = mediacenter.service

[Service]
Type = simple
ExecStartPre = /sbin/modprobe snd_bcm2835
ExecStartPre = /home/osmc/start_steam
ExecStart = /usr/bin/moonlight-osmc %i
ExecStopPost = /sbin/rmmod snd_bcm2835
ExecStopPost = /home/osmc/start_kodi
ExecStopPost = /bin/systemctl restart mediacenter

[Install]
WantedBy = multi-user.target

and one of my scripts. Second one looks almost the same.

#!/bin/bash
sudo pkill xboxdrv
sudo xboxdrv --config /home/osmc/configs/xbox_steam.ini --wid=0 --led=3 --trigger-as-button --dpad-as-button --silent &

First of all you shouldn’t have to use sudo when using systemd.

Secondly, systemd has some quirks when launching scripts:

  1. Use full paths for all binaries not in /bin/ (i.e. pkill and xboxdrv).

  2. Everything is executed as root. If you need to run something as another user (i.e. osmc), use sudo su <user> <path/to/command [args]>

That said, if you’re only running a few commands and don’t need the control flow of e.g. bash or running as a specific user, you should probably put the commands in the unit file using ExecRunPre= and ExecStopPost=.

As for development, I’m keeping myself busy. Mainly GUI stuff right now. Working on dialogs for pairing and mapping input. Lets just say live I/O in python 2.7 is a bit difficult at times and leave it at that.

Implementing a games library in kodi seems feasible (using games list in GFE). I’ll probably work on that after I finish this update and work out the worst bugs.

1 Like

Hi dodslaser,
thanks for the instructions. Unfortunately there’s something wrong and I’m sure this is related with starting xboxdrv.

So I have added this two lines.

ExecStartPre = /usr/bin/pkill xboxdrv
ExecStartPre = /usr/bin/xboxdrv --config /home/osmc/configs/xbox_steam.ini --wid=0 --led=3 --trigger-as-button --dpad-as-button --silent

Killing xboxdrv works properly, but loading new setup simply saying doesn’t work at all.

Is there a way to see logs of what’s happening during running the addon?

I don’t know if this is a directly moonlight/network/gamestream drivers related issue, but since I cannot localize the problem itself, I just wanna try to get some input here.

My Setup:
PC: Intel core 2 quad q6600 @2.4 Ghz, 4gb RAM, GTX 750 Ti, gfe 2.7.4.10, driver 359.00, 1920x1080, 60hz, WIN7 Pro 64bit
Client: RPI 1, oc to high, Raspbian jessie with moonlight-embedded, speedlink torid wireless gamepad
Network: Router is connected through ethernet hub to rp1 (wired)

While everything works fine my games are not as “smooth” (in terms of fps experience) as i expected. E.g when i play PES 2015 while in my pc the game runs smooth (with lower details of course), in my rpi there is a image micro-stuttering (like when you see a ntsc fps 29.97 movie which stutters every now and then). This problem may dissapear for a while (without any reason) and then it appears again. This is happening randomly to all my games

It is like a sudden fps drop/stutter (like when your laptop is getting hot). I can see that to almost any game.

I am using the -30fps -720 command. With Moonlight-osmc same behaviour

The problem remains when:

  1. I lower bitrate from default (5000) to 3000
  2. I run moonlight with 720p/1080p 60 Hz

I can also see that depending on the game, this fps issue is a little worse or better.

Maybe my cpu is outdated or network related problem?

Any thoughts appreciated

@dodslaser & @Makkan Hi! Can you explain the install-steps more detailed? I’m newbie to Linux :pensive:
Thank you!

dodslaser I registered to said you THANKS. this will be big :smile:

Hey guys. I’m working on the next update right now. It’ll be a big one. Most of the code has been rewritten from scratch. I’ve added a GUI for mapping input and pairing (this depends on a PR I sent irtimmer, so update will take some time). I’ve also made input selection a bit more intuitive.

The main issue now is speed and stability. I’m going over the whole thing this weekend to debloat the code and make it a bit more streamlined and structured.