Streaming to YouTube from a Raspberry Pi

After miles of research we finally found the one-liner it takes to stream one's Raspberry Pi to YouTube.

-Raising Awesome ©2021

FFMPEG is a great command line utility to manipulate audio and video. It can stream as well! After hours of research, we narrowed down to this one liner that will stream the Raspberry Pi's audio and video directly to your YouTube Channel:

ffmpeg -f pulse -i alsa_output.platform-bcm2835_audio.analog-stereo.monitor -f x11grab -framerate 30 -video_size 720x480 -i :0.0 -f flv -b:v 1024K -framerate 30 -s 854x480 rtmp://a.rtmp.youtube.com/live2/streamkey
Your audio parameter may be different. Ours was found with this:
ffmpeg -sources pulse
Be sure to change "streamkey" at the end of the command to your streamkey.

If you aren't familiar with streaming on YouTube, simply go to your channel, click the create icon in the upper right, and choose Go Live. You will get the page where you see you stream key to apply to the command.

This approach requires you to have the Raspberry Pi Desktop - not the lite OS version. We use it to stream a camera that has a Python program displaying the video and doing AI.