Tutorial  Updated

Installing Moonlight-QT on L4T Ubuntu

GuideOptional


  1. Before continuing forth, know that now you can use moonlight-qt on the latest Ubuntu L4T 3.0.0, you should DEFINITELY check it out, since it uses HARDWARE ACCELERATION meaning it's lightyears faster than embedded, that can't work with it now due to lack of support.

    If you had followed this guide before, uninstall the old package by doing 'sudo apt remove moonlight'.

    Here's how get moonlight-qt, also, definitely check the optional tab later, contains some quality of life that you should see:

    • First you need to download and flash UL4T 3.0.0, and boot it, after that you're going to run the following commands to install Moonlight Qt to your UL4T:
    Code:
    curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-l4t/setup.deb.sh' | sudo -E bash
    • And finally install your moonlight:
    Code:
    sudo apt install moonlight-qt
    • You can then launch Moonlight from your desktop or via the moonlight-qt command in the terminal.
    • To update Moonlight Qt after you've installed it, run:
    Code:
    sudo apt update
    sudo apt upgrade


    And have fun with hw accelerated moonlight-qt!! Updated the repo on the guide for the new official release.
    You can also refer to the official wiki on how to install: https://github.com/moonlight-stream...ling-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu

  2. This one by FeranthurReturn can improve QoL by a lot, specially when away from dock and keyboard.

    • You'll need to install xorg joystick:
    Code:
    sudo apt install xserver-xorg-input-joystick

    • Download the config file and move to usr/share/X11/xorg.conf.d
    Code:
    wget https://cdn.discordapp.com/attachments/604648722491768883/684926248505704484/50-joystick.conf && sudo mv 50-joystick.conf /usr/share/X11/xorg.conf.d

    • Reboot or log-out and log back in.

    These are the default mappings, you can change them by editing 50-joystick.conf:
    ButtonsMappings and key code
    ARight Mouse Button(button=3)
    BLeft Mouse Button(button=1)
    L and RVolume up(key=123) and Volume down(key=122)
    ZL and ZRBrightness up(key=233) and Brightness down(key=232)
    ScreenshotEnables/Disable mouse mode (when you want to play games)
    HomeEsc(Key=9)
    Plus (+)Enter(key=36)
    Minus (-)Back(key=22)


    If you want to edit, these are the joycon's button codes:
    ButtonButton Codes
    BMapButton 5
    AMapButton 6
    XMapButton 7
    YMapButton 8
    ScreenshotMapButton 9
    LMapButton 10
    RMapButton 11
    ZLMapButton 12
    ZRMapButton 13
    Minus (-)MapButton 14
    Plus (+)MapButton 15
    HomeMapButton 16
    LStickMapButton 17
    RStickMapButton 18


    After editing save and reboot/relog.
    This one is a nice indicator that will stay on your taskbar's tray, you can use it to change CPU frequency on the go, for moonlight 1.02GHz is perfectly fine.

    • Just install it and reboot:
    Code:
    sudo apt install indicator-cpufreq

    • Change frequency by right clicking it's icon.


Any errors or tips? Point them.
Build this only if you have a specific goal in mind, end users AVOID, use moonlight-qt because this one doesn't have hwdecoding, won't be fast.

Now, this is how i made moonlight-embedded work with l4t, no magic, basic compiling and running.

Preparing.
  • First do the good old update, before that you have to apply the 1.1 update available on the ubuntu lt4 thread!
Code:
sudo apt-get update

  • Then install the dependencies, some of them will already be installed on Ubuntu L4T but run it either way (some aren't), if other distro pops out without them here's how you get them:
Code:
sudo apt-get install libopus0 libexpat1 libasound2 libudev1 libavahi-client3 libcurl3 libevdev2 libenet7 -y && sudo apt-get install libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev libexpat1-dev libpulse-dev uuid-dev libenet-dev cmake gcc g++ fakeroot debhelper libavcodec-dev libsdl2-dev -y

Now for the actual cloning and compiling part (fun begins).
  • Clone the repository with this command:
Code:
git clone https://github.com/irtimmer/moonlight-embedded.git

  • Then compile it following this:
Code:
cd moonlight-embedded
git submodule update --init
mkdir build
cd build/
cmake ../
make
sudo make install
sudo ldconfig

Restart and you should be ready (fun deepens).
  • Here a basic connection setup:
Code:
moonlight pair <pc local ip>
moonlight stream <pc local ip>

That's it! Works somewhat well with my router: TP-Link C3200.

But now we have to config our Joy-Cons to work with moonlight, since it cant detect and map it accordingly.
  • Got ya covered, to do that you have to just:
Code:
sudo gedit /usr/local/share/moonlight/gamecontrollerdb.txt

  • Scroll to the end and add this line if you want ninty's layout:
Code:
050000007e0500000620000001000000,Nintendo Switch Joy-Cons,a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,

  • If you want M$'s layout (invert a and b, x and y):
Code:
050000007e0500000620000001000000,Nintendo Switch Joy-Cons,a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,

Look up for the moonlight command to see the available variables for you to tweak your connection (bitrate, resolution, input device and etc.).

Any errors or things i should add, point them :).
 
