[FFmpeg-user] Dealing with an intermittent rtsp source
Ben Barker
ben at bbarker.co.uk
Mon May 31 10:32:46 EEST 2021
Ah - thanks Enrico - that looks hopeful - using sed to detect no change in
output. I will try to give it a go later.
Andriy - the commit message sounds very plausible. I haven't yet tried to
build using that patch (need to remind myself how to do it - will try
later) but it looks hopeful!
Thanks
Ben
On Mon, May 31, 2021 at 4:39 AM Enrico Purisima <enrico.purisima at gmail.com>
wrote:
> Hello Ben,
>
> I encounter a similar problem regularly and have written a few scripts to
> monitor the progress of the ffmpeg and to kill and restart the ffmpeg
> process if it's hung. There are three files in the zipfile attachment:
> ffmpeg.sh, monitor_stream.sh and stop_ffmpeg.sh. ffmpeg.sh runs your ffmpeg
> command and starts up the monitoring script. You will need to edit the
> files to replace your_login_user and path_to_script with the appropriate
> values. (These were extracted from a larger script I have, so I hope I
> haven't introduced any fatal typos.) I run these on Ubuntu but it should
> work on other Linux distros as well.
>
> Hope this helps.
>
> Enrico
>
>
> On Sun, May 30, 2021 at 1:23 PM Ben Barker <ben at bbarker.co.uk> 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....?
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> >
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-user
mailing list