Reducing Latency for Live Streams

This topic explains how you can reduce latency for your Brightcove Live streams.

Introduction

Latency is the time lag between the when something is recorded in real life and when it is seen in a video player. There is, of course, some real time required to transmit a signal from the source through the internet to a viewer's player. Latency is aggravated by the fact that online video is transmitted in discreet chunks, called segments.

Latency can be reduced by shortening the length of the video segments, and the following sections will detail how you can do this.

Be aware, however, that there is a tradeoff: to insure uninterrupted playback, the player downloads a few video segments ahead of the current playback position (this is called buffering), so that they are ready when needed.

If you shorten the length of segments, keep the following in mind:

  • The player will be pre-fetching less video data, and chances of playback pausing while the player buffers additional segments will be increased
  • The customer's CDN will see increased request traffic
  • Apple’s recommendation for standard live stream HLS is a 6-second segment duration. Shortening the segments may make the stream less stable in sub-optimal conditions. Low Latency Live may be a better solution if you need minimal latency.

Creating Reduced Latency Live Profile

To reduce latency, you will need to create a custom Live profile. Follow the steps below:

  1. Login to Studio.
  2. Open the Admin module.
  3. In the left navigation, click Ingest Profiles.
  4. Select one of the Live ingest profiles with no more than 4 renditions.
    Select a Live Profile
  5. Click on the link to open the profile.
  6. Click Duplicate to create a new profile based on the selected one.
  7. In the new profile, change the name to "Low Latency Profile" (or another meaningful name).
  8. For each of the renditions, change the segment_seconds to 2 to reduce the length of the segments to 2 seconds.
  9. The profile should look similar to this:
    {
      "model_version": 1,
      "name": "Low Latency Profile",
      "description": "Deliver high-quality renditions to maximize quality for desktop and OTT.",
      "account_id": "57838016001",
      "renditions": [
        {
          "media_type": "video",
          "format": "ts",
          "segment_seconds": 2,
          "label": "hls1080p",
          "live_stream": true,
          "video_codec": "h264",
          "video_bitrate": 4000,
          "keyframe_interval": 60,
          "width": 1920,
          "height": 1080,
          "h264_profile": "high"
        },
        {
          "media_type": "video",
          "format": "ts",
          "segment_seconds": 2,
          "label": "hls720p",
          "live_stream": true,
          "video_codec": "h264",
          "video_bitrate": 2400,
          "keyframe_interval": 60,
          "width": 1280,
          "height": 720,
          "h264_profile": "high"
        },
        {
          "media_type": "video",
          "format": "ts",
          "segment_seconds": 2,
          "label": "hls540p",
          "live_stream": true,
          "video_codec": "h264",
          "video_bitrate": 1700,
          "keyframe_interval": 60,
          "width": 960,
          "height": 540,
          "h264_profile": "main"
        },
        {
          "media_type": "video",
          "format": "ts",
          "segment_seconds": 2,
          "label": "hls360p",
          "live_stream": true,
          "video_codec": "h264",
          "video_bitrate": 900,
          "keyframe_interval": 60,
          "width": 640,
          "height": 360,
          "h264_profile": "main"
        }
      ],
      "packages": []
    }
  10. To use the profile, select it when creating a new Live Event in the Live module.
    Create Live Event

Using the Live API

If you want reduced latency, and you use the Live API to create your live jobs, just create the job as you normally do, but include no more than 4 renditions, and set segment_seconds for each rendition to 2. Make sure you observe the listed limitations for this feature.

Limitations

The use of a 2-second segment length is not compatible with live jobs that have a redundancy aspect.