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.
To reduce latency, you will need to create a custom Live profile. Follow the steps below:
name
to "Low Latency Profile" (or another meaningful name).renditions
, change the segment_seconds
to 2
to reduce the length of the segments to 2 seconds.
{
"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": []
}
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.
The following features are NOT supported with Live streams using reduced latency:
Additional limitations include: