目录ide
感谢Google Translate,Microsoft Translate,通篇机翻,不保证绝对正确this
media presentation可能分段传输,好比 HTTP stream。将文件以分段或者连续分段的形式组织起来是可能的,其其不必定是造成符合ISO基础媒体文件格式的文件(好比:它们不包含Movie box)。编码
类型 | 容器 | 强制性 | 数量 |
---|---|---|---|
'styp' | File | No | 0 /more |
若是单个文件存储segments(e.g. 在一个标准http server上),'segment files'中包含 styp box是推荐的,若是出现,必须是第一个,为了分辨这些文件和使声明符合规范。
styp 和 ftyp box 相似。其包含的brands也可能包含在在moov box以前的ftyp box中,也可能包含其余的brands以兼容具备不一样格式的segment。
一个有效的styp box应该是segment第一个box。若是segments被连接在一块儿,styp box能够被删除,但这不是必须的。不是第一个box的styp box能够被忽略。设计
类型 | 容器 | 强制性 | 数量 |
---|---|---|---|
'sidx' | File | No | 0 /more |
‘sidx’为其应用的media segment中的一个媒体流提供紧凑索引。 它的设计使其不只能够用于基于此规范的媒体格式(即包含sample tables或movie fragments的segment),还能够用于其余媒体格式(好比, MPEG‐2 Transport Streams [ISO/IEC 13818‐1])。出于此缘由,本处给出的通用描述,随后给出在使用Movie fragment 时的具体定义。
每一个Segment Index box记录了一个(sub)segment 是如何被划分为 一个或多个subsegments(它们还可能使用segment index box继续划分)。
subsegment被定义为一段时间区间内包含的 (sub)segment,并对应于包含的 (sub)segment的字节范围。全部subsegment的duration为包含的 (sub)segment的duration的和。
sidx box中的每一个entry都包含一个引用类型,该引用类型指向被引用的lest-segment的媒体信息,或者指向了描述被引用的subsegment如何进一步划分的sidx。结果,经过记录应用于相同( (sub)segment的部分的其余sidx的时间和字节偏移信息,能够以“分层”或“菊花链”(daisy-chain)或其余形式来index the segment。
每一个sidx box提供有关segment的单个媒体流的信息,称为参考流。 若是提供,则对于给定媒体流,段中的第一segment中的sidx box应记录段中该媒体流的所有,而且应该在该segment中用于相同媒体流的任何其余sidx box以前。
若是针对至少存在一个媒体流而不是segment中的全部媒体流的segment index,则一般选择不对每一个访问单元进行独立编码的媒体流(例如视频)进行index。 对于没有存在segment index的任何媒体流(称为non-indexed stream),与段中的第一sidx box相关联的媒体流用做参考流,在某种意义上其还描述了任何non-indexed媒体流的 subsegment。
sidx box 可能与被索引的media内联在同一个文件中,在某些状况下,也能够内联在仅包含索引信息的单独文件中。
sidx box包含对该box记录了(sub)segment的一系列引用subsegment。 引用的subsegent在呈现时间内是连续的。 相似地,sidx box引用的字节在媒体文件和单独的索引段中始终是连续的,或者若是索引放在媒体文件中,则在单个文件中是连续的。 引用的大小给出了引用的材料(material)中的字节数。code
media segment 可能被超过一个互相独立的 "top-level"的sidx box 引用,它们中的任一个都索引了一个具备media stream的media segment。在包含多个媒体流的segment中, 引用的字节可能包含来自多个流的媒体, 即便 sidx box只提供一个媒体流的计时信息。
在包含 sidx box的文件中, sidx box的定位点(anchor)是该box以后的第一个字节。若是有两个文件, 则媒体文件中的定位点是top‐level segment的开头 (即若是每一个segment存储在单独的文件中, 则是segment文件的开头)。包含媒体的文件中的材料 (也多是包含sidx box的文件) 从锚点指示的偏移量开始。若是有两个文件, 索引文件中的material将从定位点开始, 即紧跟在 sidx box以后。
有两个约束条件(a):subsegments在时间上是连续的,也就是说,循环中的每一个entry都是紧接着前一个的 (b):在一个给定的文件中,引用byte是连续的,如下一些可能性:
in its byte count,对sidx box的引用能够包括在记录subsegment的sidx box以后
在一个完整的文件中,使用first_offset
字段可以从被引用的media中区分出sidx box。
在一个完整文件中,可以从哪些被索引的meida附近的subsegment定位sidx box。
当使用包含segment index的单独文件时,循环entry多是“混合类型”,一些是index segment中的sidx box,一些是媒体文件中的media subsegment。
配置文件可用于限制segment index的放置或index的总体复杂性orm
aligned(8) class SegmentIndexBox extends FullBox(‘sidx’, version, 0) { unsigned int(32) reference_ID; unsigned int(32) timescale; if (version==0) { unsigned int(32) earliest_presentation_time; unsigned int(32) first_offset; } else { unsigned int(64) earliest_presentation_time; unsigned int(64) first_offset; } unsigned int(16) reserved = 0; unsigned int(16) reference_count; //number of referenced items for(i=1; i <= reference_count; i++) { bit (1) reference_type; unsigned int(31) referenced_size; unsigned int(32) subsegment_duration; bit(1) starts_with_SAP; //whether the referenced subsegments start with a SAP unsigned int(3) SAP_type; //SAP type as specified in Annex I, or the value 0. unsigned int(28) SAP_delta_time; //indicates TSAP of the first SAP, in decoding order, in the referenced subsegment for the reference stream } }
reference_ID
提供了引用stream的stream ID。若是sidx被“parent”sidx引用,reference_ID
的值应该同引用者sidx box的reference_ID
值一致。
timescale
为此box中的time和duration字段提供每秒刻度的时间刻度; 建议此值匹配参考流或track的时间刻度; 对于基于此规范的文件,即track的Media Header Box的时间刻度字段;
earliest_presentation_time
是timescale字段中指示的timescale中第一subsegment中参考流中任何内容的最先呈现时间; 最先的呈现时间来自访问单元中的媒体或访问单元的部分,edit list(若是有)不会忽略
first_offset
是包含媒体的文件中从锚点到索引材料的第一个字节的距离(以字节为单位)
reference_type
置1表示引用的是一个sidx box。不然则是media content。若是一个单独的index segment被使用,引用类型为1的entry在index segment中,引用类型为0的entry则在media 文件中。
referenced_size
从引用项的第一个字节到下一个引用项的第一个字节的字节距离,或者在最后一个条目的状况下,到引用材料的结尾的距离;视频
subsegment_duration
当引用是sidx box时,该字段携带该box中subsegment_duration
字段的总和; 当引用是一个subsegment时,该字段携带下一个subsegment(或下一个segment的第一个subsegment,若是这是segment的最后一个subsegment,参见流的任何访问单元)的最先呈现时间之间的差别, 或参考流的结束呈现时间(若是这是流的最后一个subsegment)和参考流的任何访问单元在参考subsegment中的最先呈现时间; duration与earliest_presentation_time
的单位相同;server
类型 | 容器 | 强制性 | 数量 |
---|---|---|---|
'ssix' | File | No | 0 /more |
In other words, this box provides a compact index for how the data in a subsegment is ordered according to levels into partial subsegments. It enables a client to easily access data for partial subsegments by downloading ranges of data in the subsegment
ssix box 提供了从 levels(由Level Assignment box指定)到被索引subsegment的字节范围的映射。换句话说,此box提供了一个紧凑的索引,用于指示subsegment中的数据如何根据级别划分为部分subsegment。 它使客户端可以经过下载subsegment中的区间数据来轻松访问部分subsegment的数据。
subsegment中的每一个字节应明确分配给一个级别,所以范围计数必须为2或更大。 若是范围与级别分配中的任何信息都没有关联,则可使用级别分配中未包括的任何级别。
每一个sidx box中应该有0或1个ssix box,它们仅索引 leaf subsegments,即仅索引subsegment但不包含segment index。 ssix(若是有)应为关联的sdix box后面的下一个box。 ssix box记录前一个sidx box中指示的subsegment。
一般,从字节范围构造的媒体数据是不完整的,即它不符合整个subsegment的媒体格式。索引
aligned(8) class SubsegmentIndexBox extends FullBox(‘ssix’, 0, 0) { unsigned int(32) subsegment_count; for( i=1; i <= subsegment_count; i++) { unsigned int(32) range_count; //媒体数据分组的部分subsegment级别的数量。 该值应大于或等于2 for ( j=1; j <= range_count; j++) { unsigned int(8) level; //the level to which this partial subsegment is assigned unsigned int(24) range_size; //size of the partial subsegment } } }
subsegment_count
是一个正整数,指定在此box中为其指定部分subsegment信息的subsegment数。 subsegment_count
应等于紧接在前的Segment Index box中的reference_count
(即,movie fragment引用的数量)ci
类型 | 容器 | 强制性 | 数量 |
---|---|---|---|
'prft' | File | No | 0 /more |
producer reference time box提供相对挂钟时间,在该时间点生成movie fragments或包含movie fragments的文件。 当这些文件实时生成和使用时,这能够为客户端提供信息,使消费和生产可以以相同的速率进行,从而避免可能的缓冲区溢出或下溢。
此box与按位流顺序跟随它的下一个movie fragment box相关。它必须遵循段中的任何segment type 或 segment index box (若是有), 并出如今下面的movie
fragment box(它所引用的) 以前。若是segment文件包含任何producer reference time boxes, 则第一个文件应出如今该段中的第一个movie fragment box以前。
aligned(8) class ProducerReferenceTimeBox extends FullBox(‘prft’, version, 0) { unsigned int(32) reference_track_ID; //the track_ID for the reference track unsigned int(64) ntp_timestamp; //a UTC time in NTP format corresponding to decoding_time. if (version==0) { unsigned int(32) media_time; } else { unsigned int(64) media_time; } }
media_time
对应于与ntp_timestamp
相同的时间, 在用于引用track的时间单位中,并在产生媒体时在该媒体时钟上测量。
略
略
略