h264-vsrv/bin/h264-retranslate

21 lines
487 B
Plaintext
Raw Normal View History

2024-04-19 14:19:18 +03:00
#!/bin/bash
LOCAL_IP="$(cat $(readlink -f $(dirname $(dirname $0)))/.ipaddr)"
/usr/bin/ffmpeg -v quiet -rtbufsize 100m -listen 1 \
-f flv -i "rtmp://${LOCAL_IP}:$1/live/mystream" \
-an -c:v copy -preset ultrafast -tune zerolatency \
-f rtsp "rtsp://${LOCAL_IP}/$1" &
while true; do
FAIL=0
/usr/bin/ffprobe -v quiet "rtsp://${LOCAL_IP}/$1" || FAIL=1
if [[ $FAIL -eq 0 ]]; then
/usr/bin/systemd-notify WATCHDOG=1
fi
sleep $(( $WATCHDOG_USEC / 2 / 1000000 ))
done