RTMP and RTSP are two common streaming protocols. So what is RTMP? What is RTSP? What is the difference between them? How should we choose between them? What is a streaming protocol?Streaming Protocol, whose English name is Streaming Protocol, can be explained in simple terms: Streaming Protocol is a protocol used to deliver multimedia over the Web. Every time you watch a live or on-demand video, the technology behind it is a streaming protocol. There are many streaming protocols, which can be divided into three categories:
Traditional video streaming protocolsTraditional video streaming protocols mainly include:
HTTP-based adaptive protocolThe main adaptive protocols based on HTTP are:
New TechnologyThe new technologies mainly include:
What we are going to introduce and compare today are the traditional video streaming protocols: RTMP and RTSP. TCP and UDPBefore discussing RTMP and RTSP, we need to understand TCP and UDP first, because RTMP is developed based on TCP, and RTSP uses UDP. TCPTCP English full name: Transmission Control Protocol, Chinese meaning: Transmission Control Protocol. The TCP protocol is a transmission control protocol located between the application layer and the network layer, which is used to provide reliable stream transmission services, that is, transmitting data in the form of byte streams and receiving data in the form of byte streams. TCP uses a confirmation mechanism to check whether the data has arrived safely and reliably, multiplexing it at the sending end and demultiplexing it at the receiving end. TCP uses three stages to implement connection-oriented functions, such as connection establishment, data transmission, and connection termination. UDPUDP English full name: User Datagram Protocol, Chinese meaning: User Datagram Protocol. UDP is a connectionless protocol, i.e., it transfers data from one end to another; without establishing a connection. UDP also sits between the application layer and the network layer. It also delivers data or information in the form of packets; these packets are called user datagrams. UDP uses multiplexing to handle outgoing user datagrams from multiple processes and demultiplexing to handle incoming user datagrams going to different processes on the same host. Differences between TCP and UDP
The above is the most basic part. Now I will get into today’s topic: RTMP and RTSP protocols. RTMP
RTMP was born in 2005, developed by Macromedia and later acquired by Adobe, and has a long history in the streaming market. It was originally used to transmit data between RTMP servers and Flash players on user devices, but Flash officially ended in 2020. The biggest advantage of RTMP is that it can maintain a stable connection between the server and the client server, and it can perform seamless low-latency streaming regardless of the quality of the user's Internet connection. This technology is mainly achieved by dividing the data stream into equal small parts (audio data defaults to 64 bytes, video data defaults to 128 bytes) and transmitting them sequentially to the receiving device, and then reassembling them into a video stream. How RTMP worksGenerally speaking, video streaming works like this:
RTMP plays a very important role in this link. In the process of video from the camera to the server, RTMP divides a large amount of data into small blocks and transmits it across multiple virtual channels, providing a stable and smooth video stream between the video source and the RTMP server. The biggest disadvantage of RTMP is that it is not compatible with HTML5 players, so another protocol such as HLS must be used to transmit the video file to the user's device. In addition, RTMP is susceptible to bandwidth issues. RTSP
RTSP was born in 1996 and was jointly developed by experts from RealNetworks, Netscape, and Columbia University for entertainment and communication systems that control VHS-style video streams. RTSP uses the efficient RTP protocol to break stream data into smaller blocks, which can be delivered faster. RTSP supports reliable segmented streaming, which means that users can continue to watch the stream while it is still downloading. Android and iOS devices do not have RTSP-compatible players out of the box, so RTSP is not widely used, but RTSP is widely used in many surveillance and closed-circuit television (CCTV) applications, such as remote cameras, online education, and Internet live broadcasts. As mentioned above, RTSP uses the RTP protocol to decompose video blocks. Here we will talk about the RTP protocol. RTP protocol, the full English name: Real-time Transport Protocol, is the real-time transport protocol in Chinese. Its underlying layer is actually UDP, which can achieve low latency. In addition to the RTP protocol, RTSP uses two other network communication protocols to ensure smooth and consistent streaming:
How do you understand this? TCP reliable transmission, for example, when the user presses the play or stop button, this is an accurate request, which needs to ensure reliability. This is when the role of TCP is reflected. UDP is a low-latency protocol, so it can be used to transmit audio, video, and data very efficiently. How RTSP works
Because RTSP relies on dedicated servers and is dependent on RTP, the protocol does not support encrypted video content or retransmission of lost packets. Differences between RTMP and RTSP1. Delay RTMP: 3-30 seconds RTSP: 2-5 seconds 2. Audio Codec
3. Video Codec
4. Advantages
5. Disadvantages
How to choose between RTMP and RTSP?In fact, after reading the difference between RTMP and RTSP, you should have an insightful understanding of the usage scenarios.
SummarizeThis article mainly introduces streaming media protocols, TCP and UDP protocols, RTMP and RTSP protocols. Both RTMP and RTSP streaming media protocols have their own advantages. RTMP provides compatibility with different ingest devices and stability for low-latency streaming, however, you need a specific Flash Media Server to distribute your content using RTMP, so RTMP is suitable for major third-party streaming applications and older hardware encoders; RTSP is best used with IP cameras and devices running IP cameras, such as drones. Friends, do you understand? |
<<: Let’s talk about what communication is.
>>: How can Wi-Fi positioning technology survive in a field full of strong competitors?
As a member of the Internet, we are often immerse...
According to foreign media CNET, Sir Tim Berners-...
In addition to the New Year purchasing activities...
The networking industry is changing rapidly, and ...
1M, as the lowest bandwidth configuration of clou...
The rapid development of new cloud-based applicat...
The 5G platform provided by operators has vulnera...
Intent-based networking (IBN) has been a topic of...
The United States is increasingly anxious and str...
This article is reproduced from the WeChat public...
[51CTO.com original article] At the beginning of ...
CloudCone is a foreign hosting company founded in...
Have you noticed that many apps now have a line o...
In 2021, the Internet industry has emerged with m...