[FFmpeg-user] how to avoid broken pi
Nicolas George
george at nsup.org
Wed Jan 26 18:34:18 EET 2022
meex (12022-01-26):
> in a bash script i'm using ffmpeg to create a spectrogram movie and pipe the
> output to a decoder (mpv in this case, but it doesn't matter)
>
> as expected, if the user exits mpv before ffmpeg completes, it returns a
> broke pipe error and i would like to avoid that if possible
>
> the problem is that the terminal may refuse to accept any user input when
> this happens (this occurs ~20% of the time)
This is not a problem with ffmpeg. You should configure your shell to
set the tty to a sane state before a prompt. With zsh, it is done with
"ttyctl -f".
> is there a way to have ffmpeg exit gracefully when the pipe is broken?
Again, it is not ffmpeg's responsibility:
Compare:
ssecem ~ $ sh -c "dmesg" | head -n 1
[ 0.018123] On node 0, zone DMA32: 1580 pages in unavailable ranges
zsh: exit 141 sh -c "dmesg" |
zsh: done head -n 1
ssecem ~ $ sh -c "trap '' PIPE; dmesg" | head -n 1
[ 0.018123] On node 0, zone DMA32: 1580 pages in unavailable ranges
dmesg: write error
zsh: exit 1 sh -c "trap '' PIPE; dmesg" |
zsh: done head -n 1
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20220126/4a6bc33e/attachment.sig>
More information about the ffmpeg-user
mailing list