CDN Encyclopedia Lecture 4 | How to "stall" gracefully on the cloud-the technology you have to pay attention to for live broadcast

Posted Jun 27, 20205 min read

Recently, national policies have begun to encourage the land-economy economy . For a time, various enterprise platforms have launched land-ease support policies. The concept stocks of land-economy have soared, and the ecological and supporting commodities of land-economy have begun to become popular. Various new technologies have emerged even on the Internet. The quick guide for stall owners", trillions of pyrotechnics economy has already taken off.


In fact, some people have already set up a booth on the Internet, that is, live streaming! Affected by the epidemic, offline entities have shut down, and live broadcasts have been unprecedentedly sought after. Companies have chosen to use live broadcasts to enhance their brand image, maintain interaction with users, and complete product sales.

So the question is, what technologies do you need to pay attention to in the process of building a live broadcast platform or application? What role does CDN play in live broadcasting?

What is included in a live broadcast system?

Generally, the entire live broadcast system may include:the push stream end is accelerated by an edge node to push the live video stream to the live broadcast center, where a series of transcoding, screenshots, recording, watermarking, etc. are completed in the live broadcast center, and then the video stream passes through the CDN Distribute and distribute to different players. There are different SDKs on the player to perform optimization actions such as seconds on and weak network.

Pushing and playing in the live broadcast system

For live video, the two most important links are push streaming and broadcast. Push streaming generally adopts RTMP protocol, and commonly used streaming terminals include OBS, mobile APP, and FFmpeg. In addition to the RTMP protocol, HTTP FLV and HLS protocols can also be used for playback. RTMP and HTTP FLV are streaming transmissions, and HLS is an accelerated file transmission. Common playback terminals include:Flash/VLC/HTML5/Mobile App and so on. For the Alibaba Cloud live broadcast system, most live broadcast distribution is completed through streaming, and only a small amount is completed using files to speed up the distribution.

CDNWiki 4-2.png

Streaming distribution and CDN live broadcast system

In fact, in the live broadcast scenario, whether it is streaming or broadcasting, streaming distribution is always connected, a live broadcast may be 5 hours, and the push flow will not be interrupted within these 5 hours. As far as the player is concerned, what the server obtains is audio and video data frame by frame, no matter what the transmission protocol is, it is encapsulated by FLV tag. Each frame of audio or video will have a timestamp attribute.

The live video stream transmits audio frames and video frames. For audio frames, each frame can be decoded independently. After the player obtains any frame of audio from the server, it can be rendered independently and the sound can be heard. The video is divided into video key frames and non-key frames. The key frames can be decoded and rendered independently. The player can directly see the picture after getting it, generally more than 10K or even tens of K; other non-key frame decoding depends on some previous video frames , The player will decode the previous frame and this frame to generate a picture, the general size of non-key frames is a few K or less than 1K. For the player, the server generally starts to send the video key frame, so that there will be no flower screen.

For the content stored on the live broadcast server on the node, if the file is accelerated, the content stored on the node is very clear, that is, the file data. If the URL is unchanged, the content of the file data will also be unchanged. But for live broadcasting, the frame data is transmitted, and the buffered frame sequence data is constantly changing.
As you can see in the figure below, the current server caches five frames of V1-V3 data. When the key frame of V4 appears, the server discards the previous one and begins to cache the audio and video data starting from V4. This strategy ensures the playback over The end is the current latest data. Generally, the live broadcast server uses this strategy to cache the server.

CDN Wiki 4-3.png

Challenges for live streaming platforms?

  1. As mentioned earlier, the live broadcast system includes various environments such as streaming, transcoding, distribution, and playback. It has experienced a long and complicated network environment, especially when the business scenarios are gradually enriched, and the functional requirements are also increasing.
  2. The improvement of some key indicators, such as:stuttering rate, opening speed, fluency, and return-to-source rate, etc. Any decrease in the indicators may cause a decrease in the user experience of the entire application, affecting the live broadcast effect
  3. Live broadcast platforms often face business bursts, with hundreds of thousands or even millions of users online at the same time, which poses a huge challenge to servers and bandwidth

Why should I use CDN for live streaming platforms?

1. Reduce the stuck rate and improve user experience

Live broadcasts, especially e-commerce live broadcasts, are very sensitive to network jitter. If there are any problems, problems such as freezes and flower screens will occur, which will seriously affect the user experience and even directly drop the line to affect sales. The CDN can push the content to the edge nodes close to the user through the load balancing system, so that the user can obtain resources nearby, which can greatly improve the access efficiency.

2. When the peak of business comes, escort for the peak of traffic

In order to ensure the smoothness of live broadcasting, CDN nodes and precise scheduling systems with global coverage are indispensable. CDN nodes adopt a distributed architecture, and node resources and bandwidth reserves represent the magnitude and breadth of users that can be covered. When the burst peak is particularly high, the CDN system will ensure more accurate scheduling strategies, such as DNS and IP scheduling, to reduce the impact on live broadcast. For example, there is a cup with a lot of ice cubes and water. If we want to use all the small space in the cup, we must put the ice cubes in first and then pour the liquid water. In the context of intelligent scheduling, the combination of "solid" and "liquid" can be considered to achieve precise control of all nodes and water levels and achieve more precise scheduling.

Therefore, choosing a node and a wide range of bandwidth resources, comprehensive strength, guaranteed quality, and CDN service providers with best practices for large-scale projects are critical to live delivery platforms. If you want to open the "land-economy economy" on the cloud, Alibaba Cloud CDN, find out~

Alibaba Cloud is rebuilding at full speed in the middle of the year, and many products such as CDN/total station acceleration, live video, and video on demand have launched limited-time discounts. [Click on the event page for details of the discount]( /activity/618/index?tabid=wangluo)

Click to review the first lecture of CDN Encyclopedia. Has your app crashed recently?
Click to review the second lecture of CDN Encyclopedia. If CDN is not used, what will the online world become?
CDN Encyclopedia Lecture 3:If I use a cloud server, do I need to do CDN acceleration?

[CDN Encyclopedia]In the column, we will continue to popularize CDN knowledge, interpret CDN practice, and share CDN cases. If you are also concerned about CDN and use CDN, please leave a message to reply to the topic you care about. If you are selected, you will have the opportunity to get Alibaba Cloud ET doll One, free shipping!