Audio Channel Mapping
Channel Selection
Audio channels are numbered (starting at 1) across all of the audio tracks in a container. For example in a container with two stereo tracks A1 and A2, the channels are numbered 1/2 and 3/4 respectively.
Use the select
operator to map specific audio channels to an input stream.
For example the following composition maps the first 8 audio channels from the input1
container to separate surround
and stereo
input streams:
---
input:
container:
- name: input1
audio:
- name: surround
channels: 6
select:
channel:
- 1
- 2
- 3
- 4
- 5
- 6
- name: stereo
channels: 2
select:
channel:
- 7
- 8
output:
container:
- name: output1
audio:
- name: surround
- name: stereo
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "surround",
"channels": 6,
"select": {
"channel": [
1,
2,
3,
4,
5,
6
]
}
},
{
"name": "stereo",
"channels": 2,
"select": {
"channel": [
7,
8
]
}
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "surround"
},
{
"name": "stereo"
}
]
}
]
}
}
Channel Routing
When a job is submitted the select
operator routes channels based on the number of audio tracks found in the input container.
If input1
from the previous example has a single audio track a1
with 8 channels the streams will be routed as shown below:
---
input:
container:
- name: input1
audio:
- name: a1
channels: 8
output:
container:
- name: output1
audio:
- name: surround
channels: 6
route:
name: a1
channel:
- 1
- 2
- 3
- 4
- 5
- 6
- name: output2
audio:
- name: stereo
channels: 2
route:
name: a1
channel:
- 7
- 8
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "a1",
"channels": 8
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "surround",
"channels": 6,
"route": {
"name": "a1",
"channel": [
1,
2,
3,
4,
5,
6
]
}
}
]
},
{
"name": "output2",
"audio": [
{
"name": "stereo",
"channels": 2,
"route": {
"name": "a1",
"channel": [
7,
8
]
}
}
]
}
]
}
}
Alternatively, if input1
has 8 discreet audio tracks the streams will be routed as follows:
---
input:
container:
- name: input1
audio:
- name: a1
- name: a2
- name: a3
- name: a4
- name: a5
- name: a6
- name: a7
- name: a8
output:
container:
- name: output1
audio:
- name: surround
channels: 6
route:
channel:
- name: a1
channel: 1
- name: a2
channel: 1
- name: a3
channel: 1
- name: a4
channel: 1
- name: a5
channel: 1
- name: a6
channel: 1
- name: stereo
channels: 2
route:
channel:
- name: a7
channel: 1
- name: a8
channel: 1
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "a1"
},
{
"name": "a2"
},
{
"name": "a3"
},
{
"name": "a4"
},
{
"name": "a5"
},
{
"name": "a6"
},
{
"name": "a7"
},
{
"name": "a8"
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "surround",
"channels": 6,
"route": {
"channel": [
{
"name": "a1",
"channel": 1
},
{
"name": "a2",
"channel": 1
},
{
"name": "a3",
"channel": 1
},
{
"name": "a4",
"channel": 1
},
{
"name": "a5",
"channel": 1
},
{
"name": "a6",
"channel": 1
}
]
}
},
{
"name": "stereo",
"channels": 2,
"route": {
"channel": [
{
"name": "a7",
"channel": 1
},
{
"name": "a8",
"channel": 1
}
]
}
}
]
}
]
}
}
Speaker Selection
The select
operator can map audio channels based on speaker labels present in the container:
---
input:
container:
- name: input1
audio:
- name: surround
channels: 6
select:
channel:
- label: L
- label: R
- label: C
- label: LFE
- label: Ls
- label: Rs
- name: stereo
channels: 2
select:
channel:
- label: Lt
- label: Rt
output:
container:
- name: output1
audio:
- name: surround
- name: stereo
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "surround",
"channels": 6,
"select": {
"label": [
"L",
"R",
"C",
"LFE",
"Ls",
"Rs"
]
}
},
{
"name": "stereo",
"channels": 2,
"select": {
"label": [
"Lt",
"Rt"
]
}
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "surround"
},
{
"name": "stereo"
}
]
}
]
}
}
When a job is submitted the operator will route and, if necessary, reorder the channels to match the label
selection.
Speaker Assignment
If speaker labels are not present (or incorrect) they can be assigned (or overridden) using the label
property:
---
input:
container:
- name: input1
audio:
- name: surround
channels: 6
select:
channel:
- 1
- 2
- 3
- 4
- 5
- 6
label:
- L
- R
- C
- LFE
- Ls
- Rs
- name: stereo
channels: 2
select:
channel:
- 7
- 8
label:
- L
- R
output:
container:
- name: output1
audio:
- name: surround
- name: stereo
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "surround",
"channels": 6,
"select": {
"channel": [
1,
2,
3,
4,
5,
6
]
},
"label": [
"L",
"R",
"C",
"LFE",
"Ls",
"Rs"
]
},
{
"name": "stereo",
"channels": 2,
"select": {
"channel": [
7,
8
]
},
"label": [
"L",
"R"
]
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "surround"
},
{
"name": "stereo"
}
]
}
]
}
}
Program Selection
Channels with identical speaker labels are differentiated by the program number. For example the following composition selects two stereo programs:
---
input:
container:
- name: input1
audio:
- name: stereo1
channels: 2
select:
channel:
- label: L
program: 1
- label: R
program: 1
- name: stereo2
channels: 2
select:
channel:
- label: L
program: 2
- label: R
program: 2
output:
container:
- name: output1
audio:
- name: stereo1
- name: stereo2
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "stereo1",
"channels": 2,
"select": {
"channel": [
{
"label": "L",
"program": 1
},
{
"label": "R",
"program": 1
}
]
}
},
{
"name": "stereo2",
"channels": 2,
"select": {
"channel": [
{
"label": "L",
"program": 2
},
{
"label": "R",
"program": 2
}
]
}
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "stereo1"
},
{
"name": "stereo2"
}
]
}
]
}
}
Program Assignment
If program numbers are not present they can be assigned using the program
property:
---
input:
container:
- name: input1
audio:
- name: a1
channels: 4
label:
- L
- R
- L
- R
program:
- 1
- 1
- 2
- 2
output:
container:
- name: output1
audio:
- route:
channel:
- label: L
program: 1
- label: R
program: 1
- route:
channel:
- label: L
program: 1
- label: R
program: 1
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "a1",
"channels": 4,
"label": [
"L",
"R",
"L",
"R"
],
"program": [
1,
1,
2,
2
]
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"route": {
"channel": [
{
"label": "L",
"program": 1
},
{
"label": "R",
"program": 1
}
]
}
},
{
"route": {
"channel": [
{
"label": "L",
"program": 1
},
{
"label": "R",
"program": 1
}
]
}
}
]
}
]
}
}
Channel Layout
By default each audio stream is mapped to a track in the output container. Use the layout
operator to map output channels to specific tracks. Audio channels are numbered (starting at 1) across all the audio tracks in an output container.
For example the following composition uses the select
operator to map the first 4 input channels to 2 stereo streams. The input1
container could have either single channel (mono), dual channel (stereo) or multi-channel audio tracks.
The track
property defines 4 single channels tracks in the output1
container. The layout
operator maps each stereo stream to specific output channels.
---
input:
container:
- name: input1
audio:
- name: stereo1
channels: 2
select:
channel:
- 1
- 2
- name: stereo2
channels: 2
select:
channel:
- 3
- 4
output:
container:
- name: output1
track:
audio:
- channels: 1
- channels: 1
- channels: 1
- channels: 1
audio:
- name: stereo1
layout:
channel:
- 1
- 2
- name: stereo2
layout:
channel:
- 3
- 4
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "stereo1",
"channels": 2,
"select": {
"channel": [
1,
2
]
}
},
{
"name": "stereo2",
"channels": 2,
"select": {
"channel": [
3,
4
]
}
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"track": {
"audio": [
{
"channels": 1
},
{
"channels": 1
},
{
"channels": 1
},
{
"channels": 1
}
]
},
"audio": [
{
"name": "stereo1",
"layout": {
"channel": [
1,
2
]
}
},
{
"name": "stereo2",
"layout": {
"channel": [
3,
4
]
}
}
]
}
]
}
}
Optional Channels
Input audio channels may be treated as optional
using the select
operator.
If an input channel is not present it is replaced with silence in any output stream referencing that channel. If none of the input channels referenced by an output stream are present then the output stream is removed from the composition.
For example the following composition has an optional Spanish language stream on input channels 3/4:
---
input:
container:
- name: input1
audio:
- name: english
channels: 2
select:
channel:
- 1
- 2
- name: spanish
optional: true
channels: 2
select:
channel:
- 3
- 4
output:
container:
- name: output1
audio:
- name: english
language: 'eng'
- name: spanish
language: 'spa'
{
"input": {
"container": [
{
"name": "input1",
"audio": [
{
"name": "english",
"channels": 2,
"select": {
"channel": [
1,
2
]
}
},
{
"name": "spanish",
"optional": true,
"channels": 2,
"select": {
"channel": [
3,
4
]
}
}
]
}
]
},
"output": {
"container": [
{
"name": "output1",
"audio": [
{
"name": "english",
"language": "eng"
},
{
"name": "spanish",
"language": "spa"
}
]
}
]
}
}
Updated over 1 year ago