Reducing Latency for 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 viewers 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, the player will be pre-fetching less video data, and chances of playback pausing while the player loads additional segments into the buffer will be increased.
Creating Reduced Latency Live Profile
To reduce latency, you will need to create a custom Live profile. Follow the steps below:
- Login to Studio.
- Open the Admin module.
- In the left navigation, click Ingest Profiles.
- Select one of the Live ingest profiles with no more than 4 renditions.
- Click on the link to open the profile.
- Click to create a new profile based on the selected one.
- In the new profile, change the
name
to "Low Latency Profile" (or another meaningful name). - For each of the
renditions
, change thesegment_seconds
to2
to reduce the length of the segments to 2 seconds. - 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": [] }
- To use the profile, select it when creating a new Live Event in the Live module.
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
. Also, make sure that observe the other limitations listed in the Introduction.
Limitations
The following features are NOT supported with Live streams using reduced latency:
- SSAI
- DRM
- Multi-language audio tracks
- Redundancy
Additional limitations include:
- The DVR window must be less than 5 minutes
- No more than 4 renditions