# interleave

Merges separate mono inputs into one interleaved stream.

This element handles all raw floating point sample formats and all signed integer sample formats. The first caps on one of the sinkpads will set the caps of the output so usually an audioconvert element should be placed before every sinkpad of interleave.

It's possible to change the number of channels while the pipeline is running by adding or removing some of the request pads but this will change the caps of the output buffers. Changing the input caps is not supported yet.

The channel number of every sinkpad in the out can be retrieved from the "channel" property of the pad.

## Example launch line

     gst-launch-1.0 filesrc location=file.mp3 ! decodebin ! audioconvert ! "audio/x-raw,channels=2" ! deinterleave name=d  interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav    d.src_0 ! queue ! audioconvert ! i.sink_1    d.src_1 ! queue ! audioconvert ! i.sink_0

Decodes and deinterleaves a Stereo MP3 file into separate channels and then interleaves the channels again to a WAV file with the channels exchanged.

     gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav  filesrc location=file1.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x1" ! queue ! i.sink_0   filesrc location=file2.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x2" ! queue ! i.sink_1

Interleaves two Mono WAV files to a single Stereo WAV file. Having channel-masks defined in the sink pads ensures a sane mapping of the mono streams into the stereo stream. NOTE: the proper way to map channels in code is by using the channel-positions property of the interleave element.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──interleave

## Factory details

Authors: – Andy Wingo <wingo at pobox.com>, Sebastian Dröge <slomo@circular-chaos.org></slomo@circular-chaos.org></wingo>

Classification: – `Filter/Converter/Audio`

Rank – none

Plugin – interleave

Package – GStreamer Good Plug-ins

## Pad Templates

### `sink_%u`

    audio/x-raw:
               rate: [ 1, 2147483647 ]
           channels: 1
             format: { F64LE, F64BE, F32LE, F32BE, S32LE, S32BE, U32LE, U32BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S24LE, S24BE, U24LE, U24BE, S20_32LE, S20_32BE, U20_32LE, U20_32BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, S16LE, S16BE, U16LE, U16BE, S8, U8 }
             layout: { (string)non-interleaved, (string)interleaved }

Presence – request

Direction – sink

Object type – GstPad

### `src`

    audio/x-raw:
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             format: { F64LE, F64BE, F32LE, F32BE, S32LE, S32BE, U32LE, U32BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S24LE, S24BE, U24LE, U24BE, S20_32LE, S20_32BE, U20_32LE, U20_32BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, S16LE, S16BE, U16LE, U16BE, S8, U8 }
             layout: interleaved

Presence – always

Direction – src

Object type – GstPad

## Properties

### channel-positions

    “channel-positions” GValueArray *

Channel positions: This property controls the channel positions that are used on the src caps. The number of elements should be the same as the number of sink pads and the array should contain a valid list of channel positions. The n-th element of the array is the position of the n-th sink pad.

These channel positions will only be used if they're valid and the number of elements is the same as the number of channels. If this is not given a NONE layout will be used.

Flags : Read / Write

### channel-positions-from-input

    “channel-positions-from-input” gboolean

Channel positions from input: If this property is set to TRUE the channel positions will be taken from the input caps if valid channel positions for the output can be constructed from them. If this is set to TRUE setting the channel-positions property overwrites this property again.

Flags : Read / Write

Default value : true

The results of the search are