ronag
ronag

Reputation: 51255

Pipe between two console applications?

How can I pipe between two separate console application running in different console windows?

e.g. I would like to do something similar to:

ffmpeg -i 0.flv -vcodec mpeg4 -f asf -s cif - | vlc -

However, I would like to do this from two separate windows, which doesn't work, I guess this is because standard out is local to cmd windows.

cmd window 1:

ffmpeg -i 0.flv -vcodec mpeg4 -f asf -s cif -

cmd window 2:

vlc -

Is there any way to programmatically achieve this? What exactly does | do behind the scenes?

Upvotes: 2

Views: 1698

Answers (3)

David Grayson
David Grayson

Reputation: 87396

Try writing two wrapper processes that call the other processes and use named pipes to redirect data.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365590(v=vs.85).aspx

Upvotes: 0

aKzenT
aKzenT

Reputation: 7895

What cmd does is connect the stdout of the first process to the stdin of the second process, you can do this programmatically. For an example see the following SO post:

How does one setup a pipe between two child processes in Win32?

If you want to see the status output from both programs (STDERR), you can redirect this to another file or read it programmatically.

Upvotes: 2

Kieren Johnstone
Kieren Johnstone

Reputation: 42003

There is no way. | pipes the output of one command into the stdin of another process.

Upvotes: 1

Related Questions