Analysis of SRT Protocol of Public Network Transmission Technology (Part 1)

Author: Zhang Boli

Edit: Alex

▼Scan the QR code in the picture to learn more about the audio and video technology conference▼

picture

Abstract: SRT protocol (that is, secure and reliable transmission protocol) is an emerging network transmission protocol, which is suitable for real-time audio and video transmission. This article will start with the principle analysis of the SRT protocol, try to define an indicator to measure the reliability of the SRT link: link security margin (Secure-Margin), and introduce in detail how to deploy a reliable SRT transmission according to this indicator link, and analyze the parameter adjustment strategy in different live broadcast scenarios.

Introduction

As one of the key technologies in the radio and television field, the audio and video signal transmission technology ensures the safety and quality of transmission. The traditional means of signal transmission may be summed up in three sentences: a star in the sky, a cable underground, and microwaves facing each other in the middle.

"One star in the sky" refers to satellite transmission, which has the advantages of being flexible, safe and reliable and has no special requirements for live broadcast conditions, but its equipment investment and cost are very expensive. "Underground cable" refers to optical fiber transmission, which has the advantages of being safe, reliable and extremely low-latency, but it is very dependent on the infrastructure of optical cable links and has poor flexibility. The "middle face-to-face microwave" originally referred to the directional microwave under the condition of sight-seeing, and later developed the long-distance U-band "large microwave" and the short-distance 2G-band "small microwave". With the rapid development of 5G and Internet technology, it has become a possibility to transmit audio and video signals safely and reliably through the public Internet. In fact, we have another means of transmission: no face-to-face public network transmission.

However, different degrees of packet loss, jitter, delay and bandwidth fluctuation are common in the public Internet, which requires a reliable transmission protocol to ensure the reliability of the transmission link. SRT (Secure Reliable Transport) protocol , which is a secure and reliable transmission protocol, is an emerging audio and video transmission protocol, which has a very good application effect in the point-to-point real-time transmission of audio and video.

Radio and television technicians are used to estimating the reliability of the link through the redundancy of the link. A similar indicator in the satellite link is the C/N margin (C/N margin). The optical fiber link can pass the optical power attenuation and The receiver sensitivity is used to estimate the optical power redundancy. By analogy with these concepts, this article will start from the theoretical basis of the SRT protocol, and try to define an indicator to measure the reliability of the SRT link —Secure-Margin . Then, according to this indicator, the setting steps and strategies of relevant parameters in the SRT protocol are discussed.

1. Principle analysis of SRT protocol

The SRT protocol can provide safe and reliable data transmission in an unpredictable Internet environment, and is currently widely used in the field of streaming media transmission. In theory, SRT can transmit any type of data, but because it is optimized for real-time audio and video transmission, the current main application scenario is point-to-point transmission of real-time audio and video data across the public Internet .

The SRT protocol was originally a private protocol. It was open sourced by the SRT Alliance in April 2017. Due to the protocol's good performance, open source, and flexible applications, more and more manufacturers and devices began to support the SRT protocol. In actual work, high reliability and low latency audio and video transmission can also be achieved by using SRT equipment from different manufacturers, which is very convenient and flexible for users.

1.1 SRT protocol and UDP protocol

Tracing the development process of SRT, we will find that it is improved from the **UDT (UDP-based Data Transfer)** protocol. The SRT protocol retains most of the core concepts and mechanisms of the UDT protocol, while introducing some improvements and enhancements Functions, which mainly include flow control for real-time audio and video, enhanced congestion control, modification of control data, and improvement of encryption mechanism. The UDT protocol was proposed by Grossman. The protocol adds reliability control and congestion control mechanisms to the UDP protocol to ensure reliability. It can effectively utilize the high bandwidth of high-speed wide-area networks to achieve efficient and reliable transmission of files. Since the UDT protocol is mainly suitable for high-throughput file transmission, SRT is mainly suitable for streaming media transmission, so from the application level, the difference between the SRT protocol and the UDT protocol is actually insurmountable.

Aside from the history of the SRT protocol, we can understand it as a streaming media transmission protocol based on the UDP protocol. As we all know, the UDP protocol is an unreliable transmission protocol based on datagrams. It takes improving the transmission rate of data as the main design principle, and can only provide unreliable data transmission services and deliver them with the best efforts.

