From HTML5 live to interactive live, see the choice of Live protocol

Source: Internet
Author: User

At present, the domestic mainstream live broadcast protocol has HLS, RTMP, HTTP FLV, suitable for different live scenes.

One, HLS, rtmp and HTTP FLV1. HLS

HLS full name is HTTP Live streaming, an HTTP-based media streaming protocol implemented by Apple. It is very similar to the principle of the DASH protocol. By cutting the entire stream into a small media file that can be downloaded via HTTP, and then providing a companion media listing file, it provides the client with the ability to sequentially pull these media files to play, to achieve the effect that appears to be playing a stream.

HLS Principle Architecture Diagram

The HLS protocol is based on HTTP, and the main content is about m3u8, the text protocol. In fact, the generation and parsing are very simple, HLS request flow is:

    1. The URL of the HTTP request m3u8.
    2. The server returns a m3u8 playlist, which is updated in real time, and typically gives a URL of 5 pieces of data at a time.
    3. The client resolves the m3u8 playlist, and then sequentially requests the URL for each segment to get the TS data stream.

The advantages of HLS

    • Client support is simple, only need to support HTTP requests, HTTP protocol stateless, only need to sequentially download media fragments.
    • With HTTP protocol network compatibility is good, HTTP packets can also easily through the firewall or proxy server, CDN support is good.
    • Apple's full range of support, because HLS is Apple, so the full range of Apple products including the iphone, ipad, Safari does not need to install any plug-in to natively support the playback of HLS, now, Android also added to HLS support.
    • With the self-adaptive multi-bitrate, Apple has considered the problem of self-adaptive bitstream when it presents HLS.

The disadvantage of HLS

    • It is difficult to use the interactive broadcast scene compared with the long connection protocol such as RTMP.
    • For on-demand services, because TS tiles are usually small, massive fragmentation can be challenging in terms of file distribution, consistent caching, and storage.
2. RTMP

The RTMP protocol is an application layer protocol in the Internet TCP/IP five layer architecture. The basic data unit in the RTMP protocol is called a message. When the RTMP protocol transmits data over the Internet, messages are split into smaller units called message blocks. When rtmp transmits media data, the sender first encapsulates the media data into a message, then splits the message into a message block, and finally sends the segmented message block over the TCP protocol. After receiving the data through the TCP protocol, the message block is first re-assembled into a message, and then the media data can be recovered by encapsulating the message.

The advantages of rtmp

    • Fast, low error rate, low latency
    • RTMP is designed for streaming services, and the protocol is developed to take into account many of the underlying optimizations
    • The transmission of the message block can provide a more stable live environment, the hardware requirements will be higher, but it can alleviate the cumbersome transmission of HTTP media.

The disadvantage of rtmp

    • HTML5 propagation, browser push not supported
    • Based on TCP protocol, although the development is difficult, the degree of promotion is not enough, for developers, the threshold is relatively high.
    • Higher hardware requirements compared to HLS
3.HTTP FLV

HTTP FLV is a protocol that simulates streaming live streams into FLV files and downloading them over HTTP protocols.

HTTP FLV combines the low latency of RTMP and the streaming protocol that can reuse existing HTTP distribution resources. Its real-time and rtmp are equal, and rtmp compared with the partial protocol interaction time, the first screen time is shorter, can expand the function also more.

Advantages of HTTP flv

    • Can avoid the interference of the firewall to some extent
    • Can be very good compatible with HTTP 302 jump, do flexible scheduling
    • Encrypted channels can be made using HTTPS
    • Very good support for mobile (Android,ios)
Second, the live protocol HLS, rtmp and HTTP flv simple comparison

protocol

transmission mode

Video encapsulation format

delay

Data fragment

HTML5 Live

" /td>

hls

http stream

ts file

10-30s

slice

support

h5 Live, Game Live

rtmp

tcp stream

flv tag

2s

continuous flow

not supported

Mutual Live streaming

http flv

http stream

flv

2s

continuous flow

support

Interactive Live

Iii. Summary

RTMP format is currently used in China is more, domestic CDN manufacturers also support RTMP protocol. HLS, as Apple's live-streaming protocol, occupies an immovable position on the iOS side and spreads easily. HTTP FLV uses an HTTP long connection like RTMP streaming protocol, which needs to be distributed by a specific streaming media server, taking into account the advantages of both.

One-stop live broadcast solution based on the Cloud CDN, support rtmp, http-flv and HLS protocols, and the rtmp, HTTP FLV Live delay is controlled in 1 seconds via smart dispatch, link assurance, track-to-frame processing, drop frame processing, and industry-first hls+ technology The HLS protocol is controlled for about 4 seconds.

Recommended reading:

Analysis of WEBSOCKET+MSE--HTML5 Live technology

Let Chrome not see the WWDC live HLS technical explanation

Technical Dry Goods | Analysis of HLS protocol and optimization technology

From HTML5 live to interactive live, see the choice of Live protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.