62 lines
1.7 KiB
Desktop File
62 lines
1.7 KiB
Desktop File
[Unit]
|
|
Description=Webcam Streamer service
|
|
Requires=network-online.target
|
|
After=network-online.target
|
|
DefaultDependencies=no
|
|
|
|
[Service]
|
|
Type=simple
|
|
|
|
User=pi
|
|
Group=pi
|
|
|
|
Environment="HOME=/home/pi"
|
|
EnvironmentFile=/etc/default/webcam-streamer
|
|
|
|
WorkingDirectory=/home/pi
|
|
|
|
ExecStartPre=-/usr/bin/env sh -c 'killall rpicam-vid 2>/dev/null || true'
|
|
ExecStartPre=-/usr/bin/env sh -c 'mkdir -p $DIR'
|
|
|
|
ExecStart=/bin/bash -c 'rpicam-vid --inline \
|
|
-t 0 \
|
|
--width ${RES_WIDTH} \
|
|
--height ${RES_HEIGHT} \
|
|
--nopreview \
|
|
--awb auto \
|
|
--denoise auto \
|
|
--rotation 0 \
|
|
--autofocus-mode auto \
|
|
--codec h264 \
|
|
-b ${BITRATE} \
|
|
-o - | \
|
|
ffmpeg -hide_banner \
|
|
-thread_queue_size 1024 \
|
|
-i pipe:0 \
|
|
-c:v copy \
|
|
-f tee -map 0:0 -flags +global_header -flvflags no_duration_filesize \
|
|
"[f=segment \
|
|
:segment_format=mp4 \
|
|
:segment_time=${SEGMENT_DURATION} \
|
|
:reset_timestamps=1 \
|
|
:strftime=1 \
|
|
:onfail=ignore \
|
|
]${DIR}/${FILENAME_PREFIX}${FILENAME_SEGMENT_PATTERN}.${FILENAME_EXT} \
|
|
| \
|
|
[f=fifo \
|
|
:fifo_format=flv \
|
|
:drop_pkts_on_overflow=1 \
|
|
:attempt_recovery=1 \
|
|
:recovery_wait_time=1 \
|
|
:use_wallclock_as_timestamps=1 \
|
|
]${PEERTUBE_LIVE}${LIVE_KEY}"'
|
|
|
|
ExecStop=-/usr/bin/env sh -c 'killall rpicam-vid 2>/dev/null || true'
|
|
|
|
Restart=always
|
|
RestartSec=3
|
|
SyslogIdentifier=webcam-streamer
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|