Created
February 10, 2018 19:28
-
-
Save daveio/dba13df7ee520939d3795e936944c3f6 to your computer and use it in GitHub Desktop.
Stream from the Raspberry Pi Camera to YouTube Live
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stream from the Pi camera to YouTube Live. | |
# Uses information from https://www.makeuseof.com/tag/live-stream-youtube-raspberry-pi/ | |
# Modified to use v4l2 directly (lower cpu, lower latency, higher frame rate, basically More Better) | |
# Setup: standard Pi Camera setup, then sudo apt-get install libav-tools | |
# You may need to modify the horizontal and vertical flip options to suit your mount. | |
# Usage: youtube.sh YOUTUBE-SECRET-KEY | |
sudo modprobe bcm2835-v4l2 | |
sudo v4l2-ctl -c rotate=0,video_bitrate=1000000,horizontal_flip=1,vertical_flip=1 | |
sudo v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=4 | |
sudo v4l2-ctl -p 30 | |
avconv -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -thread_queue_size 512 -f h264 -r 30 -i /dev/video0 -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv -r 30 rtmp://a.rtmp.youtube.com/live2/$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I was looking for. Thank you 😄