[FFmpeg-user] Dealing with an intermittent rtsp source
Enrico Purisima
enrico.purisima at gmail.com
Mon May 31 05:43:49 EEST 2021
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".
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: monitor_ffmpeg.zip
Type: application/zip
Size: 2308 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210530/654ad2e5/attachment.zip>
More information about the ffmpeg-user
mailing list