Friday, February 4, 2022

[SOLVED] How to stream on YouTube using a Raspberry Pi?

Issue

So I'm trying to stream on YouTube using a raspberry pi. The idea is for one raspberry pi to be used to stream the connected webcam and for another to display the stream, sort of like a surveillance camera. Both raspberry pi's are currently using Raspbian.

So is it possible for me to stream directly to YouTube on a Raspberry Pi.


Solution

You can use any Pi supported RTMP/Flash encoder to publish a YouTube live event. One example is ffmpeg which can be compiled on Raspbian.

Create your YouTube live event using the guide. You can find the various encoder settings here.

When everything is ready you can start streaming. For a 640x480@25 700k video stream the command will be something like:

ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -c:v libx264 -b:v 700k -maxrate 700k -bufsize 700k -an -f flv rtmp://<youtube_rtmp_server/<youtube_live_stream_id>


Answered By - aergistal
Answer Checked By - Willingham (WPSolving Volunteer)