今天上网时偶尔发现这个在我脑海里疑惑的问题的答案。
H.264 Video Types
The following media subtypes are defined for H.264 video.
Subtype | FOURCC | Description |
---|---|---|
MEDIASUBTYPE_AVC1 | 'AVC1' | H.264 bitstream without start codes. |
MEDIASUBTYPE_H264 | 'H264' | H.264 bitstream with start codes. |
MEDIASUBTYPE_h264 | 'h264' | Equivalent to MEDIASUBTYPE_H264, with a different FOURCC. |
MEDIASUBTYPE_X264 | 'X264' | Equivalent to MEDIASUBTYPE_H264, with a different FOURCC. |
MEDIASUBTYPE_x264 | 'x264' | Equivalent to MEDIASUBTYPE_H264, with a different FOURCC. |
The main difference between these media types is the presence of startcodes in the bitstream. If the subtype is MEDIASUBTYPE_AVC1, thebitstream does not contain start codes.
The MP4 container format stores H.264 data without start codes.Instead, each NALU is prefixed by a length field, which gives thelength of the NALU in bytes. The size of the length field can vary, butis typically 1, 2, or 4 bytes.
When start codes are not present in the bitstream, the following media type is used.
Major type | MEDIATYPE_Video |
---|---|
Subtype | MEDIASUBTYPE_AVC1 |
Format type | FORMAT_MPEG2Video |
The format block is an MPEG2VIDEOINFO structure. This structure should be filled in as follows:
The MP4 container might contain sequence parameter sets (SPS) orpicture parameter sets (PPS) as special NAL units in file headers or ina separate stream (distinct from the video stream). When the format isestablished, the media type can specify SPS and PPS NAL units in the dwSequenceHeader array. If cbSequenceHeader is greater than zero, dwSequenceHeaderis the start of a byte array containing SPS and PPS NALUs, delimited by2-byte length fields, all in network byte order (big-endian). It ispossible to have both SPS and PPS, only one of these types, or none.The actual type of each NALU can be determined by examining thenal_unit_type field of the NALU itself.
When this media type is used, each media sample starts at thebeginning of a NALU, and NAL units do not span samples. This enablesthe decoder to recover from data corruption or dropped samples.