Figure 1 shows the transmission effect of the bare UDP protocol on the lossy network. In the test, the software Netem is used to simulate the lossy network with packet loss, jitter and delay, and the audio and video signals are source encoded at the source. The output TS stream has a variable bit rate (VBR) and a fixed frame interval, but the characteristics of the output stream after crossing the network have been completely changed, and the fixed frame interval has also changed due to network jitter. In fact, the decoder is very It is difficult to recover normal audio and video signals from such a stream.

picture

Figure 1. Transmission performance of UDP protocol in lossy network

As can be seen from Figure 2, the SRT protocol well overcomes packet loss and jitter in a lossy network environment, and restores the input stream at the output end. A series of mechanisms, such as feedback signal and buffer definition according to the delay amount, realize streaming media transmission under lossy network , in which the automatic repeat request mechanism (ARQ) is used for error control.

picture

Figure 2. Transmission performance of SRT protocol in lossy network

1.2 Automatic Repeat Request: ARQ

Error control methods in digital communication can be roughly divided into two categories: forward error correction (FEC, Forward Error Correction) and automatic repeat request (ARQ, Automatic Repeat reQuest) . Since the 1970s, the ARQ idea has been widely used in various communication technologies and transmission protocols. It has undergone many evolutions since its development. The inventor of the SRT protocol claims that its improvement of ARQ technology can be called the third ARQ technology. leap.

Figure 3 shows the basic idea of ​​ARQ technology. After the receiving end successfully receives the data packet, it transmits a signal (ACK) indicating successful reception to the transmitting end through the feedback channel. Signal required for retransmission (NAK), the sender will retransmit the corresponding unreceived data packet after receiving the NAK signal. Therefore, in addition to requiring the sender to need a retransmission buffer, the receiver also needs a buffer that can store packets in sequence.

picture

Figure 3 Basic idea of ​​automatic repeat request (ARQ) technology

Figure 4 shows the difference between ARQ and FEC. In general, we should choose ARQ or FEC according to the characteristics and needs of practical scenarios . Taking satellite communication as an example, the single round-trip delay of the communication link, that is, the RTT, is about 540ms, and the noise is Gaussian white noise. In this case, the efficiency of using ARQ is very low, and it will also cause a very large delay. FEC became the most suitable choice. Many packet loss and jitter in the Internet environment are sudden, and this environment is more suitable for ARQ technology to work, so SRT initially chose ARQ as the error correction method. With the development and expansion of SRT application fields, the latest version of SRT also adds support for FEC, so as to better adapt to applications in various scenarios.

picture

Figure 4 Comparison of FEC and ARQ links

2. Define the security redundancy of the link (Secure-Margin)

In the live broadcast work in the field of radio and television, the staff are used to estimating the reliability of the link by the redundancy of the link. Similar indicators in the satellite link are the C/N margin, and the fiber link The optical power redundancy can be estimated by optical power attenuation and receiver sensitivity. By analogy with these concepts, this paper tries to define the Secure-Margin of the SRT link from the application level , and gives qualitative and quantitative analysis.

Before discussing the amount of security redundancy, let's first understand the concept of **single round-trip delay (RTT, Round-Trip Time)**: it represents the cost of a round trip between the sender and the receiver. The time can also be understood as the time it takes to go back and forth between two points. The value of RTT is related to the physical distance between two points, and is also affected by the network access method and routing.

It might be possible to express how to configure a reliable SRT transmission link in one sentence: we want to ensure that the usage of the send buffer (measured in milliseconds) is lower than the delay amount, and the usage of the receive buffer is never close zero . The rationale for this statement, which will be detailed below, actually indicates two critical breakdown points in the SRT link, while the SRT link safety margin indicates how much headroom the link has from the critical breakdown point.

2.1 Transmitter buffer redundancy

Referring to Figure 3, the working mechanism of ARQ determines that the sender needs a retransmission buffer, and the receiver also needs a buffer that can store data packets in sequence. On the other hand, the SRT protocol uniformly specifies the maximum usable amount of the sending buffer and the receiving buffer by setting the delay amount (Latency).

