[FFmpeg-user] Prevent FFMPEG from stopping on EOF

Moritz Barsnick barsnick at gmx.net
Tue Jul 19 17:06:21 EEST 2016

On Mon, Jul 18, 2016 at 16:12:36 +0200, Kaj-Sören Mossdorf wrote:
> (with the -re-option). The big issue here is however that the
> Encoding runs stable for two hours or so, then stops (due to the file
> not being filled on time, e.g. because of Internet connectivity
> issues). Is there any way to prevent ffmpeg from stopping if EOF is
> reached (like it is done with the rtmp-live-option)?

I haven't managed to test this, but it might work:
Assuming your input file can be handled fine by ffmpeg if you pipe it
$ cat inputfile.ext | ffmpeg -i - [...]
then you could use the Unix "tail" command to buffer:
$ tail -c +1 -F inputfile.ext | ffmpeg -i - [...]

The "-F" option to tail will make it "follow" the file, i.e. output
more of it while it is growing (and just stall while it doesn't grow),
without closing its output pipe. ffmpeg would terminate only on an EOF
(which tail doesn't send) or on a SIGPIPE (which tail sends when it is
terminated). Furthermore, "-F" allows you to launch "tail" before the
given file exists.

Do give that a try.


More information about the ffmpeg-user mailing list