[FFmpeg-user] Can I use ffmpeg to combine audio streams in .ts file?

Moritz Barsnick barsnick at gmx.net
Tue Sep 30 16:05:34 CEST 2014

On Tue, Sep 30, 2014 at 14:49:58 +0200, skyscanner at gmx.ca wrote:

> But also, all of the examples on that page are for a single stream.
> Every single example only mentions "stream 0" - there is no reference
> anywhere to a "stream 1", "stream 2", etc. That is why I am beginning
> to wonder if ffmpeg even has the capability to merge streams. I have

I think something like this works. I have created an input file with
four distinct stereo streams (with different sine wave frequencies on
left and right :-)), and merge those channels into a stereo signal as
you described, omitting "stream 2 right" and "stream 4 left". Note that
my stream "-map" offsets are different because I provided no video on

ffmpeg -i multistream.ts -filter_complex '[0:0][0:1][0:2][0:3]amerge=inputs=4,pan=stereo:FL=c0+c2+c4:FR=c1+c5+c7' -c:a mp2 onestreamstereo.ts

It's really hard to test whether this does the right thing, but it
might be somewhere along these lines.


More information about the ffmpeg-user mailing list