Last edited by ZeroFX,

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
I have an official Nintendo Wii USB Ethernet Adapter. Works fine on Horizon with my otg usb c Kabel.
But on Ubuntu it gets only detected in docked mode and the Kernel module for the ax8872 chipset is missing.
So I need to recompile the kernel just to test if moonlight works better. But idk how.
Yeah, USB without dock only in a next update it seems.
 

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
How well is this working? Confused as op says works wonders but then someone else posted that games are unplayable?
Well it does work well for slow paced games at least with my setup, just don't try to play darksouls with it, at least yet.

--------------------- MERGED ---------------------------

@knopex well I didn't mentioned this but, nothing stops Ubuntu aarch64 from running moonlight-qt, I tried installing using flatpak: it installed, opened, paired and connected... But libgl errors, I'll try compiling myself later and do some troubleshooting, when I have the time.
 
Last edited by ZeroFX,
  • Like
Reactions: knopex

rob151515

Member
Newcomer
Joined
May 6, 2019
Messages
8
Trophies
0
Age
37
XP
112
Country
Albania
Well it does work well for slow paced games at least with my setup, just don't try to play darksouls with it, at least yet.

Thanks. Is 720p 60fps achievable? I have moonlight working perfectly on other devices at 1080p 60fps but the switch seems like the perfect form factor for it...
 

stevielememe

New Member
Newbie
Joined
Dec 3, 2018
Messages
1
Trophies
0
Age
27
XP
44
Country
United States
Just wanted to say thanks for all the information y'all! I got moonlight embedded installed, the controllers seeming to work, and it's connecting to my computer, but I'm getting the RTSP handshake timeout after 10 seconds. A lot of progress though! Still trying to figure out how to fix it. I know all the ports are forwarded correctly on my host machine and I believe on my switch too.

I get RTSP handshake failed every time a steam game is already open, or i leave big picture opened. Weird, RTSP handshake is usually related to UDP so its an error that i usually see when remote playing out of home.

Tried this but with no luck. I'm so close XD Everything runs just don't get any video output on the switch right now.
 

rob151515

Member
Newcomer
Joined
May 6, 2019
Messages
8
Trophies
0
Age
37
XP
112
Country
Albania
Thanks. Is 720p 60fps achievable? I have moonlight working perfectly on other devices at 1080p 60fps but the switch seems like the perfect form factor for it...

To answer my own question, it doesn't seem possible (at the moment) but it still is a nice start.

Tried it last night and the ops instructions worked perfectly but unfortunately for me, the stream is very choppy. As I said earlier, I have perfect 1080p 60fps streaming on other devices so I know it is not my setup.

CPU usage while streaming on the Switch was very high so I would guess that it's not utilising the GPU when decoding the stream but I could be wrong...

Looking forward to seeing where this goes!
 

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
Well now, the issue is indeed with hardware acceleration and guess what!? Well, sit there.
Aarch64, or arm64, has its qt5 builds so I thought building moonlight-qt would be better some some reason and well I'm wrong, moonlight-qt makes use of libvdpau that, I discovered later, in the Ubuntu l4t (in a comment by @bylaws) that nvidia doesn't support it for tegra, and indeed won't because after compiling I got these errors:
Code:
00:00:01 - SDL Error (0): Failed to initialize VAAPI: -1
00:00:01 - FFmpeg: [AVHWDeviceContext @ 0x5576b64420] VDPAU device creation on X11 display :1 failed.
00:00:01 - SDL Error (0): Failed to create VDPAU context: -1313558101
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/aarch64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
libva error: /usr/lib/aarch64-linux-gnu/dri/nvidia_drv_video.so init failed
libva info: va_openDriver() returns -1
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
After compiled the program worked, I could pair, connect, etc but black screen.
After doing my research I saw that well, raspberry pi and odroid doesn't have vdpau either, so I wonder what Moonlight-embedded uses for hardware acceleration on these devices, or it's the same laggy mess as when running on switch? Well looks like rpi now makes use of MMAL, can we? No, it's broadcom exclusive, odroid has some custom forks with openmax, THAT we can use, if someone is willing to implement with the data available on the internet:

https://www.google.com.br/search?q=...9i57.2232j0j4&sourceid=chrome-mobile&ie=UTF-8

I have University and exams soon™ :P. But I'll keep on looking, not promising that I'll be the one that will make this thing works well, probably won't :/.
 
Last edited by ZeroFX,

Beckershoff

Member
Newcomer
Joined
Aug 2, 2018
Messages
8
Trophies
0
Age
43
XP
482
Country
Netherlands
Brilliant tutorial and work so far @ZeroFX ! Managed to have Moonlight working nicely on my Switch. Currently rocking it under 720p@30fps with 5000kbps. This is in my case the most solid. Hopefully somebody continues your work and is able to get hardware decoding to work!

B.t.w. for anybody interested: for me the easiest was to create a desktop shortcut:

