Guide to Reducing Stream Latency

Streambox Guide for Reducing Stream Latency (Delay)


Stream latency, the delay between the source video and the video playout at the stream destination, is a function of processing the video stream on the encoder side and the latency and quality of the connecting network(s). The time delay over the network is dependent on the network capacity and distance between nodes. Long distance transmissions can be improved by utilizing the Streambox Cloud Services. Here, we will discuss the settings needed to optimize the stream for the lowest latency based on network efficiency.
†

Encoder Network Settings:

Almost all of the settings that affect the latency are with the Encoder, in the network settings screens or menus.

VBR Buffer. Measured in seconds and set from 0.1 to 8 seconds, it is a measure of the Encoder buffer size. If the value is set too low, it can result in poor motion processing; higher-motion videos require higher VBR buffers. Typically, values in the 0.3 to 0.8 range are adequate for HD video. Adjust higher or lower to find a value that offers the best balance given the motion-quality and latency desired.

FEC, Forward Error Correction. Used in lieu of or in addition to LDMP as error correction method. It adds additional packets for redundancy, which results in slightly increase latency. If LDMP is enabled, you can disable FEC in most cases.
†

Encoder LDMP Settings:

ACK_TO/ACK Timeout/Acknowledgment timeout: the time (in milliseconds) the Encoder waits for replies from the Decoder. If the Encoder doesn't receive a reply that acknowledges receipt of a data packet, it re-sends the packet, and these re-sent packets may arrive late, resulting in packet loss on screen. If you can measure the ping time (Round-Trip Time, RTT) from Encoder to Decoder, set the Ack Timeout to be about 1.5 times the average measured Ping/RTT, with a minimum value of 35. For example, if the RTT averages 50 ms then you set the ACK_TO to 75.

RTT Multiplier: This sets the time the Encoder will wait for replies regarding the re-sent packets as described above. Set this to 2, or if the ping value measured above varies widely, 3 or 4. The new time that the Encoder will wait, for the re-sent packets, is the RTT Multiplier times the Ack Timeout, above. For example, an Ack Timeout of 75 and a Multiplier set to 2 means that the first, initial packets sent to the Decoder must be acknowledged within 75ms, and if that does not happen, the Encoder re-sends and will wait 75ms x 2 = 150ms for the acknowledgment from the Decoder.
†

Jitter (Decoder) Buffers:

As packets arrive at the decoder, they may arrive with some variation in the timing of their arrival compared to the sending, due to network fluctuations, different paths taken through the Internet, and so on. This variability, known as jitter, requires compensation in order to have a smooth video playout.

The Jitter buffers are Decoder buffers in which the video packets are temporarily stored to remove any variance in the timing of their arrival and also placed in correct order if they arrived out of order due to a severe variation induced by the network or multiple networks in use. Those are the respective jobs of the Jitter1 and Jitter2 buffers.

The Encoder?s LDMP settings include a value to send a command to the Decoder to set the size of the Jitter2 buffer to a percentage of the bitrate, and use a combination of other LDMP settings to calculate, then command, the size of the Jitter1 buffer. The size of the buffers can also be set manually on the Decoder as well. Where the Encoder Jitter and the Decoder Jitter values differ, the higher of the two values for each buffer takes precedence.


Encoder LDMP Settings - Pre-Buffer (also called Jitter2 Percentage): If you have a wired network, this should be set to 10 (or as low as 2), but some buffer is required. For wireless networks, it may be necessary to set higher values, depending on the reliability of the network for streaming. A value of 10 means 10% of the Target Bitrate will be the size of the Decoder?s Jitter2 Buffer. The typical range is 2 to 25(%). In the case of very poor network efficiency (like over a poor cellular connection), values may have to be increased to 100, 150, even up to 400, but these values will greatly increase latency.

Decoder Network Settings - Jitter1 and Jitter2: are the names of two buffers built in, and they can be manually set (number of packets). Defaults are low, in the 5-25 range. When the Encoder has LDMP enabled, the Encoder will suggest buffer sizes to the Decoder, which compares those suggested values to the values stored in Jitter1/Jitter2 and takes the higher value. So, unless these values are set in the hundreds or thousands, Jitter1 and Jitter2 are likely not being used by anything. In most cases, you can set Jitter1 and Jitter2 to 5 and 10, respectively.

Because the Encoder Pre-Buffer settings are a percentage of target bitrate, and the Decoder Jitter settings use a number of packets as the setting, it?s difficult to compare the two settings. The Decoder?s Info tab will display the current Jitter settings, in packets, during an active stream, having converted from the percentage automatically.