Streaming media push and pull

1. Push flow and pull flow

Why can users quickly see the information on the live broadcast through mobile phones or websites? Why sometimes the network is unstable and the live broadcast effect is delayed? How is the live video signal transmitted to the network?

All of these problems are inseparable from two words often used in live video: push and pull.

In fact, it can be briefly understood that streaming is the live broadcast end, and streaming is the client.

1.1 Streaming

Stream push: The process of pushing live content to the server. That is, it refers to the process of transmitting the packaged content in the collection phase to the server. In fact, it is the process of transmitting the live video signal to the network. "Push streaming" has relatively high requirements on the network. If the network is unstable, the live broadcast effect will be poor, and the audience will experience freezes when watching the live broadcast, making the viewing experience very bad. If it is to be used for streaming, audio and video data must be encapsulated using a transport protocol to become streaming data. Commonly used streaming protocols include RTSP, RTMP, HLS, etc. The delay of RTMP transmission is usually 1–3 seconds. For mobile live broadcasting, which requires very high real-time performance, RTMP has also become the most commonly used streaming in mobile live broadcasting. protocol. Finally, the audio and video stream data is pushed to the network through a certain Qos algorithm, and distributed through the CDN.

1.2 Streaming

Streaming: Refers to the process in which the server already has live broadcast content and uses the specified address to pull it. That is to say, there are streaming media video files in the server. These video files are read according to different network protocol types (such as RTMP, RTSP, HTTP, etc.), which is called streaming. To put it simply, you watch Youku video It can be regarded as streaming. Video files are stored on Youku’s server. You use the HTTP (or RTMP/RTSP) protocol, that is, to obtain video viewing in the form of a web page. This is the process of streaming. There are three steps in this process: Three elements: 1-server [provide the place where the video file is stored] 2-transmission protocol [that is, how you want to transmit the video] 3-read terminal [that is, how to play it out]

1.3 The difference between push flow and pull flow

The user finally sees a live video, which may be achieved in two ways. One is to actively transmit the content to the server and cache it on the edge node. The end user can call and watch it at any time. This is push streaming; When you want to watch a certain content, you need to fetch the content from the source server and cache it to the edge node, which is pulling the stream.

Take a simple example:

As a courier company, there are courier companies in various districts, so I provide two services:

Streaming service: that is, door-to-door pickup

Streaming service: because you are afraid that the courier will have unreasonable ideas, you choose to send the item to the courier company in the community

2. Schematic diagram

insert image description here
insert image description here

3. RTMP transmission protocol of streaming media protocol

There are many transmission protocols in streaming media, one is introduced first, and others can be easily understood by referring to this protocol.

RTMP is an acronym for Real Time Messaging Protocol. A network protocol designed for real-time data communication.

Each streaming code address uniquely points to a single live event. It starts with rtmp://, contains the upload server address, upload directory name and upload node, and consists of three parts. All rtmp addresses are composed of this structure. Basically, the first two parts of the addresses of different live broadcasts on the same platform are unchanged.
insert image description here

4. Streaming media protocol and format

insert image description here

Guess you like

Origin blog.csdn.net/m0_38127564/article/details/130989365