[FFmpeg-user] Spontaneously slipping into command mode

Ferdi Scholten ferdi at sttc-nlp.nl
Mon Jul 28 09:57:25 EEST 2025


On 28-07-2025 02:18, Jim DeLaHunt wrote:
> On 2025-07-27 15:45, Mark Filipak wrote:
>
>> On 27/07/2025 16.51, Jim DeLaHunt wrote:
>>> ...I understand that FFmpeg routinely monitors stdin while running...
>> Oh, yes, of course. But-- But-- But my understanding is that > redirects
>> to stdout.
>>
>> I'm not sending anything to stdin. ...So, (?).
>
> You are not sending anything to FFmpeg's stdin in your commands. It 
> certainly seems like FFmpeg is receiving something on its stdin. So, 
> perhaps something else is sending something to FFmpeg's stdin?  
> Another agent in this situation is the Windows command shell, perhaps 
> it is sending?
>
> But understanding the root cause is one thing. Preventing the symptoms 
> is another, but perhaps that is enough.  Does adding
>
>    -nostdin
>
> to your FFmpeg invocations prevent the problem?

I have been reading in on batch processing on Windows
The issue here is Windows and how it handles batch scripts, and the 
issue goes back to its roots in DOS.

The batch script is literally read into stdin (as a whole) and executed 
from there. Just like if you are typing every single line of the script 
on a command prompt. (which was exactly what batch processing was 
designed for in DOS)

So yes running a program like FFmpeg that accepts commands from stdin 
while running will eat your remaining batch script as input.

Unless... You invoke that program from the .bat with the START command, 
which will cause the program to run in a new session and does not use 
the stdin from the previous session where it was started from.

or use something more modern for scripting on Windows like Powershell to 
overcome the stdin issue.
or use the suggestion from Jim with the -nostdin option


More information about the ffmpeg-user mailing list