zoukankan      html  css  js  c++  java
  • 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_typeaux_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 ];
      }
    }
    
  • 相关阅读:
    通过actionlib控制jaco机械臂
    actionlib学习
    配置 jaco机械臂 ros环境
    ubuntu14.04标题栏显示上下网速
    linux下alsa架构音频驱动播放wav格式文件
    ros语音交互(五)移植科大讯飞语音识别到ros
    ubuntu14.04 wifi驱动
    Ubuntu14.04使用apt-fast来加快apt-get下载的教程
    ROS语音交互(四)接入图灵语义理解
    相比传统游戏,区块链游戏的价值在哪里?
  • 原文地址:https://www.cnblogs.com/gardenofhu/p/10037129.html
Copyright © 2011-2022 走看看