The function of the send buffer is to save the data packets that may need to be retransmitted, that is, those data packets that have not received an acknowledgment (ACK), if the sender receives an acknowledgment about a data packet, the data packet will be was kicked from the sender buffer. If the reply ACK signal has not been received, the data cannot be stored in the buffer of the sender forever. The SRT protocol stipulates that the maximum storage time is the delay amount.

Referring to Figure 5, combined with the working principle of SRT, we imagine the length of the delay amount as a window that slides from left to right on the sender and receiver at the same time. The data packets from No. 1 to No. 6 in the figure have been received. The acknowledgment (ACK) has been kicked out from the sender's buffer, and the No. 7 data packet is also kept in the buffer waiting for the receiver's reply. This is a good transmission state, the use of the buffer on the sender side is small, and most of the data has been received in time and an acknowledgment is received.

Referring to Figure 6, the receiver did not receive the No. 3 data packet and replied a negative acknowledgement (NAK) to the sender. Due to various reasons, this process was delayed, resulting in the No. 3 data packet already at the far left of the window. The sliding next step of the window will be kicked from the sender buffer. In this case, if the retransmission of the No. 3 data packet is lost or delayed again, the data packet will be lost, and the image at the decoding end may also have problems. At the same time, we also noticed that the sender buffer in the figure has been filled, which also indicates a transmission state at the critical point of packet loss.

picture

Figure 5 Transmitter and receiver buffers (better state)

picture

Figure 6 Transmitter and receiver buffers (poor state)

According to the analysis, it can be concluded that the less the sender buffer is occupied, the more secure the link is. If the sender buffer is full, the link is likely to lose packets .

According to the working mechanism of SRT, it can be known that the longest time data is stored in the sender buffer is the delay amount (Latency), and the shortest time stored in the sender buffer is the single round-trip delay (RTT) of the link. If the sender buffer is full as the critical collapse point, the sender buffer redundancy SendBuffer-Margin is defined as: the maximum buffer space in a period of time divided by the maximum value of the sender buffer, then The formula is as follows:

picture

It should be noted that we can ignore the occasional short-term spikes in the use of the maximum occupancy of the sender's buffer through the state diagram.

Figure 7 is a monitoring diagram of the sender's buffer on the day of a live broadcast. In the figure, the delay is 125ms, and the RTT is 10ms. The redundancy of the sender's buffer during this period is about 40%. Due to the selection of appropriate parameters through the test, even if the network in the second half of the figure fluctuates, we still ensure a relatively sufficient amount of buffer redundancy at the sender side.

picture

Figure 7 Sending side buffer monitoring diagram

2.2 Receive buffer redundancy

The function of the receive buffer is to sort the received data packets (the SRT protocol records the exact timestamp in the SRT packet header). The sorting is needed for decoding on the one hand, and on the other hand, it is to find out the data packets that have not arrived in time, and send them to the packet. The sender returns a negative acknowledgement (NAK) and waits for retransmission.

Referring to Figure 5, the No. 1 data packet at the receiving end has been sent to the decoder, and the No. 2 data packet will be sent to the decoder as the delay window slides. At the same time, the No. 2 to No. 6 data packets have been stored in the receiving buffer. In the area, the receive buffer is almost filled with packets, which is a good link state.

Referring to Figure 6, this is a poor link state, the receiver does not receive the 3rd packet, and the 3rd packet is at the far left of the receiver's window, which means that the 3rd packet is likely to be skipped, There will be a problem with the decoded image. In this case, there are fewer packets in the receive buffer, which may be due to packet loss or a mismatch between the network bandwidth and the video bit rate.

From this, it can be concluded that the ideal state of the receive buffer should be that its usage should be slightly lower than the delay amount. If the receive buffer usage becomes zero, decoding images are likely to have problems .

According to the working mechanism of SRT, it can be known that the maximum time that the data is stored in the buffer of the receiver should be slightly lower than the delay value (Latency). If the receiver buffer usage becomes zero as a critical collapse point, the receiver buffer redundancy ReceiveBuffer-Margin is defined as: the minimum occupancy of the receiver buffer within a period of time divided by the receiver buffer The maximum value, the formula is as follows:

picture

Figure 8 is a monitoring diagram of the receiving end buffer on the day of a live broadcast. The delay in the figure is 125ms, and the RTT is 10ms. The redundancy of the receiving buffer during this period of time in the figure is about 40%.

