【博客只是做个记录,技术性不强,能给游客提供帮助,最好不过。错误或模棱两可的地方,还望不吝斧正。——写在前面】
记录的信息,不一定只适用于MP4容器,仅仅是修复该类型容器的文件时,查到的一些信息。
1. FOURCC : "avc1" "H264" "h264" ……有什么不同呢?来自于:http://msdn.microsoft.com/en-us/library/dd757808(v=vs.85).aspx(建议直接看原文)
The following media subtypes are definedfor H.264 video.
H.264Bitstream 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 networkabstraction layer units (NALUs), each of which is prefixed with a start codeequal to 0x000001 or 0x00000001.
specifiedtypes : MEDIASUBTYPE_H264, MEDIASUBTYPE_h264, MEDIASUBTYPE_X264,or MEDIASUBTYPE_x264
H.264Bitstream Without Start Codes
The MP4 container format stores H.264data 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, but is typically 1, 2, or4 bytes.
specified types : MEDIASUBTYPE_AVC1
【也因此,parse某些容器时,对于264的有这样的标记:V_H264_AVC,V_H264_ANNEXB.】
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 in the dwSequenceHeader array.If cbSequenceHeader isgreater than zero, dwSequenceHeader isthe 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 examining the nal_unit_type fieldof 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 corruption or droppedsamples.
本文解析了H.264视频在不同容器中的格式差异,重点介绍了带有起始码的H.264比特流和MP4容器中无起始码的H.264比特流。此外,还探讨了序列参数集(SPS)和图像参数集(PPS)在MP4文件中的存储方式。
344

被折叠的 条评论
为什么被折叠?



