版权声明:本文为CSDN博主「hey_manman」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接
- MP4概念
- MP4文件物理结构(常见)
- MP4重要box详解
- 扩展 - ismv
一、MP4概念
MP4是一套用于音频、视频信息的压缩编码标准,由国际标准化组织(ISO)和国际电工委员会(IEC)下属的“动态图像专家组”(Moving Picture Experts Group,即MPEG)制定。MPEG-4格式的主要用途在于网上流、光盘、语音发送(视频电话),以及电视广播,是一种常见的多媒体封装格式。
二、MP4文件物理结构(常见)

讯享网
(注:该图摘自https://blog.csdn.net/zzulp/article/details/)
1、 MP4基本单元box
由上图可知,MP4由许多box组成(如:ftyp、moov、mdat等),实际上box分为box和fullbox两种。
1)box:


size:该大小包括 box header 和 box body 整个 box 的大小,这样我 们就可以在文件中定位各个 box。
type:size 后面紧跟的 32 位为 box type,一般是 4 个字符,如“ftyp”、“moov”等,这 些 box type 都是已经预定义好的,分别表示固定的意义。
largesize:如果box很大超过了uint32的最大数值,size就被设置为1,并用接下来的 largesize来存放大小。
2)fullbox
是Box的扩展,Box结构的基础上在Header中增加8bits version和24bits flags
2、 重点关注的box
| ftyp | file type and compatibility | ||||||
|---|---|---|---|---|---|---|---|
| moov | container for all the metadata | ||||||
| mvhd | movie header, overall declarations | ||||||
| trak | container for an individual track or stream | ||||||
| tkhd | track header, overall information about the track | ||||||
| tref | track reference container | ||||||
| mdia | container for the media information in a track | ||||||
| mdhd | media header, overall information about the media | ||||||
| hdlr | handler, declares the media (handler) type | ||||||
| minf | media information container | ||||||
| vmhd | video media header, overall information (video track only) | ||||||
| … | sound/hint/Null media header | ||||||
| dinf | data information box, container | ||||||
| dref | data reference box, declares source(s) of media data in track | ||||||
| stbl | sample table box, container for the time/space map | ||||||
| stsd | sample descriptions (codec types, initialization etc.) | ||||||
| stts | (decoding) time-to-sample | ||||||
| stsc | sample-to-chunk, partial data-offset information | ||||||
| stco | chunk offset, partial data-offset information | ||||||
| moof | movie fragment | ||||||
| … | |||||||
| mdat | media data container |
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/21263.html