multi audio track combine

Emile Semmes emile.semmes at e6group.com
Sun Aug 19 00:02:16 PDT 2012


On 8/18/2012 12:23 PM, Tim-Philipp Müller wrote:
> On Sat, 2012-08-18 at 17:43 +0100, Richard wrote:
>
>> Is there a component that is capable of combining/mixing multiple
>> audio tracks in to one? I am reading audio from multiple ALSA devices
>> and need to combine in to one stream and then output to multiple audio
>> sinks.
> Perhaps the "adder" element is what you're looking for? If not, maybe
> the interleave element?
>
> Cheers
> -Tim
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Tim,

You beat me to the punch. I second using adder too.

Can you just have a pipeline from one alsasrc directly to the alsasink 
or do you need something like an output-selector for dynamic alsasink 
selection? Is this on the same device for immediate playback or can you 
save this to a file for later playback? There are a couple of ways to 
skin this cat.

Note: these are prototype pipelines. I haven't tested them.

Assuming you're using multichannel inputs, you could try using the 
interleave and deinterleave elements but that's kinda hackish
alsasrc device="hw:1,0" ! deinterleave name=d1 \
alsasrc device="hw:1,1" ! deinterleave name=d2 \
interleave name=i \
d1.src0 ! i.sink0 \
d1.src1 ! i.sink1 \
d2.src0 ! i.sink2 \
d3.src1 ! i.sink3
... and then the reverse to get to your alsasink. If you need to swap 
inputs to outputs, you'll have to throw in output-selectors. That's 
going to be a pretty complex pipeline, but it may do the trick. (This 
actually sounds like fun. Let me know if you need help doing this one)


For later playback, if you can mux them into a quicktime container. Your 
pipeline would look something like:

alsasrc device="hw:1,0" ! queue ! mux.audio_00 \
alsasrc device="hw:1,1" ! queue ! mux.audio_01 \
alsasrc device="hw:1,2" ! queue ! mux.audio_02 \
qtmux name=mux ! filesink

You might have to do some tricks with qtmux so you can play it back. 
qtdemux was complaining about an empty atom during demuxing.

Have fun,
Emile



More information about the gstreamer-devel mailing list