一些记录 when dealing with MP4 container

本文解析了H.264视频在不同容器中的格式差异,重点介绍了带有起始码的H.264比特流和MP4容器中无起始码的H.264比特流。此外,还探讨了序列参数集(SPS)和图像参数集(PPS)在MP4文件中的存储方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【博客只是做个记录,技术性不强,能给游客提供帮助,最好不过。错误或模棱两可的地方,还望不吝斧正。——写在前面】

 

记录的信息,不一定只适用于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_H264MEDIASUBTYPE_h264MEDIASUBTYPE_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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值