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: