Stream Operators

The following operators can be applied to a video, audio or subtitle stream.

PropertyTypeDescription
selectobjectMaps an input track to a media stream.
routeobjectRoutes a stream from an input to an output.
decodeobjectDecodes the media stream samples.
resampleobjectConverts the stream to a different sample rate.
filterarrayLists the filters applied to the media stream samples.
encodeobjectEncodes the media stream samples.
layoutobjectMaps a media stream to an output track.

select

Maps input container tracks to a video, audio or subtitle stream. For audios stream the operator can select specific audio channels.

PropertyTypeDescription
trackintegerIdentifies a specific track by number (1-based).
pidintegerMPEG-2 transport stream packet identifier that selects a specific elementary stream.
formatstringFour character code that identifies the media sample format.
languagestringTwo or three character code that identifies the stream language.
channelarrayIdentifies each audio channel. The input stream channels property determines the dimension of the array.

The array items are either the input channel number (1 based) or a channel object as described below.

The channel object identifies a specific input channel. The object supports the following properties:

PropertyTypeDescription
labelstringIdentifies an audio channel by speaker label.
programintegerIdentifies an audio channel by program number.

For example the following composition selects audio channels by channel number:

---
input:
  container:
  - name: input1
    video:
    - name: v1
    audio:
    - name: surround
      channels: 6
      select:
        channel:
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
    - name: stereo
      channels: 2
      select:
        channel:
        - 7
        - 8
{
  "input": {
    "container": [
      {
        "name": "input1",
        "video": [
          {
            "name": "v1"
          }
        ],
        "audio": [
          {
            "name": "surround",
            "channels": 6,
            "select": {
              "channel": [
                1,
                2,
                3,
                4,
                5,
                6
              ]
            }
          },
          {
            "name": "stereo",
            "channels": 2,
            "select": {
              "channel": [
                7,
                8
              ]
            }
          }
        ]
      }
    ]
  }
}

route

The route operator routes a video, audio or subtitle stream from an input container to an output container. For an audio stream the operator may route specific input channels.

PropertyTypeDescription
namestringIdentifies the input stream.
channelarrayLists the input channels routed to each output channel. The output stream channels property determines the dimension of the array.

The array items are either the input channel number (1 based) or a channel object as described below.

The channel object allows input channels from different streams to be routed to the output. The channel object supports the following properties:

PropertyTypeDescription
namestringIdentifies the input stream for this channel.
channelintegerIdentifies the input channel by number (1 based).
labelenumIdentifies the input channel by speaker label.
programintegerIdentifies the input channel by program number.

resample

Resamples a media stream to the target sample rate.

PropertyTypeDescription
speedobjectSpeed adjustment expressed as a rational number.

decode

Decodes the media stream samples using a specific decompressor type.

PropertyTypeDescription
typestringFour character code that identifies the decompressor implementation.
propertiesobjectDecompressor configuration properties.

filter

Processes the stream media samples using a specific filter type.

PropertyTypeDescription
typestringFour character code that identifies the filter implementation.
propertiesobjectFilter configuration properties.

encode

Encodes the media stream samples using a specific compressor type.

PropertyTypeDescription
typestringFour character code that identifies the compressor implementation.
propertiesobjectCompressor configuration properties.

layout

Maps a video, audio or subtitle stream to an output container track. For audio streams the operator can layout each audio channel.

PropertyType
trackintegerSpecifies the output track (1 based) for this stream.
channelarraySpecifies the output channel number (1 based) for each audio channel. The output stream channels property determines the dimension of the array.