54 lines
1.1 KiB
Desktop File
54 lines
1.1 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 \
|
|
-map 0:0 \
|
|
-f segment \
|
|
-segment_time ${SEGMENT_DURATION} \
|
|
-strftime 1 \
|
|
-reset_timestamps 1 \
|
|
-segment_format mp4 \
|
|
${DIR}/${FILENAME_PREFIX}${FILENAME_SEGMENT_PATTERN}.${FILENAME_EXT} \
|
|
'
|
|
|
|
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
|