[FFmpeg-user] Review, for FAQs on running ffmpeg in the background

Jim DeLaHunt from.ffmpeg-user at jdlh.com
Sun Nov 5 07:58:06 EET 2017

Hello, ffmpeg users:

Many thanks to everyone who has helped make this excellent tool, on 
which I now rely. I appreciate your efforts.

I recently joined the trickle of ffmpeg users who had problems running 
ffmpeg in the background, because it would get suspended. I too 
eventually found out about ffmpeg's use of stdin interaction, about the 
-nostdin option to disable that, or the alternative of redirecting stdin 
to /dev/null.

I don't see any clear documentation about this issue in the ffmpeg docs. 
Specifically, it seems like it ought to be an FAQ 
<http://ffmpeg.org/faq.html>, and I don't see it there.

Here is a proposed pair of FAQs. They might end up as 3.19 and 3.20. I 
would appreciate your review. Any suggestions about how to improve it?  
I've written this as two questions, should it be one? (Don't worry about 
the formatting, I can add that when I make the patch.)


[Q: 3.19~] How do I run ffmpeg as a background task?

`ffmpeg` normally checks the console input for entries like "q" to stop, 
"?" to give help, while performing operations. It does not have a way of 
detecting when it is running as a background task. When it checks the 
console input, that can cause the process running ffmpeg in the 
background to suspend.

To run ffmpeg as a background task, and prevent those input checks, use 
the `-nostdin` option, as described in [Main 
Options](http://ffmpeg.org/ffmpeg.html#Main-options), in the `ffmpeg` 
invocation. As an alternative, you can redirect standard input to 
`/dev/null` (on Linux and Mac OS) or `NUL` (on Windows), either on the 
`ffmeg` invocation, or from a shell script which calls `ffmpeg`.

For example:

     ffmpeg -nostdin -i INPUT OUTPUT

or (on Linus and Mac OS):

     ffmpeg -i INPUT OUTPUT </dev/null

or (on Windows):

     ffmpeg -i INPUT OUTPUT <NUL

[Q: 3.20~] ffmpeg suspends with a message like `suspended (tty output)` 
when I run it in the background. How do I prevent ffmpeg from being 

If you run `ffmpeg` in the background, you may find that its process 
suspends. For example:

     % ffmpeg -i INPUT OUTPUT &> ~/tmp/log.txt &
     [1] 93352
     [1]  + suspended (tty output)  ffmpeg -i INPUT OUTPUT &>

The message "tty output" notwithstanding, the problem here is that 
`ffmpeg` normally checks the console /input/ when it runs. The operating 
system detects this, and suspends the process until you can bring it to 
the foreground and attend to it.

The solution is to use the right techniques to tell `ffmpeg` not to 
consult console input. You can use the `-nostdin` option, or redirect 
standard input with `< /dev/null`. See FAQ {3.19} for details.



Why two questions? One to explain the issue straightforwardly, and one 
to present the kind of messages and keywords for which a user might 
search when they experience the problem and don't understand it.

FYI, I've also written a StackExchange question about this: /When I run 
`ffmpeg` in the background, how do I prevent `suspended (tty output)`? 
/Feel free to answer there if you want. I also wrote a blog post with 
essentially the same content: //When I run “ffmpeg” in the background, 
how do I prevent “suspended (tty output)”?/ 
<http://blog.jdlh.com/en/2017/11/04/ffmpeg-suspended-tty-output/>/ That 
should also help get the word out to ffmpeg users searching the web at 

     --Jim DeLaHunt, jdlh at jdlh.com     http://blog.jdlh.com/ (http://jdlh.com/)
       multilingual websites consultant

       355-1027 Davie St, Vancouver BC V6E 4L2, Canada
          Canada mobile +1-604-376-8953

More information about the ffmpeg-user mailing list