The concept of streaming media has been around for nearly 10 years. Intuitively, streaming media is the media that can be downloaded and played. Now, Internet users all have this experience, such as watching podcast short videos and PPLIVE. They all download and play videos. In fact, these are not real streaming media. You may be surprised to see this conclusion, but after reading this article, you will understand it.
First, let's take a look at the whole process from making to playing streaming media.
What kind of source data is required for streaming media? Almost any data, files such as avi and RM on hand, or even tapes, or analog signals just obtained from the collection device.
How to deal with source data? First, if it is a analog signal, it is necessary to convert it into a digital signal (live broadcasting usually converts the analog signal just acquired into a digital signal), and then encode it according to the desired bit rate. Encoding requires an encoder, that is, codec. If you need an encoder, you can see the format of the file you want. Currently, there are three popular streaming media formats: quick time, Windows Media Technology (WMT), and real system. Three formats belong to different companies: quick time is from Apple, and I don't know what the suffix is, because it is not often used; WMT is from Microsoft and generally uses ASF as the suffix; real System is a real company. This format is the most widely used, and RM and rmvb files are very common. Encoding to a certain format also depends on whether the server software supports this format on the server. The client player must also support this format of playback before streaming.
After a streaming media file is generated by encoding, the Streaming Media Server needs to transmit the media, mainly to encapsulate data packets using a specific streaming media protocol.
Before listing the streaming media protocols, let's take a look at two common transmission protocols: TCP and UDP. What is the difference between streaming media data transmission and file download data transmission? The transfer protocol is different. The file download uses the TCP protocol and the TCP protocol. Before data transmission, a connection must be established. After data transmission, the connection will be disconnected. TCP supports re-transmission to ensure data integrity. Therefore, as long as the download is complete, the files downloaded to the client are the same as those on the server, and some data will not be lost. Streaming media cannot use the TCP protocol, because the TCP retransmission mechanism cannot meet the time requirements of streaming media. for streaming media, packet loss will not be more serious than video interruption. Streaming Media uses UDP protocol. UDP is a connectionless protocol without re-transmission confirmation. After a UDP packet is sent, it does not need to wait for confirmation from the receiver. Although some data may be lost, it ensures real-time performance. In some cases, the streaming media transmitted over UDP has to be converted to TCP transmission. What is the situation? If you are an intranet user or a company firewall, you can only receive data through TCP, because UDP packets will be rejected by the firewall. However, this TCP connection will not be retransmitted even if packet loss occurs.
Streaming media data needs to be encapsulated by the Streaming Media Protocol. The Protocol used varies depending on the format. Famous streaming media protocols include RTP, RTSP, RDP, and MMS. Based on UDP, RTP extends the sequence number and time stamp fields. RTSP is an extension of the RTP protocol. When transmitting data, the RTP protocol is used. When transmitting control data, TCP connections are used. RDP is an extension of RTSP, but only strengthens the control protocol. Quick time transfers media files using RTP/RTSP, while real system transfers media files using RTSP/RDP. MMS is a dedicated protocol for Microsoft. At the beginning, mmsu is used to establish a connection (combination of MMS and UDP). If the connection fails to be established, it is switched to mmst (combination of MMS and TCP) establish a connection. WMT uses MMs to transmit media files.
If there is no Streaming Media Server, can it achieve the effect of downloading and playing? The answer is yes, just use the HTTP connection on TCP. First, download some data to the buffer zone, and then download new data to the buffer zone, while playing the existing data in the buffer zone. This type of stream is called an HTTP stream or a false stream. This is back to the problem we mentioned at the beginning. The podcast short films and PPLIVE programs we see are actually HTTP streams rather than the real streaming media.
What is the difference between HTTP streams and real media streams? There are many differences: (1) first, let's look at the server. Http streams only need web servers, while real media streams need dedicated media servers. (2) Let's look at the protocol again. The Protocol required by the HTTP stream is IP, TCP, and HTTP, while the real media stream requires IP, UDP, and dedicated streaming media protocols. (3) also, because the HTTP stream uses a TCP connection, the packet loss will be re-transmitted, and the Real Media Stream will not be re-transmitted. This is also the reason. If we leave out the impact of interruptions and so on, we can see the same video quality as the video quality on the server through the HTTP stream, but through the real media stream, the quality varies with the network conditions. (4) In terms of startup latency, the startup latency of an HTTP stream depends on the network connection status and media bit rate. The actual startup latency of a media stream is no more than a few seconds. (5) When you watch an HTTP stream, you can only drag it within the range of the downloaded video, and the real streaming media can be dragged within the range of the whole video. (6) At last, the HTTP stream stores the downloaded media data to the hard disk, but the real media stream does not. The data played by the HTTP stream is discarded immediately, this protects the copyright of media works.
Streaming Media Overview