picture

Figure 8 Receiver buffer monitoring diagram

2.3 Safety Redundancy of Links

According to the working mechanism of SRT, the buffer states of the sender and the receiver affect each other, and the buffer redundancy of the poorer end actually determines the security redundancy of the link, so the security redundancy of the link is defined. The amount (Secure-Margin) is equal to the minimum value of the sender buffer margin (SendBuffer-Margin) and the receiver buffer margin (ReceiveBuffer-Margin) .

According to the mechanism of SRT and the meaning of the delay amount, in fact, the delay amount and RTT together define the number of times the data packet can be retransmitted. This number is equal to the delay amount divided by the RTT. We can further define the number of retransmissions based on this. The concept of margin:

picture

So far, we have defined the security margin (Secure-Margin) of the link in the form of percentage and number of retransmissions . This indicator represents the redundancy of the SRT link error control capability. It is also from the application level. A target is set for link testing and parameter tuning of the SRT protocol. Understanding the meaning of the security redundancy can help the staff to better understand the buffer state diagram, and use this as a reference to adjust the parameters in a more targeted manner. We also strongly recommend combining this indicator and the buffer state diagram to evaluate the chain together. road safety.

Referring to Figure 7 and Figure 8, it can be observed that the RTT has been relatively stable. Sometimes our live broadcast tasks often do not have such good network conditions. If there is a sudden increase in RTT, the link security redundancy is decreasing, and the retransmission The number of times redundancy is decreasing exponentially. At this time, the security redundancy calculated in percentage cannot truly reflect the change of link security. It is necessary to calculate the number of retransmission times of the link at the same time.

3. Configure the strategy of SRT stream

3.1 Measure the basic parameters of the network link

Before configuring the SRT flow, we must measure the available bandwidth, packet loss rate, and single round-trip delay RTT of our own link, and pay attention to whether these indicators are changing and the scope of the change.

  • Available Bandwidth : The available bandwidth of the link for SRT streams can be measured using the Iperf software.

  • Packet loss rate : Packet loss rate is a measure of network congestion, expressed as a percentage of lost packets versus sent packets. The packet loss rate of the channel drives the SRT delay and bandwidth overhead calculations and can be extracted from the Iperf statistics.

  • RTT : To determine the RTT between two devices, you can use the ping command, if RTT<=20ms, use 20ms as the RTT value. This is because SRT cannot respond to events with time scales smaller than 20ms.

3.2 Setting the delay amount

Latency can be said to be the most important parameter in the SRT protocol , it is a fixed value, and the settable range is 80ms-8000ms. The larger the delay amount, the higher the error control capability of the SRT link, but the total link delay will increase. Selecting an appropriate amount of delay through preliminary testing can help us strike a balance between link reliability and low delay. Table 1 gives the suggested value of delay amount under different packet loss rate and RTT.

Maximum packet loss rate (%) RTT multiplier Bandwidth overhead (%) Minimum delay amount (when RTT<=20ms)
<=1 3 33 60ms
<=3 4 25 80ms
<=7 5 20 100ms
<=10 6 17 120ms

Table 1 SRT parameter setting table

Referring to Table 1, the calculation formula of the delay amount is as follows. If the RTT is less than 20ms, it is calculated as 20ms:

Latency Latency=RTT*RTT Multiplier

The actual meaning of the RTT multiplier in the above formula is the number of retransmissions that the SRT link can complete , and it also represents the error control capability of the link. This is why the higher the packet loss rate, the higher the required RTT multiplier, and the The delay amount is also higher, and the previously defined link retransmission times redundancy can be understood as the number of retransmissions that have not been used yet.

Initially, we configured the SRT link completely according to this table, but after many live broadcasts, we found that the link security redundancy configured according to the recommended value is not necessarily sufficient. A good habit is to test the link in advance, and Combine the safety redundancy and the buffer state diagram to select an appropriate delay.

