Raspberry Pi Nvidia Shield: Stream Games using Moonlight

In this tutorial, I will be setting up Raspberry Pi Nvidia Shield streaming so you can stream PC games from your computer straight to the Pi.

Raspberry Pi Nvidia Shield


This project is an awesome way to get games to another screen or TV in your house without spending a huge amount of money on extra equipment.

This tutorial is perfect for anyone who loves video games, but something like the Raspberry Pi retro game emulator is a little too old school for you.

With this, you will be able to play most modern games, but you will also need to have a computer that is powerful enough to run them.  You can also now set up your Raspberry Pi to act as a Steam Link using one line of code.

One of the most significant downsides to this tutorial is that you will need a Nvidia graphics card in your computer. Unfortunately, there isn’t an AMD equivalent of doing the same thing at the time of when I wrote this tutorial.

In this tutorial, we will be using a software package called Moonlight on the Pi. This software will connect to the Nvidia Geforce Experience app running on a PC. You will then be able to stream most games that are available to the Pi.

Equipment

You will need the following equipment for this Raspberry Pi Nvidia Shield tutorial. Keep in mind you will probably want to avoid using WiFi and use Ethernet for the best performance.

Recommended

Optional

Video

If you want to see how to get this up and running, then be sure to check out the video below.

It goes through all the steps to getting this cool Raspberry Pi tutorial up and running.

Setting up Raspberry Pi Moonlight Software

As with the majority of the tutorials on this website, you will need to make sure you have Raspbian installed. If you don’t and have no idea where to start, then you can find my handy guide to installing Raspbian here. We recommend that you use Raspbian Stretch for this tutorial.

1. To begin, you will need to either SSH or be in the terminal on your Pi.

2. In here we need to add the moonlight repository to our package source list. To do this simply enter the following. The | will copy the result of the first command into the second.

echo "deb [signed-by=/usr/share/keyrings/moonlight-archive-keyring.gpg] https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-embedded/deb/raspbian buster main" | sudo tee /etc/apt/sources.list.d/moonlight.list

3. You need to fetch and install the GPG key so you will not receive warnings about the public key not being available.

curl https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-embedded/gpg.5AEE46706CF0453E.key | gpg --dearmor | sudo tee /usr/share/keyrings/moonlight-archive-keyring.gpg >/dev/null

4. Next, you will need to update the package list by simply running the following command.

sudo apt-get update

5. Now install the package by running the following command.

sudo apt-get install moonlight-embedded

That’s all you need to do, and now we’re ready to connect the Pi up to a PC. This process is super easy, and I’ll go through the steps below.

Connect your Pi to the PC

To begin, you will need to make sure you have a Nvidia GeForce graphics card. Secondly, you will need to make sure you have the GeForce experience app installed.  If you don’t have Geforce experience application installed, then you download it at the Geforce website.

1. To begin, make sure you know the IP address of the gaming PC you want to connect to.

To do this, go to CMD (command prompt) on Windows. This application can be found by simply searching for it.

ip-config

2. In here run the command ipconfig.

Write down or copy the IP in the field next to IPv4 Address.

3. On the Pi enter the following to pair with the gaming PC running the GeForce experience. Replacing 192.168.1.105 with your own IP address.

moonlight pair 192.168.1.105
Raspberry Pi Nvidia Shield Code

4. This command will generate a 4-digit pin that you will need to enter on your computer in the pop up saying “SHIELD is requesting to connect.”

Nvidia Shield Code

5. It’s all good to go now, to begin streaming simply enter the following. (Replacing the 192.168.1.105 with own IP)

moonlight stream 192.168.1.105

6. There are additional configuration options that you might be interested in taking a look at. I will go through them below.

Extra Configuration Options

To help improve the performance of the Raspberry Pi Nvidia shield streaming you can tinker with some settings. When you go to launch moonlight streaming on the Pi, there are several additional options, which you’re able to add to the command line. If you want to add options, they go after stream. For example: moonlight stream [OPTIONS] x.x.x.x

Below is a list of almost all the options that you’re able to add.

-720 Use 1280x720 resolution (default)

-1080 Use 1920x1080 resolution

-width <width> Horizontal resolution (default 1280)

-height <height> Vertical resolution (default 720)

-30fps Use 30fps

-60fps Use 60fps (default)

-bitrate <bitrate> Specify the bit-rate in Kbps

-packetsize <size> Specify the maximum packet size in bytes

-app <app> Name of app to stream

