[FFmpeg-devel] [PATCH] ffmpeg.c: use sigterm_handler with sigpipe

Moritz Barsnick barsnick at gmx.net
Fri Jan 12 00:06:04 EET 2018


On Thu, Jan 11, 2018 at 16:20:04 -0500, Dave Rice wrote:
> Based on a suggestion by Moritz Barsnick at http://ffmpeg.org/pipermail/ffmpeg-user/2018-January/038549.html <http://ffmpeg.org/pipermail/ffmpeg-user/2018-January/038549.html>

That's me.

>      signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).    */
>      signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */
> +    signal(SIGPIPE, sigterm_handler); /* Termination (pipe closed).  */

Works for me (TM).

Background; When outputting to a pipe, when the receiving program (e.g.
"ffplay -") is closed, ffmpeg gets killed with SIGPIPE[*]. If ffmpeg
has several outputs, the others are not properly closed then. E.g. MOV
files don't get their moov atom written. This patch fixes this.

[*] On Unix. Behavior on Windows seems sane, must be some other
mechanism.

Cheers,
Moritz


More information about the ffmpeg-devel mailing list