There are a few other points to note about the amount of delay:

  • When other parameters of the link are fixed, increasing the delay will increase the security margin (Secure-Margin).

  • Latency can be set separately on the encoder and decoder. If the values ​​are different, the higher value shall prevail , which means that reducing the delay parameter only at one end will not take effect. .

  • The delay parameter does not represent the end-to-end delay of the transmission link. To calculate the total link delay, the encoder delay, decoder delay and RTT should also be considered.

  • The transmission link of live broadcasts such as sports games requires very low delay, because the audience definitely does not want to know the goal from the cheers of the neighbors or the circle of friends. We need to weigh the amount of delay and the amount of safety redundancy very carefully. Find a compromise parameter. Take the live broadcast in the above figure as an example. In the case of ensuring sufficient security redundancy, the end-to-end delay is only about 0.8 seconds, which is much smaller than the delay of the satellite link.

3.3 Setting the bandwidth overhead ratio

Bandwidth Overhead is a percentage parameter, and its calculation base is the bit rate of audio and video streams. The default value is 25%, and it is not recommended to exceed 50%. This part of the extra bandwidth allocated by the user is used to retransmit lost data packets, transmit reverse control data and handle congestion, which means that the bandwidth overhead ratio is also closely related to the error control capability of the link. Losing one packet consumes about 400bps of available bandwidth at the receiver.

Figure 9 is an extreme case of a collapsed SRT link that can be used to understand the role of bandwidth overhead. After the link crashes, the buffer data will temporarily fill the decoder's continuous demand for data. After the link is restored, the extra bandwidth overhead will make up for the previous consumption of the buffer data. After an emergency, the entire SRT link will return to normal.

picture

Figure 9 Schematic diagram of bandwidth overhead

There are a few things to note about bandwidth overhead:

  • Referring to Table 1 , the minimum value of the bandwidth overhead ratio under different packet loss rates can be found, which can be slightly increased according to the link status.

  • The calculation base of bandwidth overhead is the total bit rate of video + audio + metadata + other auxiliary data, which should be paid attention to when estimating.

  • After the encoded stream bandwidth is determined, the required available link bandwidth can be calculated by _stream bandwidth*(1+bandwidth overhead)_. In practical applications, it is recommended to add some available link bandwidth on this basis to combat fluctuations , the recommended value is ** stream bandwidth*(1+bandwidth overhead)*1.33 **. Taking HEVC encoding 4K signal as an example, if the encoded TS stream is 40Mbits and the bandwidth overhead is 25%, the recommended available link bandwidth should be above 67Mbits.

  • Referring to Figure 9, area A and area B must be equal. In fact, the network interruption time that the SRT link can tolerate is _delay amount * bandwidth overhead_. Live broadcasts such as variety shows or government meetings are not sensitive to delay. Consider taking full advantage of the two parameters of delay and bandwidth overhead to greatly enhance link reliability. Assuming that we set the delay to 8000ms and the bandwidth overhead to 50% in this case, even if the network is interrupted for 4 seconds, it will not affect the normal operation of the SRT link. This feature of the SRT link is even a satellite and fiber link. None are available.

concluding remarks

In recent years, the development of the SRT protocol in the field of radio and television has shown a trend of multi-point flowering, and it has a wide range of applications in live broadcast, remote production, upstream push streaming, and international long-distance transmission. In the process of actually deploying the SRT link, a large amount of testing work is essential in the early stage. During the test, the security of the link can be judged by observing the security redundancy and the buffer state diagram.

The next part of "Analysis of SRT Protocol of Public Network Transmission Technology" will analyze the operation mechanism and principle of SRT protocol from the perspective of SRT data packets, and demonstrate how to capture packets and troubleshoot through Wireshark, so stay tuned.

references:

1. Haivision.SRT Protocol Technical Overview[M/OL].(2018-10) [2022-02].www3.haivision.com/srt-protocol-technical-overview.

2. Yunhong Gu,Robert L.Grossman.UDT:UDP-based data transfer for high-sspeed wide area networks[J].Computer Networks,2006,51(7):1777-1799.

3. Haivision.SRT Open Source White Paper[M/OL].(2019-1) [2022-02].www3.haivision.com/srt-open-source-wp.

4. SRT Alliance. SRT Deployment Guide,v1.1,Issue 01[M/OL].(2018-10) [2022-02].www3.haivision.com/srt-alliance-guide.

About the Author:

Zhang Boli, engineer of Anhui Radio and Television Station.


picture

{{o.name}}
{{m.name}}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324118277&siteId=291194637