MP4文件格式详解——结构概述
MP4文件格式详解(ISO-14496-12/14)
一、基本概念
1、 文件,由许多Box和FullBox组成。
2、 Box,每个Box由Header和Data组成。
3、 FullBox,是Box的扩展,Box结构的基础上在Header中增加8bits version和24bits flags。
4、 Header,包含了整个Box的长度size和类型type。当size==0时,代表这是文件中最后一个Box;当size==1时,意味着Box长度需要更多bits来描述,在后面会定义一个64bits的largesize描述Box的长度;当type是uuid时,代表Box中的数据是用户自定义扩展类型。
5、 Data,是Box的实际数据,可以是纯数据也可以是更多的子Boxes。
6、 当一个Box的Data中是一系列子Box时,这个Box又可成为Container Box。
Box的结构用伪代码表示如下:
- aligned(8) class Box (unsigned int(32) boxtype,optional unsigned int(8)[16] extended_type)
- {
- unsigned int(32) size;
- unsigned int(32) type = boxtype;
- if (size==1)
- {
- unsigned int(64) largesize;
- }
- else if (size==0)
- {
- // box extends to end of file
- }
- if (boxtype==‘uuid’)
- {
- unsigned int(8)[16] usertype = extended_type;
- }
结构如下图:
文件基本结构描述图
二、MP4文件格式(ISO-14496-12/14)
MP4文件概述
MP4文件就是由各式各样的Box组成的,下表中列出了所有必选或可选的Box类型,√代表Box必选。
具体列表:
ftyp |
√ |
file type and compatibility |
|||||
pdin |
progressive download information |
||||||
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 |
||||||
edts |
edit list container |
||||||
elst |
an edit list |
||||||
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) |
||||||
smhd |
sound media header, overall information (sound track only) |
||||||
hmhd |
hint media header, overall information (hint track only) |
||||||
nmhd |
Null media header, overall information (some tracks only) |
||||||
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 |
|||||
ctts |
(composition) time to sample |
||||||
stsc |
√ |
sample-to-chunk, partial data-offset information |
|||||
stsz |
sample sizes (framing) |
||||||
stz2 |
compact sample sizes (framing) |
||||||
stco |
√ |
chunk offset, partial data-offset information |
|||||
co64 |
64-bit chunk offset |
||||||
stss |
sync sample table (random access points) |
||||||
stsh |
shadow sync sample table |
||||||
padb |
sample padding bits |
||||||
stdp |
sample degradation priority |
||||||
sdtp |
independent and disposable samples |
||||||
sbgp |
sample-to-group |
||||||
sgpd |
sample group description |
||||||
subs |
sub-sample information |
||||||
mvex |
movie extends box |
||||||
mehd |
movie extends header box |
||||||
trex |
√ |
track extends defaults |
|||||
ipmc |
IPMP Control Box |
||||||
moof |
movie fragment |
||||||
mfhd |
√ |
movie fragment header |
|||||
traf |
track fragment |
||||||
tfhd |
√ |
track fragment header |
|||||
trun |
track fragment run |
||||||
sdtp |
independent and disposable samples |
||||||
sbgp |
sample-to-group |
||||||
subs |
sub-sample information |
||||||
mfra |
movie fragment random access |
||||||
tfra |
track fragment random access |
||||||
mfro |
√ |
movie fragment random access offset |
|||||
mdat |
media data container |
||||||
free |
free space |
||||||
skip |
free space |
||||||
udta |
user-data |
||||||
cprt |
copyright etc. |
||||||
meta |
metadata |
||||||
hdlr |
√ |
handler, declares the metadata (handler) type |
|||||
dinf |
data information box, container |
||||||
dref |
data reference box, declares source(s) of metadata items |
||||||
ipmc |
IPMP Control Box |
||||||
iloc |
item location |
||||||
ipro |
item protection |
||||||
sinf |
protection scheme information box |
||||||
frma |
original format box |
||||||
imif |
IPMP Information box |
||||||
schm |
scheme type box |
||||||
schi |
scheme information box |
||||||
iinf |
item information |
||||||
xml |
XML container |
||||||
bxml |
binary XML container |
||||||
pitm |
primary item reference |
||||||
fiin |
file delivery item information |
||||||
paen |
partition entry |
||||||
fpar |
file partition |
||||||
fecr |
FEC reservoir |
||||||
segr |
file delivery session group |
||||||
gitn |
group id to name |
||||||
tsel |
track selection |
||||||
meco |
additional metadata container |
||||||
mere |
metabox relation |
正式开始前先对文件的几个重要部分宏观介绍一下,以便诸位在后续学习时心中有数:
1、 ftypbox,在文件的开始位置,描述的文件的版本、兼容协议等;
2、 moovbox,这个box中不包含具体媒体数据,但包含本文件中所有媒体数据的宏观描述信息,moov box下有mvhd和trak box。
>>mvhd中记录了创建时间、修改时间、时间度量标尺、可播放时长等信息。
>>trak中的一系列子box描述了每个媒体轨道的具体信息。
3、 moofbox,这个box是视频分片的描述信息。并不是MP4文件必须的部分,但在我们常见的可在线播放的MP4格式文件中(例如Silverlight Smooth Streaming中的ismv文件)确是重中之重。
4、 mdatbox,实际媒体数据。我们最终解码播放的数据都在这里面。
5、 mfrabox,一般在文件末尾,媒体的索引文件,可通过查询直接定位所需时间点的媒体数据。
附:Smooth Streaming中ismv文件结构,文件分为了多个Fragments,每个Fragment中包含moof和mdat。这样的结构符合渐进式播放需求。(mdat及其描述信息逐步传输,收齐一个Fragment便可播放其中的mdat)。
from: https://blog.csdn.net/feixiaku/article/details/50403326
MP4文件格式详解——结构概述相关推荐
- MP4文件格式详解——文件类型ftyp
原谅地址:http://blog.csdn.net/pirateleo/article/details/7583321 文件类型ftyp(ISO-14496-12) Author:Pirate Leo ...
- MP4文件格式详解——文件类型ftyp(转)
文件类型ftyp(ISO-14496-12) Author:Pirate Leo Email:codeevoship@gmail.com ISO 14496 - 12 定义了一种封装媒体数据的基础文件 ...
- 多媒体 MP4文件格式详解——文件类型ftyp
ISO 14496 - 12 定义了一种封装媒体数据的基础文件格式,mp4.3gp.ismv等我们常见媒体封装格式都是以这种基础文件格式为基础衍生的. 如果从全局角度了解基础文件格式,请看我之前的博文 ...
- MP4文件格式详解——元数据moov(二)tkhd box
ISO 14496 - 12 定义了一种封装媒体数据的基础文件格式,mp4.3gp.ismv等我们常见媒体封装格式都是以这种基础文件格式为基础衍生的. 如果从全局角度了解基础文件格式,请看我之前的博文 ...
- MP4文件格式详解(ISO-14496-12/14)
一.基本概念 1. 文件,由许多Box和FullBox组成. 2. Box,每个Box由Header和Data组成. 3. FullBox,是Box的扩展,Box结构的基础上在Header中增加8bi ...
- Ffmpeg快速命令使用 Ffmpeg选项详解 Ffmepg格式详解 常见视频文件格式详解
http://www.ffmpeg.com.cn/index.php/%E9%A6%96%E9%A1%B5 Ffmpeg快速命令使用 From Ffmpeg工程组 Jump to: navigatio ...
- 【破解教程】PE文件格式详解(上)
PE文件格式详解(上) 摘要 Windows NT 3.1引入了一种名为PE文件格式的新可执行文件格式.PE文件格式的规范包含在了MSDN的CD中(Specs and Strategy, Specif ...
- S19文件格式详解(1)
1.记录结构 0 1 2 3 4 5 S Type Byte Count Address Data Checksum 一个SREC格式文件包含一系列ASCLL格式的的数据.具体如下: Record t ...
- ZIP文件格式详解(一)——文件数据格式
ZIP文件格式详解(一)--文件数据格式 ------------------------------------------------------------------------------- ...
最新文章
- Java的知识点30——线程的优先级、终止线程的典型方式、获取线程基本信息的方法
- 多线程1:AtomicInteger的使用,多线程叠加或叠减
- idae 安装的插件怎么删掉_X7 IE阻止我安装插件怎么办
- 1054 求平均值(PAT乙级 C++)
- http 请求默认时间_JMeter接口测试之HTTP请求默认值
- 官方回应:钟南山院士是此次关于曹雪涛等论文调查复核专家组组长
- 差分放大电路差模共模公式_差分放大电路对差模信号和共模信号有什么影响?...
- HTML5儿童玩具游戏商店网站模板
- 兼容多浏览器的CSS背景透明
- 商业智能在公安交通管理领域的应用
- java随机取数组_java基础自动数组(获取随机数组的最大数和最小数)
- word中如何把某条表格线改为虚线
- Vue-Layout(可视化布局)
- 华为计算机主板,华为鲲鹏920台式机主板亮相:性能配置都亮眼
- espanso-跨平台文本扩展工具
- ios 表情符号 键盘_字体键盘表情符号
- 多旋翼无人机仿真 rotors_simulator:roll pitch yawrate thrust 控制器
- 计算机函数涵义,Excel函数教程: 引用函数的含义和表示方法-excel技巧-电脑技巧收藏家...
- Python FAQ from newsmth.net
- loadrunner 录制脚本出现乱码解决方法
热门文章
- 平台的核心交互与基础角色——互联网平台建设系列...
- 并发编程之LockSupport的 park 方法及线程中断响应
- 142.如何个性化推荐系统设计-2
- 图片添加文字水印,自动换行,左右留白
- arcgis图斑尖角检查_ArcGIS消除零碎图斑(Eliminate)
- android o 红米4x,Redmi新机开始预热,会不会是年度最佳游戏手机?
- 程序员的六大赚钱副业!
- idea 在创建maven 时出现报错org.codehaus.plexus.component.repository.exception.ComponentLookupException:
- 解决HP 3055 一体机与U盘冲突
- ECSHOP模板文件功能说明