[FFmpeg-user] Can ffmpeg be set to wait if a stream stop happens?

Bo Berglund bo.berglund at gmail.com
Wed Apr 21 17:59:10 EEST 2021

I am downloading video using this command in a script (on Ubuntu Linux):

"ffmpeg -user_agent \"Mozilla\" -i $VIDEOURL -threads 1 -vf scale=w=-4:h=360
-c:v libx264 -preset fast -crf 26 -c:a copy -t $CAPTURETIME $TARGETFILE"

The arguments $VIDEOURL, $CAPTURETIM and $TARGETFILE are set on call of the
script. The calls come from at jobs to make it unattended.
In principle it works OK.

But what I have noticed lately is that sometimes the stream it downloads from
stops feeding data for a few seconds (don't know for how long) and it seems like
ffmpeg at that times finishes up the output file and exits.

So I am left with a 26 minute video instead of a full 1 hour video.

The -t parameter I use is in order for ffmpeg to download for that time (in
Is there a way to tell ffmpeg to stay online for that full amount even if the
stream pauses for some reason?

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list