There are two commands involved in live streaming: raspivid and ffmpeg. The streams are 720p 25fps 44kb stereo audio, streams are silent for the first 6 seconds

raspivid --timeout 0 --width 1280 --height 720 --rotation 270 --profile high --level 4.1 --bitrate 2250000 --framerate 25.375 --intra 90 --annotate 4 --annotate 8 --output - | ffmpeg -i - -f alsa -channels 2 -sample_rate 22050 -itsoffset 6 -i hw:1 -c:v copy -af "volume=8.0,aresample=async=1" -c:a aac -b:a 48k -map 0:v -map 1:a  -f flv rtmp://URL and KEY go here

YouTube rtmp:// segment, located in youtube.sh

rtmp://a.rtmp.youtube.com/live2/KEY goes here

Add YouTube streaming as an option by editing piglasscmds.toml.

["YouTube Stream"]
color = "orange"
cmd = "sh youtube.sh"
process = "raspivid ffmpeg"

Facebook rtmps:// segment, located in facebook.sh:

rtmps://live-api-s.facebook.com:443/rtmp/Key goes here

Add Facebook streaming as an option by editing piglasscmds.toml:

["Facebook Stream"]
color = "orange"
cmd = "sh facebook.sh"
process = "raspivid ffmpeg"

Twitch rtmp:// segment, located in twitch.sh:

rtmp://live.twitch.tv/app/Key goes here

Add Twitch streaming as an option by editing piglasscmds.toml:

["Twitch Stream"]
color = "orange"
cmd = "sh twitch.sh"
process = "raspivid ffmpeg"

I also setup my own rtmp server and page to view the stream using a VPS.

This part sets up the streaming to the server: Nginx RTMP Streaming setup.

This part is used to make a page that your stream can be viewed from Dash JS.

This guide was first published on Apr 05, 2022. It was last updated on Mar 29, 2022.

This page (Live Streaming) was last updated on Mar 29, 2022.

Text editor powered by tinymce.