ISO/IEC 15444-12 MP4 封装格式标准摘录 3
感谢Google Translate,Microsoft Translate,通篇机翻,不保证绝对正确
Track Data Layout Structures
Data Information Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| 'dinf' | 'minf' 或'meta' | Yes(In 'minf') No(optional 'meta') | 1 |
包含声明track中media信息位置的对象。
aligned(8) class DataInformationBox extends Box(‘dinf’) {
}
Data Reference Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| 'dref' | 'dinf' | Yes | 1 |
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| 'url' 'urn' | 'dref' | Yes(至少一个'url'或'urn' 出现) | 1 或更多 |
数据引用对象包含一个数据引用表(通常是URL),用于声明表示中使用的media数据的位置。 示例说明中的数据引用索引将此表中的entry与track中的示例联系起来。 以这种方式可以将track分成多个源。
如果设置了标志,指示数据与此box在同一文件中,则在输入字段中不应提供任何字符串(甚至不是空字符串)。
DataReferenceBox中的entry_count应为1或更大; DataReferenceBox中的每个DataEntryBox都应该是DataEntryUrnBox或DataEntryUrlBox。
当具有标志设置的数据entry表明media数据在同一文件中的文件被分割成用于传输的segments时,该标志的值不会改变,因为在传输操作之后(逻辑上)重新组装文件。
aligned(8) class DataEntryUrlBox (bit(24) flags) extends FullBox(‘url ’, version = 0, flags) {
string location;
}
aligned(8) class DataEntryUrnBox (bit(24) flags) extends FullBox(‘urn ’, version = 0, flags) {
string name;
string location;
}
aligned(8) class DataReferenceBox extends FullBox(‘dref’, version = 0, 0) {
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++) {
DataEntryBox(entry_version, entry_flags) data_entry; //a URL or URN entry.
}
}
data_entry是URL或URN条目。 Name是URN,在URN条目中是必需的。 位置是一个URL,在URL条目中是必需的,在URN条目中是可选的,它提供了一个位置来查找具有给定名称的资源。 每个都是使用UTF-8字符的以null结尾的字符串。 如果设置了自包含标志,则使用URL表单并且不存在字符串; 该框终止于entry-flags字段。 URL类型应该是提供文件的服务(例如,类型为file,http,ftp等的URL),并且理想情况下哪些服务也允许随机访问。 相对URL是允许的,并且相对于包含包含此数据引用的Movie Box的文件。
Sample Size Boxes
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| 'stsz' 'stz2' | 'stbl' | Yes | Exactly one variant must be present |
此box包含sample 数量,和一张表,含有每个sample的size(in bytes)。这允许media数据本身被解构。media中的sample总数始终显示在sample计数中。
sample size box有两个变体。第一个变体具有用于表示sample大小的固定大小32‐bit 字段;它允许为track中的所有样本定义常量大小。第二个变体允许较小的字段, 以便在大小不同但较小时节省空间。这些盒子中的一个必须存在;第一个版本是首选的,具有最大兼容性。
aligned(8) class SampleSizeBox extends FullBox(‘stsz’, version = 0, 0) {
unsigned int(32) sample_size; //为0,代表samples具有不同的size,具体值存储在sample size table。为其他,所有的sample具有相同的size,就是这个值,no array follows
unsigned int(32) sample_count;
if (sample_size==0) {
for (i=1; i <= sample_count; i++) {
unsigned int(32) entry_size; //size of a sample
}
}
}
Compact Sample Size Box
aligned(8) class CompactSampleSizeBox extends FullBox(‘stz2’, version = 0, 0) {
unsigned int(24) reserved = 0;
unisgned int(8) field_size; //size in bits of the entries in the following table
unsigned int(32) sample_count; //gives the number of entries in the following table
for (i=1; i <= sample_count; i++) {
unsigned int(field_size) entry_size; //size of a sample, indexed by its number.
}
}
Sample To Chunk Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| 'stsc' | 'stbl' | Yes | 1 |
media数据中的示例被分组为多个chunks。chunks 可以有不同的大小, 并且chunk中的sample数量可以有不同的大小。此表可用于查找包含sample的chunk、其位置和关联的sample description。
此表紧凑编码。每个entry给出接连具有相同特征的一组chunks的第一个chunk的index。通过从前一个entry中减去一个entry,可以计算在此组中有多少chunks。您可以通过乘以适当的每个chunk的sample数目将其转换为sample计数。
aligned(8) class SampleToChunkBox extends FullBox(‘stsc’, version = 0, 0) {
unsigned int(32) entry_count; //gives the number of entries in the following table
for (i=1; i <= entry_count; i++) {
unsigned int(32) first_chunk;
unsigned int(32) samples_per_chunk; //the number of samples in each of these chunks
unsigned int(32) sample_description_index; //the index of the sample entry that describes the samples in this chunk , range : 1~ the number of sample entries in
the Sample Description Box
}
first_chunk 给出了它给出了这组chunks的第一个chunk的索引,它们共享相同的samples-per-chunk和sample-description-index;track中第一个chunk的索引值为1(此box的第一个记录中的first_chunk字段的值为1,表示第一个样本映射到第一个块)。
Chunk Offset Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| ‘stco’, ‘co64’ | 'stbl' | Yes | Exactly one variant must be present |
chunk offset table将每个chunk的索引提供给包含文件。 有两种变体,允许使用32位或64位偏移。 后者在管理非常大的presentation时非常有用。 这些变体中的至多一个将出现在sample table的任何单个sample中。
偏移是文件偏移,而不是文件中任何box(例如Media Data Box)的偏移。 这允许在没有任何box结构的文件中引用media data。 这也意味着在构造一个自包含的ISO文件时必须小心,因为Movie Box的大小会影响媒体数据的chunk偏移。
aligned(8) class ChunkOffsetBox extends FullBox(‘stco’, version = 0, 0) {
unsigned int(32) entry_count; //number of entries in the following table
for (i=1; i <= entry_count; i++) {
unsigned int(32) chunk_offset; //gives the offset of the start of a chunk into its
containing media file.
}
}
aligned(8) class ChunkLargeOffsetBox extends FullBox(‘co64’, version = 0, 0) {
unsigned int(32) entry_count;
for (i=1; i <= entry_count; i++) {
unsigned int(64) chunk_offset;
}
}
Padding Bits Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| ‘padb’ | 'stbl' | No | 0 / 1 |
在某些流中,media sample不占用sample size给出的所有字节位,并在末尾填充到字节边界。 在某些情况下,有必要额外记录使用的填充位数。 该表提供了该信息。
aligned(8) class PaddingBitsBox extends FullBox(‘padb’, version = 0, 0) {
unsigned int(32) sample_count; //number of samples in the track
int i;
for (i=0; i < ((sample_count + 1)/2); i++) {
bit(1) reserved = 0;
bit(3) pad1; //a value from 0 to 7, indicating the number of bits at the end of sample (i*2)+1.
bit(1) reserved = 0;
bit(3) pad2; //a value from 0 to 7, indicating the number of bits at the end of sample (i*2)+2
}
}
Sub-Sample Information Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| ‘subs’ | 'stbl' 'traf' | No | 0 / more |
此box为了包含sub-sample 信息。
一个sub-sample是一个sample的一段连续字节范围。 应为给定的编码系统提供sub-sample的具体定义(例如,对于ISO / IEC 14496-10,高级视频编码)。 在没有这种特定定义的情况下,该box不适用于使用该编码系统的samples。
如果任何sample的subsample_count为0,那么这些sample没有sub-sample信息,后面没有数组。table是稀疏编码的。该表通过记录每个entry之间的sample数差异来识别哪些sample 具有sub-sample结构。 表格中的第一个entry记录了具有sub-sample信息的第一个sample的sample编号。
如果同一container box中存在多个Sub-Sample Information Box,则每个Sub-Sample Information Box中的flag应不同。 应为给定的编码系统提供falg的语义(如果有的话)。 如果falg对于给定的编码系统没有语义,则flag应为0。
aligned(8) class SubSampleInformationBox extends FullBox(‘subs’, version, flags) {
unsigned int(32) entry_count; //gives the number of entries in the following table
int i,j;
for (i=0; i < entry_count; i++) {
unsigned int(32) sample_delta;
unsigned int(16) subsample_count; //number of sub‐sample for the current sample . 0 means no sub-sample structure
if (subsample_count > 0) {
for (j=0; j < subsample_count; j++) {
if(version == 1){
unsigned int(32) subsample_size; //the size, in bytes, of the current sub‐sample.
}
else{
unsigned int(16) subsample_size;
}
unsigned int(8) subsample_priority; //the degradation priority for each sub‐sample.
unsigned int(8) discardable;
unsigned int(32) codec_specific_parameters; //is defined by the codec in use. If no such definition is available,
this field shall be set to 0
}
}
}
}
sample_delta用于指定具有sub-sample结构的sample数。它被编码为所需的sample编号与上一项中指示的sample编号之间的差异。如果当前entry是第一个entry, the value indicates the sample number of the first sample having sub‐sample information, 即该值是sample数与零 (0) 之间的差异。
discardable = 0意味着sub-sample需要解码当前sample。= 1则不需要,但增强,例如,sub-sample由补充增强信息(SEI)消息组成。
Sample Auxiliary Information Sizes Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| ‘saiz’ | 'stbl' 'traf' | No | 0 / more |
每个sample辅助信息可以存储在sample数据所在文件中的任何位置; 对于自包含的媒体文件,其通常位于Media Data box或派生的box中。 它存储在(a)多个chunk中,每个chunk的sample数量,以及chunk的数量,匹配主要sample数据的分chunk,或者(b)在单个chunk中用于电影中的所有sample sample表(或movie fragment)。 单个chunk(或track run)中包含的所有sample的sample辅助信息是连续存储的(类似于sample数据)。
Sample Auxiliary Information(如果存在)始终存储在与其相关的样本相同的文件中,因为它们共享相同的数据引用('dref')结构。 但是,此数据可能位于此文件中的任何位置,使用辅助信息偏移('saio')来指示数据的位置。
是否允许或要求样本辅助信息可以由品牌或使用的编码格式指定。 样本辅助信息的格式由aux_info_type确定。 如果省略aux_info_type和aux_info_type_parameter,则aux_info_type的隐含值是(a)在转换内容的情况下,例如受保护内容,scheme_type包括在Protection Scheme Information box中(b)sample entry类型。 aux_info_type_parameter的默认值为0.可以限制aux_info_type的某些值仅用于特定track类型。 track可以具有多个不同类型的样本辅助信息流。 这些类型在注册机构注册。
虽然aux_info_type确定辅助信息的格式,但是当aux_info_type_parameter的值不同时,可以使用具有相同格式的若干辅助信息流。 必须指定特定aux_info_type值的aux_info_type_parameter的语义,同时指定特定aux_info_type值和隐含辅助信息格式的语义。
此box提供每个sample的辅助信息的大小。 对于此box的每个实例,必须存在匹配的SampleAuxiliaryInformationOffsetsBox,其具有相同的aux_info_type和aux_info_type_parameter值,为此辅助信息提供偏移信息。
aligned(8) class SampleAuxiliaryInformationSizesBox extends FullBox(‘saiz’, version = 0, flags)
{
if (flags & 1) {
unsigned int(32) aux_info_type; //identifies the type of the sample auxiliary information
unsigned int(32) aux_info_type_parameter; //identifies the “stream” of auxiliary information having the same value of `aux_info_type` and associated to the same track.
}
unsigned int(8) default_sample_info_size;
unsigned int(32) sample_count; //gives the number of samples for which a size is defined
if (default_sample_info_size == 0) {
unsigned int(8) sample_info_size[ sample_count ]; //the size of the sample auxiliary information in bytes
}
}
Sample Auxiliary Information Offsets Box
| 类型 | 容器 | 强制性 | 数量 |
|---|---|---|---|
| ‘saio’ | 'stbl' 'traf' | No | 0 / more |
此box以类似于sample数据的chunk偏移的方式提供sample辅助信息的位置信息。
aligned(8) class SampleAuxiliaryInformationOffsetsBox extends FullBox(‘saio’, version, flags)
{
if (flags & 1) {
unsigned int(32) aux_info_type;
unsigned int(32) aux_info_type_parameter;
}
unsigned int(32) entry_count; //the number of entries in the following table.
if ( version == 0 ) {
unsigned int(32) offset[ entry_count ]; //gives the position in the file of the Sample Auxiliary Information for each Chunk or Track Fragment Run.
// 该 saio/saiz 在 stbl 中,此值是绝对的; 在 traf 中,该值是相对的(tfhd box 的flag, 如果该 flag == 0x020000(default-base-is-moof)则表示该相对偏移量是相对于 moof box的开始位置)
}
else {
unsigned int(64) offset[ entry_count ];
}
}
ISO/IEC 15444-12 MP4 封装格式标准摘录 3的更多相关文章
- ISO/IEC 15444-12 MP4 封装格式标准摘录 5
目录 Segments Segment Type Box Segment Index Box Subsegment Index Box Producer Reference Time Box Supp ...
- ISO/IEC 15444-12 MP4 封装格式标准摘录 4
目录 Movie Fragments Movie Extends Box Movie Extends Header Box Track Extends Box Movie Fragment Box M ...
- ISO/IEC 15444-12 MP4 封装格式标准摘录 2
目录 Track Media Structure Media Box Media Header Box Handler Reference Box Media Information Box Medi ...
- mp4封装格式各box类型讲解及IBP帧计算
mp4封装格式各box类型讲解及IBP帧计算 目录 mp4封装格式各box类型讲解及IBP帧计算 box ftyp box moov box mvhd box (Movie Header Box) t ...
- H.264标准(一)mp4封装格式详解
在网络层,互联网提供所有应用程序都要使用的两种类型的服务,尽管目前理解这些服务的细节并不重要,但在所有TCP/IP概述中,都不能忽略他们: 无连接分组交付服务(Connectionless Packe ...
- ISO/IEC 14496 文档内容简介, MPEG标准
ISO/IEC 14496是MPEG专家组制定的MPEG-4标准于1998年10月公布第1版,1999年1月成为国际标准,1999年12月公布了第2版,2000年初成为国际标准. 全文分为21个部分: ...
- 最简单的基于FFmpeg的封装格式处理:视音频复用器(muxer)
===================================================== 最简单的基于FFmpeg的封装格式处理系列文章列表: 最简单的基于FFmpeg的封装格式处理 ...
- 多媒体封装格式详解---MP4
MP4文件格式详解——结构概述 http://blog.csdn.net/pirateleo/article/details/7061452 一.基本概念 1. 文件,由许多Box和FullBox组成 ...
- ISO日期格式标准,浏览器到服务器到mysql中的时区
时区简单理解 https://zh.wikipedia.org/wiki/%E6%97%B6%E5%8C%BA 上面的链接是时区的wiki说明,下面说说我记住的部分: GMT时区是格林威治标准时间,我 ...
随机推荐
- memcached-slab内存管理
一.Memcache内存分配机制 关于这个机制网上有很多解释的,我个人的总结如下. Page为内存分配的最小单位. Memcached 的内存分配以page为单位,默认情况下一个page是1M,可以通 ...
- httpd配置Rewrite 301 302
在系统做一些大的.比较耗时的发布的时候,往往需要停服很长时间,这期间有用户访问的话,就需要展示一个升级说明的页面,这个页面放在反向代理服务器中:反向代理服务器如httpd有请求URL重写模块,通过它可 ...
- import、from 模块 import*、reload
import 模块名.from 模块名 import* 均为导入模块,前者调用模块中函数或者变量时需要添加引用,即模块名.调用函数或者变量名 具体用法见下 https://jingyan.baidu. ...
- strcpy函数内存分析
void strcpy(char* strDest, char* strSrc) { while((*strDest++ = *strSrc++) != '\0'); } 看上面这段代码,只有一条语句 ...
- Excel小技巧(随机点名)
如图,想要做一个随机点名的表格,同样可以石头剪刀布的场合,随机选人. 如何做呢? 第一步,填好想要的数据 第二步,在空的位置输入=INDIRECT("A"&RANDBETW ...
- jstl与EL表达式
一·el表达式介绍 EL 全名为Expression Language EL 语法很简单,它最大的特点就是使用上很方便.接下来介绍EL主要的语法结构: ${sessionScope.user.sex} ...
- 19牛客暑期多校 round2 F dfs
题目传送门//res tp nowcoder dfs 先将所有人都归于一队,之后从一队中取出人放置到另一个队. #include<iostream> #include<cstdio& ...
- 剑指offer4:重建二叉树(后序遍历)
1. 题目描述 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的结果中都不含重复的数字.例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4 ...
- 【动态规划】Mathematical Curse
[来源]:2018年焦作网络赛B [题意]: 有n个数字,有m个符号运算.通过不回头(即选取m个数有顺序可言),消除巫术的,并达到最大的价值. 其实意思就是在数组里选取一段子序列,然后进行m次加减乘除 ...
- Mysql-Sqlalchemy-ORM-多外键关联
创建表结构:orm_many_fk.py from sqlalchemy import Integer, ForeignKey, String, Column,create_engine from s ...