rtmp Server for output H264 live streaming

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, widely used in live, on-demand, chat and other applications, as well as PC, mobile, embedded and other platforms, is to do streaming media development often come into contact with the protocol. I have previously written an article, "rtmp protocol to send H. E encoding and AAC encoded audio and video", briefly described how to use the RTMP protocol in their own programs, but that article is mainly about how to implement a rtmp live publishing, mainly focus on "collection-coding-rtmp release" Such a process. The main content of this article is to share with you, to do a simple, the output of the live streaming rtmp server, which functions and steps need to be implemented.

Common RTMP Servers

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

  Open Source Projects

  Business process

Of course, there are other open source, commercial rtmp servers (such as ffserver) that I don't list. I don't have one by one attempts, but judging from their statements, in general, the commercial RTMP program supports more protocols and more platforms than open source programs, which is not good to say. I recommend Crtmpserver, high performance, claiming to support "thousands ofsimultaneous connections", and its development community is currently very active. But the downside is that the code is a bit large and growing.

rtmp server function is more complex, it is difficult to complete the implementation, if you need a full-featured RTMP server, then you can choose one from among them, if you need the same as me, just a simple, output of the live streaming rtmp Server, you need to design and implement it yourself.

rtmp server interaction with the player

What we need to do is to support the Flash play protocol and output the RTMP server for live streaming, so first we have to understand what an interactive process is between the RTMP server and the Flash Player client. By reading "RTMP Specification 1.0" You can understand, I will summarize it here.

Basically a rtmp server realizes the above 6-point Interactive Protocol, it can support flash playback, smooth output of the video stream of H.

Design and implementation

Knowing the interaction process, we can design and implement our own RTMP server. Because the RTMP protocol is based on the TCP protocol, RTMP server is essentially a TCP server, and its logical structure is basically similar to the normal TCP server.

In fact, LIBRTMP has provided the basic RTMP message read and send, can be developed on the basis of librtmp, to achieve a variety of RTMP protocol packet and send, from the device, file or network to obtain video data, packaged into RTMP data packets, sent to Flash Player, Complete playback.

In another article, "rtmp protocol to send H-coded and AAC encoded audio and video", has detailed how to compile and use librtmp, interested can go to see. The article is talking about the RTMP protocol video Publisher, and the publisher is the same, the RTMP server sent to the Flash Player video data stream, also need to first send "AVC sequence Header", which contains important coding information, If not, the Flash Player will not be able to decode. The following code is the playback process that is obtained and sent from "H264reader" after the RTMP server receives the play request.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

haibindev.cnblogs.com, please contact QQ for cooperation. (reproduced please specify the author and source)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Tags: video, C + +, streaming, live

rtmp Server for output H264 live streaming

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.