Rtmp server that outputs h264 live streams

Source: Internet
Author: User

Rtmp (real time messaging protocol) is a common streaming media protocol used to transmit audio and video data. Combined with flash, rtmp is widely used in live broadcast, on-demand broadcast, chat, and other applications, as well as PCs, mobile devices, and embedded platforms, it is a protocol that is often used for streaming media development. I used to write an articleArticleThe "rtmp protocol sends H.264 encoding and AAC-encoded audio and video" section briefly introduces howProgramThe rtmp protocol is used in this article. However, this article mainly focuses on how to implement a rtmp live broadcast publishing end, focusing on the process of "collection-encoding-rtmp publishing. The main content of this article is to share with you the following:Simple rtmp server that outputs H.264 live streamsWhich functions and steps are required.

Common rtmp servers

There are many well-known rtmp servers, both commercial and open-source, which are listed below:

Open-source projects

 

Business Procedures

Of course, there are some other open-source and commercial rtmp servers (such as ffserver) that I will not list one by one. I did not try them all. However, from their statement, commercial rtmp programs generally support more protocols and platforms than open-source programs, this is hard to say. Which of the following statements is recommended?Crtmpserver, High performance, claim to support"Thousands of simultaneous connections", And its developmentCommunityCurrently, it is very active. However, the disadvantage is that,CodeThe volume is a little large and is constantly increasing.

The functions of the rtmp server are complex and difficult to implement. If you need a complete rtmp server, you can select one of them, if your requirements are the same as mineSimple rtmp server that outputs H.264 live streamsYou need to design and implement it yourself.

Interaction between the rtmp server and the player

What we need to achieve is:Rtmp server that supports flash playback protocol and output H.264 live streamsFirst, we must understand the interaction process between the rtmp server and the Flash Player client. Read rtmp Specification 1.0. I will summarize it here.

Basically, an rtmp server implements the above six-point interaction protocol to support flash playback and smoothly output H.264 video streams.

Design and Implementation

Once we know the interaction process, we can design and implement our own rtmp server. Because the rtmp protocol is based on the TCP protocol, the rtmp server is essentially a TCP server. Its logical structure is basically similar to that of common TCP servers.

In fact, librtmp has provided the basic rtmp packet reading and sending. It can be developed on the basis of librtmp to implement the packet group and sending of various rtmp protocols, obtains video data from devices, files, or networks, encapsulates the data into rtmp packets, and sends them to the Flash Player for playback.

In another article, "rtmp sends H.264 encoding and AAC-encoded audio and video", I have introduced in detail how to compile and use librtmp. If you are interested, please take a look. In that article, we talked about the rtmp video publishing end, which is the same as the sending end. The rtmp server also needs to send video data streams to the Flash Player.First send"AVC sequence Header", WhereIt contains important encoding information. If no encoding information is available, the flash player cannot decode it. The following code is that after the rtmp server receives the playback request"Hsf-reader"Obtain and send the playback process.

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.