RTMP/FLV Learning points of attention

Source: Internet
Author: User
Tags flv file
rtmp/flv Learning points of attention

1.RTMP and FLV format-friendly compatibility, mainly embodied in the RTMP package playable audio and video streams, when carefully studied, you will find that the RTMP packet in the package of audio and video data flow, in fact, and Flv/tag package the way the video data is the same, so, We just need to follow the FLV package H264 and AAC to generate a playable stream. Only video-related packages include: onmetadata,avcdecoderconfigurationrecord,h264 data. And the FLV file is the difference between the FLV file with the tag header, rtmp in the relevant information is placed in the rtmp header. As for the internal content is the same. Friendly compatibility with the convenience, such as rtmp streaming server can directly to the RTMP packet as Flv/tag write files, only a little bit to deal with some FLV head can be saved as FLV files.

2. In the FLV file format, Vpackettype represents the type of content contained within this tag, when avpackettype = 0x00 (sequence header), it is stated that this tag contains the header information, which is the key frame for 0x01. 0X02 is P-frame or B-frame, here are two points to note: Avpackettype = 0x00, only in the Scriptdata (corresponding to the onmetadata in rtmp/flv) will appear in the first tag, other times will not appear, 2nd, when Avpackettype is 0x01, this tag will contain 4 Nalu units, namely SPS, PPS, SEI, and IDR frames. Note: For 1th, theavcvideopacket portion of the first tag after Scriptd ATA (corresponding to Onmetadata in rtmp/flv) contains both SPS and PPS Nalu, and 2nd, in rtmp/flv, In order to avoid the client viewing behind cannot decode, it is necessary to take Sps,pps and other decoding information before I frame. Reference: http://blog.csdn.net/nvniaobi/article/details/49978935

3. A tag must contain at least one full frame, if a Nalu contains a complete frame, then good processing, H264 stream in this Nalu head 0x00 00 00 01 or 0x00 00 01 removed, and then put in the data field to OK If you need a tag with more than one nalu, you need to increase the NALU length field, as shown below. Reference: http://blog.csdn.net/nvniaobi/article/details/49978935

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.