-nosops Don't allow GFE to modify game settings

-localaudio Play audio locally

-keydir <directory>\tLoad encryption keys from directory

As you can see, there are quite a few options to pick from. You will probably find the FPS and resolution are the two you will find handy the most.

Change these if you’re finding stream issues such as lagging etc. Reducing these will help lower the amount of data that needs to be sent over the network.

For example, if you had 30 FPS and a 720 resolution, it would look something like this.

moonlight stream -30fps -720 x.x.x.x

If you want to have it launch an app like steam by default, then you do something like this.

moonlight stream -app steam x.x.x.x

These are just a couple of examples of what you can do. There are also other additional options that you’re able to add. The full list can be found on Moonlights wiki page.

Troubleshooting & Limitations

I have found that some games didn’t work at all. I am not entirely sure why this is the case, but I think it could be something to do with the multiple monitors causing issues. Doom, for example, will run fine on the PC but won’t stream to the Pi for some odd reason.

Games vary in quality, for example, games like ARMA I found quite a significant difference between the host PC and the Pi but games like Ori & the blind forest I didn’t notice too much difference between the two.

As I mentioned above, you can tinker with settings to try and get the best quality without any lag. Below is a short clip of some of the games I tested with the PC version on the left and the streamed version of the right.

Adblock removing the video? Subscribe to premium for no-ads.

I sometimes found Moonlight would crash, but this was only between changing games and wasn’t so common for it to become annoying (I was also changing games quite often to test things out).

You can simply relaunch the stream with one simple command in the terminal so crashes aren’t too bad to recover from. (As long as it’s not mid game).

If you have would like to see a list of issues that are currently known, then be sure to head over to the moonlight-embedded GitHub page. This page will have a list of open and closed problems with the software.

I hope this Raspberry Pi Nvidia Shield streaming tutorial has helped you be able to stream video games to the Pi. If you come across any issues or have some feedback related to this tutorial, then please don’t hesitate to leave a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

12 Comments

  1. Avatar for mat
    mat on

    is there a way to connect the xbox one wireless controller to the pi? i dont have the bluetooth controller that is out there but i do have the dongle for the controller.

  2. Avatar for Darryl
    Darryl on

    Hi Gus. At the point of running everything, I keep getting this same error, regardless how I try to start the stream (with defaults or using my own specific resolutions etc). Do you know what it is? Seems a common issue without a solution that I can find.

    I think that the “Failed to open device /dev/input/event0” is controller related, but that is an issue for another time. The last line “Starting video stream…* failed to open vchiq instance” is what worries me. My gaming PC fires up steam in big picture, but the Pi just stays in the prompt. Any ideas?

    darryl@raspberrypi:~ $ moonlight stream -1080 192.168.0.16
    Connect to 192.168.0.16...
    Failed to open device /dev/input/event0
    Initializing platform...done
    Resolving host name...done
    Starting RTSP handshake...done
    Initializing control stream...done
    Initializing video stream...done
    Initializing audio stream...done
    Initializing input stream...done
    Starting control stream...done
    Starting video stream...* failed to open vchiq instance

  3. Avatar for Iwo
    Iwo on

    I cant get it working whenever I put in moonlight pair my ip it tells me command not found.

    1. Avatar for Darryl
      Darryl on

      You did install moonlight-embedded correctly? It would only do that if it wasn’t installed correctly. Well to my knowledge anyway.

  4. Avatar for ralf
    ralf on

    Its SSH not SHH 🙂

    1. Avatar for Gus
      Gus on
      Editor

      Thanks for noticing that! 🙂 Fixed.

  5. Avatar for gtj
    gtj on

    Gus,

    Do you believe there’ll be any performance difference between RPi2 and RPi3?

    1. Avatar for Gus
      Gus on
      Editor

      I don’t think there would be any huge differences between the two. However with that said I haven’t tested it.

  6. Avatar for Matt
    Matt on

    Can the NVIDIA Geforce 210 be used instead of the NVIDIA Geforce GTX 1080? Because that is the best graphics card I have for now.

    1. Avatar for Joao
      Joao on

      You need a powerfull gpu to be able to play games, I don’t think that gpu can play anything, but if it can, it should be able to stream it aswell.

  7. Avatar for João Patrocínio
    João Patrocínio on

    Is there any streaming software like this for AMD graphics cards?

    1. Avatar for Gus
      Gus on
      Editor

      No not at the moment unfortunately. I am keeping an eye out for an alternative and will update this tutorial if something ever pops up.