Detailed explanation and optimization of the reasons for the freeze in live broadcast

With the development of live video streaming, many live streaming teams may encounter live video freezes, frequent buffering flags, or live video clips. What are the reasons for the lag in live video viewing?

In combination with practical experience, I also made an anatomical analysis of the problem and solution of the stuck live broadcast from the three aspects of equipment, video stream and network.

The reason for the live video freeze

The main reasons for the freeze of live video are equipment, video streaming, and network problems.

Troubleshooting and Solutions

equipment

High-definition video often brings decoding pressure to the hardware, and the freeze caused by decoding is particularly obvious. At the same time, if the version of Flash Player on the PC or the playback software on the mobile terminal is too low, it may also cause decoding problems and cause the playback to freeze.

If this is the reason, the solutions are as follows:

  • Upgrade hardware and software equipment to improve compatibility and fault tolerance;
  • Use hard-coded hard-solutions to take full advantage of GPU acceleration;
  • Reduce the video bit rate and choose smooth or standard definition quality for video playback;
  • Increase the buffer of the player to alleviate the lag caused by unstable network or decoding.

video stream

Audio and video timestamps are out of sync

In the live broadcast, when the audio and video time stamps are different, it will affect the rendering of the screen, causing problems in the screen parsing, resulting in the phenomenon of one card and one card. When there is confusion in the picture, the connection between the front and rear pictures will be discontinuous or even blurred.

△ Audio and video out of sync

In response to such problems, we need to study the source code of the streamer, check and analyze the time stamp of each audio and video that is read, and then interfere with the streamer or streaming media server through the program to correct the logic value. , so that the audio and picture are synchronized.

Video stream parameter configuration problem

If the frame rate of the video is set too low (the frame rate is the number of pictures per second), according to the principle of human eye persistence, the number of pictures per second must reach a certain value for the human eye to watch continuously and effectively. As a result, the encoding method of the video stream is incompatible with the transmission server, and some audio and video data are parsed incorrectly or even cannot be parsed, and the video stream playback is also stuck.

If this is the reason, the solutions are:

  • Set reasonable bit rate, frame rate, resolution, key frame interval, audio and video encoding format and other parameters;
  • Follow the standard video encoding scheme and streaming media transmission protocol as much as possible to capture, encode, decode, and play video streams.

network

There are currently three types of live broadcast networks: wireless, wired, and 4G.

Wireless network: The live broadcast of WIFI connection is affected by factors such as distance and environment. It is necessary to keep the device as close as possible to the WIFI signal source, avoid passing through walls or metal objects, maintain the signal strength, and the bandwidth is more than 6M, and avoid other devices from accessing the WIFI signal source preemption signal;

Wired network: The live broadcast venue has a dedicated network port, preferably a dedicated line network, with an uplink and downlink bandwidth of not less than 4M;

4G network: The mobile phone network is greatly affected by the surrounding environment. It needs to be in a place with good mobile phone signal and to prevent network fluctuations. It is best to choose a 4G card during live broadcast.

upload network

When the network on the host side is poor, the upstream of the push stream side will be unstable. At this time, you can pass the speedtest

The post Live Streaming Caton Reasons and Optimizations first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9637
This site is for inclusion only, and the copyright belongs to the original author.