Transferred from: http://www.zhihu.com/question/20621558 Yang Hua
Links: http://www.zhihu.com/question/20621558/answer/15661190
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
As a field of expertise, I decided to update this answer.
Copyright reserved, not commercial, reprint must be at the beginning of the location of the author, source.
With the impression of completion, errors and omissions in the place, but also please correct them.
----
Video-related protocols have many, different companies, and even have their own protocol standards. This article tries to cover the current common video-related protocols.
1,RTSP/RTP/RTCP Protocol Family
This protocol family is the earliest video transmission protocol. The RTSP protocol is used for video-on-demand session control, such as the setup request to initiate on-demand requests, play and pause requests for specific playback operations, and the video jumps are supported by the parameters of the play request. The RTP protocol is used for the transmission of the specific video data stream. The C in the RTCP protocol is the meaning of control, which is used for control over the video stream data, packet loss or bitrate.
The protocol family RTSP is based on TCP, RTP, RTCP based on UDP. However, it is also possible to transfer RTP and RTSP together on the same TCP connection in a interleave manner.
The RTSP protocol family is the first to be raised, so many of the considerations of the place, are also with early features. For example, the use of UDP, considering the efficiency of transmission, as well as the video protocol itself on the packet loss has a certain degree of tolerance. However, the UDP protocol obviously cannot be used for larger networks, and the penetration of routers under complex networks is also a problem.
From the video point of view, the advantage of the RTSP protocol family is that it can control the video frame, so it can carry high-real-time applications. This advantage is the biggest advantage relative to the HTTP approach. The low-level video conferencing protocol, the lower level generally adopts RTSP protocol. The complexity of the RTSP protocol family is mainly concentrated on the server side, because the server side need to parse video files, seek to specific video frames, and may also need to perform speed play (that is, the old DVD with the kind of twice times, 4 times times the function of the speed play), the double play function is the RTSP protocol unique, Other video protocols are not supported.
Disadvantage, is the server-side complexity is also relatively high, the implementation is more complex.
2,http Protocol
HTTP video protocol, mainly after the popularization of the Internet. The need to watch video on the internet formed.
2.1
The original HTTP video protocol, nothing special, is a generic HTTP file progressive download. The essence is to download video files, and the use of the video file itself is characterized by the presence of header information, and part of the video frame data, it can be decoded playback. Obviously this method needs to put the header information of the video file in front of the file. Some, such as the FastStart tool, are dedicated to this function.
But in the most primitive state, the video cannot be fast-forward or jump-broadcast to the part where the file has not been downloaded. At this time, the HTTP protocol was put forward with range-request requirements. This is supported by almost all HTTP servers. Range-request, which is the partial data for the request file, specifies the number of offset bytes. After the video client resolves the video file's head, it can determine the location of the corresponding frame of the subsequent video. or according to the rate and other information, calculate the corresponding position.
2.2
Support HTTP range-request server, currently can support our general network to see the requirements of video. However, this approach does not support real-time video streaming, or quasi-real-time video streaming. Because of the video stream, there is no concept of a video file. The advantage of the HTTP protocol for video playback is simplicity. With a common HTTP server, you can provide services, do not require a specialized type of server, and do not require a special network port, through the router firewall is not a problem. You can also use a common CDN to simplify the deployment and distribution of video and reduce the use of bandwidth.
This is currently used for
PC-side or web-side, VOD service, the most common solution。 The implementation of the client, generally using Flash, Flash is the Videoplayer or Videodisplay control can be completed. Resources are generally in FLV format or in MP4 format.
On this basis, a number of companies have introduced their own solutions.
2.3 HLS HDS MSS DASH
Apple's launch of the HTTP Live streaming is one that has been widely used with the popularity of Apple devices. From the noun can be judged, HLS support live live video transmission. HTTP uses m3u8 as an index file and video as a fragment file in mpeg2-ts format. If the video stream is live, update the m3u8 file to update the video index list to achieve the video broadcast. But this method, because the final video is a fragment file, so there must be a delay in fragment video length. Therefore, it can only be used for quasi-real-time video streams where real-time requirements are not so high. However, HLS method, because the use of the earlier Mpeg2-ts format, the format of the overhead, that is, the head information occupies a larger proportion of the total file, that is, the efficiency is not high. The reason for not using other formats is primarily commercial competition and copyright issues.
Accordingly, Adobe Company, introduced similar HTTP dynamic streaming. The essence of this approach is similar to the HLS strategy, that is, by indexing the file + video clip mode. But obviously the index format and video fragment format are not the same. HDS uses the video format as FLV or F4V, and the index format is unclear.
Similarly, Microsoft has introduced the Microsoft Smooth streaming, also known as MSS Video Broadcast mode, the use of video format is segmented mp4 format.
The MPEG Standard group introduces the dynamic Adaptive streaming over Http,dash. The video format is 3GPP.
Obviously, this is now a flourishing state, although the most commonly used is HLS, who called Apple so domineering. There are limits to flash on Android and Apple, and HDS is Adobe's launch on the Adobe platform. MSS, only seen in a few places. Dash, at present, is only the product of the paper.
The above agreement, mainly to solve a problem, is adaptive bitrate switching, the above dynamic,adaptive are similar meaning. The main is to use the index file at the same time to give different bitrate video file address, so that the player side, according to the bandwidth situation, adaptive selection of different bitrate video files.
At the same time in the video broadcast, in addition to the Android and iOS platform, there are many video server vendors, their own development protocol, generally used in the way of fixed-time fragments of the FLV file (using FLV, because the flash play above)
2.4 HTML5
At the same time, the HTML maker is not lonely, introduced HTML5 this way, in essence, and the previous HTTP video protocol without any difference. However, the player side is no longer dependent on specific plugins such as Flash, or other playback software, but can support the direct video playback of the browser. The video tag is embedded in the HTML, and the URL is directly indicated. However, different browsers, for audio and video format support is not exactly the same. The more common is the video H. 264 format, audio AAC format, package format MP4.
2.5 Other
On the basis of the HTTP protocol, companies, for their own business features, may also develop their own proprietary data formats, or protocols. But all of the above-mentioned basic to make some minor changes. After all, the domestic technical system, but also completely unable to propose a new level of technology. (Google, the new encoding format to replace the H.264,spdy protocol, the country can not do).
Generally only do such as HTTP special fields or special parameters, passed to flash to make a certain explanation. Or in the original video file format based on the addition of some special meaning of the head and so on.
3,rtmp
This is the video playback protocol that Adobe has launched itself. Need dedicated server, such as FMS, open-source Red5. This protocol is also supported by Flash by default.
----
Overall, video-related protocol development is the process of transitioning from a dedicated protocol, server, to HTTP. and gradually adapt to the development and demand of the network, complex and changeable network environment, only to generate the HTTP video protocol.
----
Invited to update.
The application scenarios for different protocols have been explained separately above.
Pure protocol, HTTP is very simple, the RTSP family is more complex, rtmp did not know in depth.
If you just want to do an application, or use it, then HTTP is enough, very simple, very fast.
But if you really want to learn this aspect, you must not just focus on the video network protocol, there are many other points. such as the details of the Network Foundation, the basic knowledge of the coding format of the audio and video, and so on. Each of these points is full of fun. You can dig deeper. But it's a long-term investment in technology learning, Basic theory of the year. I don't understand the output, because I don't have the real output yet.
Go: Introduction to video-related protocol families (RTSP, HLS, rtmp)