Pi1
From dtype.org
systemd services
autossh.service
[Unit] Description=AutoSSH tunnel service After=network.target [Service] Environment="AUTOSSH_GATETIME=0" ExecStart=/usr/bin/autossh -M 0 -o "ServerAliveInterval 110" -o "ServerAliveCountMax 3" -o ExitOnForwardFailure=yes -N -i /root/.ssh/id_rsa -R "[::]:62222:localhost:22" r@52.45.246.197 Restart=always [Install] WantedBy=multi-user.target
ffmpeg-driveway.service
[Unit] Description=ffmpeg driveway feed After=network.target [Service] User=drew Group=drew ExecStart=/var/www/html/driveway/ffmpeg.sh Restart=always [Install] WantedBy=multi-user.target
ffmpeg-live.service
[Unit] Description=ffmpeg driveway feed live After=network.target [Service] User=drew Group=drew ExecStart=/home/drew/live_stream.sh [Install] WantedBy=multi-user.target
service supporting scripts
/var/www/html/driveway/ffmpeg.sh
#!/bin/bash cd /var/www/html/driveway/ /usr/bin/ffmpeg -loglevel quiet -i rtsp://192.168.42.109:554/CH001.sdp?tcp -timelimit 86400 -c copy -f segment -segment_time 600 -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 "driveway-%Y%m%d-%H%M%S.mp4"
/home/drew/live_stream.sh
#!/bin/bash ffmpeg -i rtsp://192.168.42.109:554/CH001.sdp?tcp -f lavfi -i anullsrc -c:v copy -c:a aac -t 5:00 -f flv rtmp://a.rtmp.youtube.com/live2/YOUTUBEKEY