Redirect FFMPEG's output to multiple named pip

2019-07-13 12:39发布

问题:

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?