Background

I’ve been dealing with a lot of clientslately, many of them do safety products, some involve military logistics. Theygenerally pay much attention to acquisition delay, coding delay, transmissiondelay and so on. For example, there was a client who did anti-sniper detection,which was life related, and there was no room for trial and error. (PS:I can’tjudge whether the Hi3531D/Hi3521D series products are suitable for this kind ofhigh-real-time products. Of course, it is completely possible to make anevaluation or algorithm verification.)

Measuring method

The precise measure of delay is measuredwith specialized instruments, or record accurate time in the program todetermine. These methods are too professional and inconvenient to display, themeasurement method adopted in this paper is visual measurement method, which isnot precise but the easiest to show.

The picture above:  Generally, livebroadcast is through collection, coding, network output, network reception,decoding and display output. Only after these several major links, can the userget the picture of live broadcast. The total delay is T1-T3, the collectiondelay was T1-T2. The delay of live broadcast is also related to networkprotocols, among which UDP, RTMP and RTSP have relatively small delay, whileHTTP has relatively large delay, and HLS has the largest delay. This technique,called slicing, is very suitable for network broadcast which requires littledelay (For example, one-way live broadcasting, IPTV is this kind), One of thebiggest benefits of this technology is its ability to maintain smoothperformance in environments where network bandwidth fluctuates greatly (It’sbecause the buffer is big enough). Take advantage: HLS was invented by apple,and it’s no wonder that the iphone’s network signal is obviously worse thanthat of its peers.

Test result

In order to capture T1,T2 and T3, weused the fast continuous shooting function of DSLR camera to capture theprotocol of each UDP, RTSP and RTMP.

As shown above,The time code displayed by the notebook as the signal source is 19:35:55.217,and the time code displayed by the collection preview of the coding board isalso 19:35:55.217, indicating the collection delay is 0 and ignored.The decoderboard receives the network stream from the coding board through the network,and outputs the decoder through HDMI. The time code displayed is 19:35:55.174,which means the delay is 217-147=70, that is, the delay is 70 milliseconds.In order to facilitate users’ viewing and comparison, we recorded the time codesof the photos we took, and calculated them with EXCEL, as shown in the following table.

As can be seen from the table above, UDP(TSencapsulation) has an average latency of 71 milliseconds. Since our TSencapsulation uses FFMPEG for packaging, so the packaging delay is large.If RAWH264/H265 UDP is used, the estimated latency is greatly reduced.RTSP OVER UDPhas an average latency of 83 haps, I don’t know why the delay is so big. Thelatency of RTMP is only 52 milliseconds, which is a bit of a surprise, and thelatency of each sample is almost always around 43 milliseconds, which is veryuniform, unlike TS-UDP and RTSP OVER UDP, the latency data measured by eachsample fluctuates slightly.

Source program

Source of code side

Source of encode side

The sequence of pictures captured

To make it easier to read, here are 3 images captured from each network protocol.

TS over UDP

RTSP over UDP

RTMP