How To Live Stream To YouTube from a RetroPie

In my last post I showed how you can live stream to Twitch from a RetroPie and in this post I will build off of that and show how you can stream to YouTube.

The basics of this guide are very similar to the Twitch guide so I suggest you give it a read as I will assume that you already know how to do things like ssh into your RetroPie and work with the config files.

First Things First

Before you can stream to YouTube you need to have your RetroPie setup to record gameplace. To do so follow the instructions in this post: How To Record A GamePlay Video From A RetroPie. Once that is working come back and get YouTube streaming working.

YouTube Account and Stream Key

The first step is to get your YouTube live account setup. To do so visit: and click the “Go Live” button at the top right. If you don’t have a YouTube live account you will be prompted to create one.


Then go to your YouTube Live dashboard and scroll to the bottom of the screen. At the bottom of the screen you will see your Encoder Server URL and Stream key:


You will need to press the reveal button to actually get your YouTube Stream key. Keep that around but like your Twitch stream key do not share it with anyone.

Streaming Config File

Now that our account is set up we will need to create an FFmpeg config file for our YouTube streaming. We could share the Twitch file but to make this guide easier we will create a new file, plus I think that their settings will need to be different. SSH into your RetroPie and create your YouTube config file with the following command:

$ nano /home/pi/RetroPie/recording/youtube.cfg


Then paste the following config settings into the file:

vcodec = libx264
acodec = libfdk_aac
pix_fmt = yuv420p
threads = 2
scale_factor = 1
format = flv
video_preset = ultrafast
video_profile = main
video_tune = animation
video_bufsize = 512k
video_minrate = 512k
video_maxrate = 512k
video_r = 60
video_g = 120
video_keyint_min = 60
sample_rate = 44100
audio_preset = aac_he_v2
audio_global_quality = 1


Then save (CTRL+O) and exit nano (CTRL+X).

Note: I’ve noticed that the video quality on YouTube using these settings is a little worse than what I was seeing on Twitch. So they will need to be tweaked a little bit in the future.

Emulator Configuration

Now we need to edit the config file for the emulators that we want to stream. More information on this can be found in my game play stream tutorial. All emulator config files can be found using the following path:


Where $$SYSTEM$$ is the name of the system that you want to configure. For this example we will be adding a YouTube livestream entry to the NES config file. To do so we edit it with the following command:

$ nano /opt/retropie/configs/nes/emulators.cfg

Then we will add a ‘lr-fceumm-record-youtube’ entry that will stream to YouTube:

lr-fceumm-record-youtube = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/ --config /opt/retropie/configs/nes/retroarch.cfg --record rtmp://$$STREAM_KEY$$ --recordconfig /home/pi/RetroPie/recording/youtube.cfg %ROM%"



is the YouTube URL we are streaming to and $$STREAM_KEY$$ is the YouTube stream key we got earlier.


--recordconfig /home/pi/RetroPie/recording/youtube.cfg

tells FFmpeg to use the config file we created earlier.

Then save (CTRL+O) and exit nano (CTRL+X).

Streaming Your GamePlay


Now that we have everything setup we can stream to YouTube by starting a NES game and then pressing the ‘A’ button while the game is loading. This will load the configuration screen, from there select ‘Select emulator for rom’. You will now see the new ‘lr-fceumm-record-youtube’ entry that we added. Select it (it will now be the default so be sure to change it if you don’t want to stream next time you play) and when you launch the game you should now be streaming to YouTube.

That’s it.

You can check out my live YouTube here:

Published by

Mark Mruss

Mark Mruss is a computer programmer by nature and by profession. He's written Android apps, win32 apps (we called them applications back then), apps in python, and even a website or two. He is currently fascinated by all things mobile. He likes computers, beer, and his family (not in that order). Find him on twitter @MarkMruss

14 thoughts on “How To Live Stream To YouTube from a RetroPie”

  1. there is any way to debug the connection? Or maybe some package must be installed? I’m able to recreate your setup but doesn’t connect or work the “record”

    1. Yes, you can check for errors in the runcommand.log file.

      After you try to record, SSH into your pi and then run the following command to see what happened:

      nano /dev/shm/runcommand.log

    1. Hmm which emulator are you trying to connect to YouTube? Maybe share the contents of your emulators.cfg file so that I can take a look at it. Be sure to remove your streamkey when you share it.

  2. Hey,

    I’m using snes, with snes9x2010, I copy my log and config:

    Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2010/ –config /opt/retropie/configs/snes/retroarch.cfg –record rtmp:// –recordconfig /home/pi/RetroPie/recording/youtube.cfg “/home/pi/RetroPie/roms/snes/Super Mario World 2 – Yoshi’s Island (U) (M3) (V1.1).smc” –appendconfig /dev/shm/retroarch.cfg
    PPU.RenderSub = 0
    PPU.FullClipping = 1
    Settings.Transparency = 1
    Settings.SpeedhackGameID = 0
    PPU.SFXSpeedupHack = 0
    coldata_update_screen = 1

    pisnes = “/opt/retropie/emulators/pisnes/snes9x %ROM%”
    snes9x = “/opt/retropie/emulators/snes9x/snes9x %ROM%”
    lr-armsnes = “/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-armsnes/ –config /opt/retropie/configs/snes/retroarch.cfg %ROM%”
    lr-snes9x2005 = “/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2005/ –config /opt/retropie/configs/snes/retroarch.cfg %ROM%”
    lr-snes9x2002 = “/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2002/ –config /opt/retropie/configs/snes/retroarch.cfg %ROM%”
    lr-snes9x2010 = “/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2010/ –config /opt/retropie/configs/snes/retroarch.cfg %ROM%”
    default = “lr-fceumm-record-youtube”
    lr-fceumm-record-youtube = “/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2010/ –config /opt/retropie/configs/snes/retroarch.cfg –record rtmp:// –recordconfig /home/pi/RetroPie/recording/youtube.cfg %ROM%”

        1. No problem, I’m glad you got it to work. I’ve updated the post to make it more clear for future readers. Happy streaming.

  3. Hey pal, from your later streams it looks like you figured out better settings for streaming this to youtube. Any chance you can share that with us?

    Your guides have been a great help, however, I am seeing a pretty low quality output like you mention.

    Thank you!

    1. Also, is there a way to add a camera to your stream if you are doing it this way?

      Not sure what to look for online in terms of guides/tutorials on how to do this since most of them have to do with people streaming themselves from their PCs. Thanks again!

      1. I have tried to figure out how to do this but I could not. It should be possible but I couldn’t figure out a way to pass some of the additional command line arguments that I needed.

    2. Right now my computer is packed away, when I unpack it I will check my latest settings and let you know.

      1. Bummer about not being able to put a camera feed in there and thanks for getting back to me.

        Waiting for your reply. Thank you! 😀

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: