Skip to content

Instantly share code, notes, and snippets.

@dbirks
Last active September 14, 2016 15:30
Show Gist options
  • Save dbirks/1261b77e306ee4b52e2c to your computer and use it in GitHub Desktop.
Save dbirks/1261b77e306ee4b52e2c to your computer and use it in GitHub Desktop.
Streaming to YouTube from a Raspberry Pi

Streaming to YouTube from a Raspberry Pi

All credit goes to Wolfgang Schlatter for his guide on Google+, which I've only modified slightly.

  • Install Raspbian and download the crosscompiled ffmpeg from Google Drive or Mega.

  • Transfer arm.tar.gz to your Raspberry Pi and untar with tar -xvf arm.tar.gz.

  • Move to the new folder with cd arm/bin.

  • Start the livestream with 720p quality:

raspivid -o - -t 0 -w 1280 -h 720 -fps 25 -b 4000000 -g 50 | ./ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/XXyourIDhereXX

Replace XXyourIDhereXX with your stream name. It will be something like 4myg-24r8-7byg-2oe7.

Adjust the bitrate (-b 4000000) to whatever you like (YouTube wants 1500-4000kbit/s for 720p.)

You can disable the camera led with this: sudo echo "disable_camera_led=1" >> /boot/config.txt

Then reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment