question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Write multiple streams using pipes

See original GitHub issue

I work with multistream audio files in ffmpeg:

ffmpeg -i stream1.m4a -i stream2.m4a -map 0:1 -map 0:2 out.m4a

As I understand this has been discussed here this is supported. Is this correct?

Now is there a way to use pipes as input and doing this in ffmpeg-python so that I can create multistream outputs from e.g. numpy arrays?

Here is an example what I use for single stream outputs:

# audio: numpy array
process = ffmpeg.input('pipe:', format='f32le').output(path).run_async()
process.stdin.write(audio.astype('<f4').tobytes())

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
faroitcommented, Apr 5, 2020

As a workaround for muxing multiple stereo streams into one multistream file (e.g. two stereo audio file into a single 2-stream audio file), I came up with the idea of stacking the stereo streams into multiple channels and use a complex filter to map the channels to streams such as:

ffmpeg -y -i in.wav -filter_complex "\
  [a:0]pan=stereo| c0=c0 | c1=c1[a0]; \
  [a:0]pan=stereo| c0=c2 | c1=c3[a1]; \
  " -map "[a0]" -map "[a1]" -c:a pcm_s16le out.mka

Would this be implementable in ffmpeg-python? @loretoparisi @kkroening

1reaction
faroitcommented, Feb 26, 2020

@loretoparisi I managed to do this now with -complex_filter and multiple maps. Is there an example how to use -complex_filter in ffmpeg-python?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use multiple pipe streams - java - Stack Overflow
I'm trying to make a pipedinputstreams. Its about reading two txt files and filtering that files' data. In LifeCycleManager, reading student, ...
Read more >
[stream] support piping multiple streams into a single stream #93
Another use case - piping data from multiple clients into one stream and then piping the stream back into each client, e.g. for...
Read more >
Pipe a single read stream to multiple write streams
I havce a single read stream that I want to pipe to multiple write streams on separate iterations of the event loop (using...
Read more >
How to connect streams with pipe? - Mario Kandut
With the pipe method it is possible to chain multiple streams together. The requirement for this is that the destination stream is both ......
Read more >
Using Streams to Implement Pipes
Piped input and output streams are convenient for methods that produce output to be used as input by someone else. For example, suppose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found