YouTube Streaming from a Raspberry Pi
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/youtube-live.jpg)
its dead easy to stream to you tube. You could use OBS (find out how here) or use this method, which runs on a raspberry pi with an attached camera , it uses a few lines of code typed into a raspberry pi terminal.
raspivid -o – -t 0 -vf -hf -fps 30 -b 600000 | ffmpeg -i pipe: -f alsa -ac 1 -i plughw:1,0 -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/XXXX-your youtube code here-XXXX
to get your streaming key ( the “XXXX-your youtube code here-XXXX” bit of the code) go to Youtube and join up. then click on the camera iscon the go live
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/youtubecameras.jpg)
You need to sign up for streaming 24 hours before you use it (handy to know if you’re running a workshop on streaming)
the streaming key is in your streaming settings
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/stream-key-1024x747.jpg)
theres a few ducks to get in a row before you can start streaming
Set up your raspberry pi, follow the instructions here
Attach the camera to your raspberry pi. follow the instructions here
Choose the camera from the preferences, or by the raspi-config
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/raspberri_pi_configuration-3.png)
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/raspberry_pi_enable_camera-3.png)
or in a terminal window type, sudo raspi-config , and choose the legacy camera from the menu
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/ras1-1024x677.jpg)
![](https://matthewolden.co.uk/wp-content/uploads/2024/07/rasp2-1024x657.jpg)
The raspberry pi camera support is legacy ware, but still works, you might have to download ffmpeg to get it working. Type this into a terminal window to install it
sudo apt-get install ffmpeg
Check to see if your camera is working type in a terminal
vcgencmd get_camera