1. Nano ~/Desktop/WindowsDesktop.desktop
2. Enter following text:
Code:
[Desktop Entry]
Name=Windows Desktop
Exec=moonlight stream <IP ADDRESS OF HOST> -app <NAME OF APP> -720 -fps 30 -bitrate 5000 -codec h264
Terminal=true
Type=Application

EXAMPLE:
Code:
[Desktop Entry]
Name=Windows Desktop
Exec=moonlight stream 192.168.1.93 -app Desktop -720 -fps 30 -bitrate 5000 -codec h264
Terminal=true
Type=Application
3. press CRTL+X and Y to store it
4. Success, shortcut is stored on desktop (PS make sure you provided your host machine with a static IP on your router ;-))

PS to exit a session you can press +,-, L, R simultanously. The session is however not quit on the host, for this to happen you need to add '-quitappafter' to the 'Exec' line in the example above.
 
Last edited by Beckershoff,

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
Brilliant tutorial and work so far @ZeroFX ! Managed to have Moonlight working nicely on my Switch. Currently rocking it under 720p@30fps with 5000kbps. This is in my case the most solid. Hopefully somebody continues your work and is able to get hardware decoding to work!

B.t.w. for anybody interested: for me the easiest was to create a desktop shortcut:

1. Nano ~/Desktop/WindowsDesktop.desktop
2. Enter following text:
Code:
[Desktop Entry]
Name=Windows Desktop
Exec=moonlight stream <IP ADDRESS OF HOST> -app <NAME OF APP> -720 -fps 30 -bitrate 5000 -codec h264
Terminal=true
Type=Application

EXAMPLE:
Code:
[Desktop Entry]
Name=Windows Desktop
Exec=moonlight stream 192.168.1.93 -app Desktop -720 -fps 30 -bitrate 5000 -codec h264
Terminal=true
Type=Application
3. press CRTL+X and Y to store it
4. Success, shortcut is stored on desktop (PS make sure you provided your host machine with a static IP on your router ;-))

PS to exit a session you can press +,-, L, R simultanously. The session is however not quit on the host, for this to happen you need to add '-quitappafter' to the 'Exec' line in the example above.
Really awesome exec, and thanks.
 

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
Folks, moonlight-qt is now possible, it adds hwdecoder support that makes it really fast and usable, you have to install the custom build by gavin_darkglider.

OP updated with instructions.
 
  • Like
Reactions: A3660537JPN

Matt3o

New Member
Newbie
Joined
Oct 22, 2014
Messages
3
Trophies
0
XP
63
Country
Italy
Thanks for the guide, everything is working perfectly, is there a way to map the joycons with Nintendo's layout in this new version of moonlight? I have tried the instructions in the OP but they don't seem to work, the moonlight folder under '/usr/local/share' wasn't there, and even after manually creating it and placing the gamecontrollerdb.txt with your config inside the layout is still inverted. Thanks
 
  • Like
Reactions: falcorr and ZeroFX

ZeroFX

why?
OP
Member
Joined
Jun 18, 2018
Messages
1,098
Trophies
1
Location
napaJ
XP
2,974
Country
Japan
works way better on android
Captain obvious huh? Except Oreo is very deprecated comparing to ubuntu, doesnt support railed joy-cons, proper sleep mode and etc.

It is better with moonlight, but im showing options here, so stay ontopic if youre going to reply.

Thanks for the guide, everything is working perfectly, is there a way to map the joycons with Nintendo's layout in this new version of moonlight? I have tried the instructions in the OP but they don't seem to work, the moonlight folder under '/usr/local/share' wasn't there, and even after manually creating it and placing the gamecontrollerdb.txt with your config inside the layout is still inverted. Thanks

i believe if you edit usr/share/X11/xorg.conf.d/50-joystick.conf you can change that, moonlight-qt doesnt use the config moonlight embedded use.
 

Gavin_Darkglider

Well-Known Member
Member
Joined
May 20, 2019
Messages
232
Trophies
0
Age
34
XP
581
Country
United States
First to clarify, moonlight qt fixes for Jetson nano/switch are not my custom build, but from cgutmans, the head moonlight dev. And according to him the Jetson nano/switch are the best preforming arm boards where moonlight-qt is concerned. Android is completely different api, and uses omx for decoding.
 
  • Like
Reactions: ZeroFX

falcorr

Well-Known Member
Member
Joined
Sep 26, 2019
Messages
139
Trophies
0
XP
746
Country
Australia
Captain obvious huh? Except Oreo is very deprecated comparing to ubuntu, doesnt support railed joy-cons, proper sleep mode and etc.

It is better with moonlight, but im showing options here, so stay ontopic if youre going to reply.



i believe if you edit usr/share/X11/xorg.conf.d/50-joystick.conf you can change that, moonlight-qt doesnt use the config moonlight embedded use.

This config file appears to work. How would I go about swapping the buttons? (i.e. A <> B, X <> Y) I haven't had luck with that through this file or jscal.
 

famf

New Member
Newbie
Joined
Apr 13, 2020
Messages
2
Trophies
0
Age
33
XP
49
Country
United States
Whenever I start a game with moonlight-qt all I get is a black screen. I can hear game audio though. Any ideas?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: It's mostly the ones that are just pictures and no instructions at all