RTMP protocol Push Stream

Source: Internet
Author: User
rtmp Protocol

Real Time messaging Protocol (Real-time Messaging Protocol protocol) is a private protocol developed by Adobe for Audio, video, and data transmission between flash players and servers. The RTMP protocol is an application layer protocol in the TCP/IP five-tier architecture.

The basic data unit in the RTMP protocol is called a message, and when the RTMP protocol transmits data over the network, the message will be split into smaller data units called Message Fast (CHUNK). RTMP Message Structure

Messages are the most basic protocol data units in the RTMP protocol, and different message type IDs represent different types of messages and have different functions. The following is the basic structure of the RTMP message.
rtmp protocol Push Flow Step

To use the RTMP protocol to push the flow, we must follow the RTMP protocol standards, according to the corresponding RTMP push process!

Rtmpdump official website rtmp Push the flow step

The relevant APIs are as follows:

Rtmp_alloc () 
 rtmp_init () Rtmp_setupurl () rtmp_connect ()
 rtmp_connectstream
 () Rtmp_read ()
 Rtmp_enablewrite () 
 Rtmp_connect () 
 rtmp_write () rtmp_pause () Rtmp_seek ()
 rtmp_read
 () rtmp_close () Rtmp_free ()
rtmp Push Stream

At the end of this article, the Android-side data has been transferred to JNI for conversion, then H.264 encoded and read Sps,pps frame information, now we need to encapsulate the data into RTMP packet, and then push! rtmp Data padding

The first is to construct the Rtmppacket, which is populated according to the RTMP Basic Protocol Data unit:
Populating rtmp Information

Fill in the previous rtmp information:

    Message type, rtmp_packet_type_video:0x09
    packet->m_packettype = rtmp_packet_type_video;
    Payload Length
    packet->m_nbodysize = body_size;
    Time Stamp:4 byte
    packet->m_ntimestamp = 0;
    Packet->m_hasabstimestamp = 0;
    Channel Id,audio and Vidio channel
    packet->m_nchannel = 0x04; 
    There are several types that specify a
    

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.