Configure live stream settings

This page describes how to configure settings during input endpoint or channel creation for live stream features such as multiple audio tracks, captions, and spritesheets.

Configure through input endpoint creation

You can specify configurations for the following features during input endpoint creation:

IP allowlisting

You can restrict access to input endpoints by specifying IP ranges the input stream should originate from, such as the IP address of the encoder. The video pipeline only accepts traffic from IP addresses in these ranges. The IP ranges must be in CIDR block format.

Configure the securityRules field in the Input resource:

{
  "type": "RTMP_PUSH",
  "securityRules": {
    "ipRanges": ["1.2.3.4/32"]
  }
}

Configure through channel creation

You can specify configurations for the following features during channel creation:

Multiple audio tracks

If the input stream contains more than one audio track, use the AudioMapping object to select the track for each AudioStream.

{
  "inputAttachments": [
    {
      "key": "MY-INPUT",
      "input": "/projects/PROJECT-ID/locations/LOCATION/inputs/MY-INPUT",
    }
  ],
  "output": {
    "uri": "gs://BUCKET_NAME/outputs/"
  },
  "elementaryStreams": [
    {
      "key": "es_video",
      "videoStream": {
        "h264": {
          "heightPixels": 720,
          "widthPixels": 1280,
          "bitrateBps": 3000000,
          "frameRate": 30
        }
      }
    },
    {
      "key": "es_first_audio",
      "audioStream": {
        "codec": "aac",
        "bitrateBps": 160000,
        "mapping": [
          {
            "inputKey": "MY-INPUT",
            "inputTrack": 1
          }
        ]
      }
    },
    {
      "key": "es_second_audio",
      "audioStream": {
        "codec": "aac",
        "bitrateBps": 160000,
        "mapping": [
          {
            "inputKey": "MY-INPUT",
            "inputTrack": 2
          }
        ]
      }
    }
  ],
  "muxStreams": [
    {
      "key": "mux_video",
      "elementaryStreams": ["es_video"],
    },
    {
      "key": "mux_first_audio",
      "elementaryStreams": ["es_first_audio"],
    },
    {
      "key": "mux_second_audio",
      "elementaryStreams": ["es_second_audio"],
    }
  ],
  "manifests": [
    {
      "type": "DASH",
      "muxStreams": [
        "mux_video",
        "mux_first_audio",
        "mux_second_audio",
      ]
    }
  ]
}

Note that Shaka Player doesn't support the following features for HLS streams with multiple audio tracks:

  • Alternate audio track playback with TS segments.

  • Secondary and alternate audio track selection with fMP4 segments.

Passthrough CEA 608/708 captions

If the input streams contain CEA 608/708 captions, you can forward the captions to the output streams. Add the following textStream to the elementaryStreams when creating a Channel. This textStream embeds the CEA 608/708 captions in all output video streams and renditions.

{
  "key": "captions",
  "textStream": {
    "codec": "cea608"
  }
}

Sprite sheets

To generate a sprite sheet, configure the spriteSheets field in the Channel resource.

{
  "spriteSheets": [
    {
      "format": "jpeg",
      "filePrefix": "sprite",
      "interval": "2s",
      "spriteWidthPixels": 320,
      "spriteHeightPixels": 240,
      "columnCount": 3,
      "rowCount": 3,
      "quality": 80
    }
  ]
}