Skip to content

Instantly share code, notes, and snippets.

@derrickturk
Created February 23, 2022 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derrickturk/cf19e664f1d0c7ba5eb37380a54f2139 to your computer and use it in GitHub Desktop.
Save derrickturk/cf19e664f1d0c7ba5eb37380a54f2139 to your computer and use it in GitHub Desktop.
stream video from a Raspberry Pi 2, also, bash is hard
#!/usr/bin/env bash
trap "trap - SIGTERM && echo 'shutting down!' && kill -- -$$" SIGINT SIGTERM EXIT
echo "kill me with 'kill $$'"
(nohup raspivid -o - -t 0 -w 800 -h 600 -fps 15 2>/dev/null | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' :demux=h264 --h264-fps=15 >/dev/null 2>&1) &
PID=$!
wait $PID
trap - SIGINT SIGTERM EXIT
wait $PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment