[FFmpeg-user] Dealing with an intermittent rtsp source

Andriy Gelman andriy.gelman at gmail.com
Mon May 31 04:45:55 EEST 2021


On Sun, 30. May 18:15, Ben Barker wrote:
> If I use ffmpeg to join an rtsp stream:
> 
> ffmpeg -i rtsp://<some_address> -vcodec copy -an -f mp4 <output>
> 
> This works fine. However, if the rtsp source becomes unavailable briefly -
> for instance perhaps the network goes down, or the source is restarted,
> then ffmpeg hangs on:
> 
> frame=xxx fps= 25 q=-1.0 q=-1.0 size=  211103kB time=.....
> 
> The frame counter does not increment - which is a sign that the stream has
> hung - but I can't seem to programmatically detect that - so ffmpeg remains
> running, but does not reconnect to the stream
> 
> I have tried various timeouts to handle this - without success so far. Is
> there an obvious solution to this I am missing? If the source is not
> present when ffmpeg is started, it will fail and I can handle that. But if
> it fails once the stream has been joined, I seem to end up stuck....?

Could you test on master, and post the trace log, pls? 

Can you also try this patch:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210530202410.202575-1-andriy.gelman@gmail.com/
It should allow you to use -timeout option with rtsp.

-- 
Andriy


More information about the ffmpeg-user mailing list