I made an infinite loop in the Bash script to restart streaming.
#!/bin/bash
while true
do
ffmpeg -re -rtsp_transport tcp -i "rtsp://{address:port}/{key}" -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -c:a libmp3lame -ab 128k -ar 44100 -c:v copy -threads 2 -bufsize 512k -f flv "rtmps://{address:port}/live/{key}" &
PID=$!
sleep 12h
kill $PID
sleep 2
done
But sometimes an error occurs... which is displayed in the console in the following form:
rtsp://{address:port}/{key}: Invalid date found when processing input
And this time the stream does not work. How to supplement my script, which would track after running the command output in the console and when the error Invalid date found when processing input will end the process and immediately restart the stream?