/home/pi/live.sh
#!/bin/bash # Rotation # raspivid --nopreview --rotation 180 -o - -t 9999999 -b 3000000 -w 1280 -h 720 | cvlc --ffmpeg-hw -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264 raspivid --nopreview -o - -t 9999999 -b 3000000 -w 1280 -h 720 | cvlc --ffmpeg-hw -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264
/etc/init.d/startcam
#! /bin/sh ### BEGIN INIT INFO # Provides: startcam # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts camera in stream mode # Description: ### END INIT INFO # for ntfs-3g to get correct file name encoding if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG fi do_start() { nohup su pi /home/pi/live.sh & } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Sorry, not implemented." >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: startcam.sh [start]" >&2 exit 3 ;; esac :