Redirect FFMPEG's output to multiple named pipes on Windows
Asked Answered
F

1

6

I am trying to stream video and audio data into two separate named pipes on Windows.

ffmpeg.exe -f dshow -i video="My camera name":audio="My microphone name" -map 0:1 -ac 1 -f f32le \\.\pipe\audioStream -map 0:0 -f mjpeg \\.\pipe\videoStream

The problem is that FFMPEG does not seem to understand that the outputs \\.\pipe\audioStream and \\.\pipe\videoStream are pipes and treats them like files.

  1. If the pipes are already created when the FFMPEG starts, it wants to overwrite them and fails.
  2. Otherwise, it complains that the path does not exist and fails.

As far as I understand, specifying the pipe: protocol should do the trick, but I can't figure out how to use it properly, even with a single pipe. I have tried:

  1. pipe:pipeName
  2. pipe:pipe\pipeName
  3. pipe:\\.\pipe\pipeName
  4. pipe://pipeName
  5. pipe://pipe\pipeName
  6. pipe://\\.\pipe\pipeName

I always end up with the same result: the output is written to the console and not to the pipe. If the pipe already exists when the FFMPEG starts, nothing connects to the pipe.

Is it possible to use FFMPEG with named pipes on Windows? If yes, what is the proper way to do this?

Frasch answered 31/5, 2016 at 14:34 Comment(2)
I don't know, but have you considered using the library rather than the command-line version? Launching a child process to do your work for you isn't really in keeping with The Tao of Windows. :-)Comstock
I have used it with a single input and output pipe without problems...No need to use the pipe:, and I do use the -y parameter to force overwrite. I'm sure it works with multiple pipes too... Maybe you are using an old FFmpeg version?Butcher
H
0

From my experience piping to multiple outputs with FFmpeg has never worked. Establishing a pipe involves data transfers of blocking type. The feeder FFmpeg expects the feeded program to "eat" a chuck of data before sending other chucks. In case of two feeds FFmpeg doesn't know which feeded programs has the priority and when in doubt FFmpeg does nothing, hence FFmpeg hangs forever waiting that something on the other side of the two pipes happens.

Hough answered 27/1, 2020 at 13:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.