[FFmpeg-user] stopping ffmpeg correctly while piping

Moritz Barsnick barsnick at gmx.net
Thu Jan 11 17:03:08 EET 2018

On Thu, Jan 11, 2018 at 09:25:53 -0500, Dave Rice wrote:
> When running these commands the video plays (in either ffplay or
> mpv). When I close the playback window to stop the player, then
> ffmpeg also stops, but with an invalid output. In this case the file
> will_this_file_work.mov will have no moov atom.

Interesting: ffmpeg doesn't close one output correctly, if the other
one fails? (I didn't double check, but that is an undesired limitation,
if you ask me. I'm not using the word "bug" yet. ;-))

> Any suggestions on how to end this so that I can close the player to
> stop the process and have a valid file.

If you can manage to use the "tee" muxer instead of two outputs, it has
the option "onfail" which should control this behavior:

        Specify behaviour on output failure. This can be set to either
        abort (which is default) or ignore. abort will cause whole
        process to fail in case of failure on this slave output. ignore
        will ignore failure on this output, so other outputs will
        continue without being affected.

Note that your file will then just continue encoding, you would need to
terminate it separately with a signal or a keypress. I assume the file
would be correctly closed then (untested, as mentioned).

Hope this helps,

More information about the ffmpeg-user mailing list