October 3, 2022

I see small squares... What should I do?

When broadcasting video using the SRT protocol, you can see such a phenomenon as the spillage of the image, as in the example below.
In this article, we want to explain where this comes from and how to avoid it.
As you know, the SRT protocol is based on UDP and theoretically allows for packet loss. It is the loss of packets that causes the spillage of the image.

There are 3 terms introduced in the SRT: Lost, Drops and Latency.

Lost – it is a lost packet. The SRT mechanism tries to find the lost packet, but it cannot do this forever. The Latency parameter just sets the time during which SRT tries to find this packet.

If the package has not been recovered after this time, it is marked as hopelessly lost (Drops). It is the occurrence of Drops-packets that leads to the spillage of the image.
For example: you see that you had 5 million Lost packets and 0 Drops in an hour of broadcasting. This means that SRT was able to recover all the lost data and of course this means that the image will be free of spillages. If the statistics shows you that the number of Drops packets is growing, this is a reason to increase the Latency parameter.

For example, in the image below you can see the result when the Latency is small and when it is increased.

Where to set the Latency value

You can set the Latency value both on the encoder and on the server. At the beginning of the broadcast, SRT will choose a value that will be greater.

What value of Latency to set

According to the SRT documentation, Latency is calculated as 2*RTT. RTT is measured using the Ping command, i.e. using the Ping command, you measure the time it takes for a packet to travel from an encoder to a decoder. Unfortunately, it is not always possible to use this command. Therefore, the Latency parameter must be fitted together. We recommend setting Latency to 300 mc (with a good connection) and 2000 mc (with an average connection).

Please note that in our "free" encoders there is a special mode for measuring SRT speed. For example, in the StreamToStudio mobile app, it looks like this:

Conclusion:

SRT, unlike RTMP, allows the user to determine the degree of compromise between image quality and transmission rates. The spillage of the image when working with SRT is not the error of SRT or encoder. This is just a signal that the Latency setting needs to be adjusted.

Additionally:

  • Other articles of interest can be found here.

  • Download SRT Mini Server and our other products here.

  • Instructions for installing and using SRT Mini Server help.