[FFmpeg-user] Can I set a "wait-timeout" for ffmpeg to not abort a stream download?

Adam Nielsen a.nielsen at shikadi.net
Mon Nov 15 12:18:53 EET 2021


> Here you go (even though I was asking for the existence of an ffmpeg argument to
> tell it to wait out the set -t time rather than aborting if there is a pause in
> the stream).
> Actual URL domains obfuscated.
> 
> ffmpeg -hide_banner -referer "https://wwwwwwwww.com/yyyy.html" -i
> "https://xxxxxxxx.org/2fwljiCVp2jdxA63hnS-ng==,1636958338/LS-ATL-54548-10/index.m3u8"

Assuming the issue is that the TCP connection is terminated (due to a
timeout, server disconnect, etc.) there won't be an ffmpeg option for
this.

Having ffmpeg wait until more data arrives is not applicable to a
disconnected TCP connection, because it's like calling someone on the
phone and they hang up.  No matter how long you wait with the phone
against your ear they will never just start speaking again, one of you
has to make another call to get reconnected.

Same thing here - ffmpeg exits when the "call" hangs up, because
waiting would serve no point - the TCP connection has already been
terminated, so no data will ever pass again across that connection, so
there's nothing to wait for.

Your best bet is probably going to be scripting it, so that when it
terminates, the script runs ffmpeg again to re-establish a new
connection to the server.

You may also want to investigate why the connections are getting
dropped, however depending on how important the streaming is, even a
perfect system will occasionally drop TCP connections so being able to
handle that happening will make your set up much more robust.

Cheers,
Adam.


More information about the ffmpeg-user mailing list