[FFmpeg-devel] [PATCH] ffmpeg: modify tty state when stderr is redirected

Nicolas George george at nsup.org
Sat Aug 1 12:54:18 CEST 2015

Le quartidi 14 thermidor, an CCXXIII, Michael Niedermayer a écrit :
> > ffmpeg -lavfi testsrc -f framecrc | head
> Thats interresting, i tried this and it did not trash my terminal
> also ive almost never seen ffmpeg trash my terminal with the current
> code. No matter how i run it

As Ganesh noticed, I forgot the output "-" in my example, but you probably
noticed that on your own, and that is not the issue.

I just ran some tests and it appears that bash restores the tty state if the
command was killed by a signal but not if it exited normally.

Therefore, "ffmpeg ... - | head" will have the tty restored because ffmpeg
dies by SIGPIPE, but "strace ffmpeg ... - | head" will trash the tty state
because bash does not know of the SIGPIPE. The same goes for anything that
runs ffmpeg as a sub-process, from "sh -c ..." to the FATE harness.

Well, bash does part of its job, but I consider it should do more: leaving
the tty trashed just because you inserted strace in front of the command is
bad policy.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150801/47f252e7/attachment.sig>

More information about the ffmpeg-devel mailing list