Some records when dealing with MP4 container

Source: Internet
Author: User

[A blog is only a record with poor technical skills. It is best to help visitors. I still hope that you will not give an axe to your mistakes or ambiguity. -- Preface]


The recorded information is not necessarily applicable only to MP4 containers. It is only found when the files of this type of containers are fixed.


1.Fourcc: "avc1" "h264" "h264 "...... What is the difference? From: (V = vs.85). aspx (it is recommended to read the original article directly)

The following media subtypes are definedfor H.264 video.

H.2bitstream with start Codes

H. 264 bitstreams that are transmittedover the air, or contained in MPEG-2 program or transport streams, or recordedon HD-DVD, are formatted as described in Annex B of ITU-T rec. h.264. Accordingto this specification, the bitstream
Consists of a sequence of networkequalaction layer units (nalus), each of which is prefixed with a start codeequal to 0x000001 or 0x00000001.

Specifiedtypes:Mediasubtype_h264,Mediasubtype_h264,Mediasubtype_x264, OrMediasubtype_x264

H.2bitstream without start Codes

The MP4 container format stores H.264 data without start codes. Instead, each NALU is prefixed by a length field, which gives the length of thenalu in bytes. The size of the length field can vary,
Is typically 1, 2, or4 bytes.

Specified types:Mediasubtype_avc1

[Therefore, when parse is used in some containers, such labels are as follows: v_h1__avc, v_h1__1_ B .]

The MP4 container might containsequence parameter sets (SPS) or picture parameter sets (PPS) as Special nalunits in file headers or in a separate stream (distinct from the video stream ). when the format is established, the media
Type can specify SPS and PPS nalunits inDwsequenceheaderArray. IfCbsequenceheaderIsgreater than zero,DwsequenceheaderIsthe start of a byte array containing SPS and PPS nalus, delimited by 2-bytelength
Fields, all in network byte order (big-Endian ). it is possible to haveboth SPS and PPS, only one of these types, or none. the actual type of eachnalu can be determined by examiningNal_unit_typeFieldof the NALU itself.

When this media type is used, eachmedia sample starts at the beginning of a nalu, and NAL units do not spansamples. This enables the decoder to recover from data preview uption or droppedsamples.


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: 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.