[FFmpeg-user] Is there a way to reconnect to a RTSP stream after it disappears from the network?
Mikhail Morfikov
mmorfikov at gmail.com
Sun Jan 5 16:49:34 EET 2025
There's an IP camera, and I can connect to its RTSP stream using the following
address:
rtsp://user:pass@192.168.1.242:554/stream1
I wanted to save the stream to a file (30s per segment), and the following
command does the job:
$ ffmpeg -loglevel debug -use_wallclock_as_timestamps 1 \
-rtsp_transport tcp -i rtsp://user:pass@192.168.1.242:554/stream1 \
-vcodec copy -acodec copy \
-f segment -segment_format mkv -segment_time 30 -reset_timestamps 1 \
-strftime 1 %Y-%m-%d-%H-%M-%S.mkv
The problem is when the camera device disappears from the network, for instance
it experiences some power outage. When the camera comes back to life, ffmpeg
doesn't stream anymore, it just hang.
So the question is how to reconnect to the stream and do the streaming like
nothing happened?
More information about the ffmpeg-user
mailing list