mp4 box 信息 实例分析 2
来源:互联网 发布:pycuda windows 编辑:程序博客网 时间:2024/05/17 03:25
//------8.5.1 Sample Table Box------////8.5.1.1 DefinitionBox Type: ‘stbl’Container:Media Information Box (‘minf’)Mandatory:YesQuantity:Exactly one/*The sample table contains all the time and data indexing of the media samples in a track. Using the tables here, it is possible to locate samples in time, determine their type (e.g. I-frame or not), and determine their size, container, and offset into that container.If the track that contains the Sample Table Box references no data, then the Sample Table Box does not need to contain any sub-boxes (this is not a very useful media track).f the track that the Sample Table Box is contained in does reference data, then the following sub-boxes are required: Sample Description, Sample Size, Sample To Chunk, and Chunk Offset. Further, the SampleDescription Box shall contain at least one entry. A Sample Description Box is required because it contains the data reference index field which indicates which Data Reference Box to use to retrieve the media samples.Without the Sample Description, it is not possible to determine where the media samples are stored. The SyncSample Box is optional. If the Sync Sample Box is not present, all samples are sync samples.*/aligned(8) class SampleTableBox extends Box(‘stbl’) {}//--8.5.2 Sample Description Box--////这个的内容比较复杂//8.5.2.1 DefinitionBox Types:‘stsd’Container:Sample Table Box (‘stbl’)Mandatory:YesQuantity:Exactly one/*The sample description table gives detailed information about the coding type used, and any initialization information needed for that coding.The information stored in the sample description box after the entry-count is both track-type specific as documented here, and can also have variants within a track type (e.g. different codings may use different specific information after some common fields, even within a video track).For video tracks, a VisualSampleEntry is used, for audio tracks, an AudioSampleEntry and for metadata tracks, a MetaDataSampleEntry. Hint tracks use an entry format specific to their protocol, with an appropriate name.For hint tracks, the sample description contains appropriate declarative data for the streaming protocol being used, and the format of the hint track. The definition of the sample description is specific to the protocol.Multiple descriptions may be used within a track.*/aligned(8) abstract class SampleEntry (unsigned int(32) format)extends Box(format){ const unsigned int(8)[6] reserved = 0; unsigned int(16) data_reference_index;}class HintSampleEntry() extends SampleEntry (protocol) {unsigned int(8) data [];}class BitRateBox extends Box(‘btrt’){ unsigned int(32) bufferSizeDB; unsigned int(32) maxBitrate; unsigned int(32) avgBitrate;}class MetaDataSampleEntry(codingname) extends SampleEntry (codingname) {}class XMLMetaDataSampleEntry() extends MetaDataSampleEntry (’metx‘) { string content_encoding; // optional string namespace; string schema_location; // optional BitRateBox (); // optional}class TextMetaDataSampleEntry() extends MetaDataSampleEntry (‘mett’) { string content_encoding; // optional string mime_format; BitRateBox (); // optional}aligned(8) class URIBox extends FullBox(‘uri ’, version = 0, 0) { string theURI;}aligned(8) class URIInitBox extends FullBox(‘uriI’, version = 0, 0) { unsigned int(8) uri_initialization_data[];}class URIMetaSampleEntry() extends MetaDataSampleEntry (’urim‘) { URIbox the_label; URIInitBox init; // optional MPEG4BitRateBox (); // optional}class PixelAspectRatioBox extends Box(‘pasp’){ unsigned int(32) hSpacing; unsigned int(32) vSpacing;}class CleanApertureBox extends Box(‘clap’){ unsigned int(32) cleanApertureWidthN; unsigned int(32) cleanApertureWidthD; unsigned int(32) cleanApertureHeightN; unsigned int(32) cleanApertureHeightD; unsigned int(32) horizOffN; unsigned int(32) horizOffD; unsigned int(32) vertOffN; unsigned int(32) vertOffD;}class ColourInformationBox extends Box(‘colr’){ unsigned int(32) colour_type; if (colour_type == ‘nclx’) /* on-screen colours */ { unsigned int(16) colour_primaries; unsigned int(16) transfer_characteristics; unsigned int(16) matrix_coefficients; unsigned int(1) full_range_flag; unsigned int(7) reserved = 0; } else if (colour_type == ‘rICC’) { ICC_profile; // restricted ICC profile } else if (colour_type == ‘prof’) { ICC_profile; // unrestricted ICC profile }}class VisualSampleEntry(codingname) extends SampleEntry (codingname){ unsigned int(16) pre_defined = 0; const unsigned int(16) reserved = 0; unsigned int(32)[3] pre_defined = 0; unsigned int(16) width; unsigned int(16) height; template unsigned int(32) horizresolution = 0x00480000; // 72 dpi template unsigned int(32) vertresolution = 0x00480000; // 72 dpi const unsigned int(32) reserved = 0; template unsigned int(16) frame_count = 1; string[32] compressorname; //表示32个字节的意思 template unsigned int(16) depth = 0x0018; int(16) pre_defined = -1; // other boxes from derived specifications CleanApertureBox clap; // optional PixelAspectRatioBox pasp;// optional}// Audio Sequencesclass AudioSampleEntry(codingname) extends SampleEntry (codingname){ const unsigned int(32)[2] reserved = 0; template unsigned int(16) channelcount = 2; template unsigned int(16) samplesize = 16; unsigned int(16) pre_defined = 0; const unsigned int(16) reserved = 0 ; template unsigned int(32) samplerate = { default samplerate of media}<<16;}aligned(8) class SampleDescriptionBox (unsigned int(32) handler_type)extends FullBox('stsd', 0, 0){ int i ; unsigned int(32) entry_count; for (i = 1 ; i <= entry_count ; i++){ switch (handler_type){ case ‘soun’: // for audio tracks AudioSampleEntry(); break; case ‘vide’: // for video tracks VisualSampleEntry(); break; case ‘hint’: // Hint track HintSampleEntry(); break; case ‘meta’: // Metadata track MetadataSampleEntry(); break; } } }}
8.5.2.3 Semantics
version is an integer that specifies the version of this box
entry_count is an integer that gives the number of entries in the following table SampleEntry is the appropriate sample entry.
data_reference_index is an integer that contains the index of the data reference to use to retrieve data associated with samples that use this sample description. Data references are stored in Data Reference Boxes. The index ranges from 1 to the number of data references.
ChannelCount is the number of channels such as 1 (mono) or 2 (stereo)
SampleSize is in bits, and takes the default value of 16
SampleRate is the sampling rate expressed as a 16.16 fixed-point number (hi.lo)
resolution fields give the resolution of the image in pixels-per-inch, as a fixed 16.16 number
frame_count indicates how many frames of compressed video are stored in each sample. The default is 1, for one frame per sample; it may be more than 1 for multiple frames per sample
Compressorname is a name, for informative purposes. It is formatted in a fixed 32-byte field, with the first byte set to the number of bytes to be displayed, followed by that number of bytes of displayable data, and then padding to complete 32 bytes total (including the size byte). The field may be set to 0.
depth takes one of the following values
0x0018 – images are in colour with no alpha
width and height are the maximum visual width and height of the stream described by this sample description, in pixels
hSpacing, vSpacing: define the relative width and height of a pixel;
cleanApertureWidthN, cleanApertureWidthD: a fractional number which defines the exact clean aperture width, in counted pixels, of the video image
cleanApertureHeightN, cleanApertureHeightD: a fractional number which defines the exact clean aperture height, in counted pixels, of the video image
horizOffN, horizOffD: a fractional number which defines the horizontal offset of clean aperture centre minus (width-1)/2. Typically 0.
vertOffN, vertOffD: a fractional number which defines the vertical offset of clean aperture centre minus (height-1)/2. Typically 0.
content_encoding - is a null-terminated string in UTF-8 characters, and provides a MIME type which identifies the content encoding of the timed metadata. It is defined in the same way as for an ItemInfoEntry in this specification. If not present (an empty string is supplied) the timed metadata is not encoded. An example for this field is ‘application/zip’. Note that no MIME types for BiM [ISO/IEC 23001-1] and TeM [ISO/IEC 15938-1] currently exist. Thus the experimental MIME types ‘application/x-BiM’ and ‘text/x-TeM’ shall be used to identify these encoding mechanisms.
namespace - gives the namespace of the schema for the timed XML metadata. This is needed for identifying the type of metadata, e.g. gBSD or AQoS [MPEG-21-7] and for decoding using XML aware encoding mechanisms such as BiM.
schema_location - optionally provides an URL to find the schema corresponding to the namespace.
This is needed for decoding of the timed metadata by XML aware encoding mechanisms such as BiM.
mime_format - provides a MIME type which identifies the content format of the timed metadata.
Examples for this field are ‘text/html’ and ‘text/plain’.
bufferSizeDB gives the size of the decoding buffer for the elementary stream in bytes.
maxBitrate gives the maximum rate in bits/second over any window of one second.
avgBitrate gives the average rate in bits/second over the entire presentation.
theURI is a URI formatted according to the rules in 6.2.4;
uri_initialization_data is opaque data whose form is defined in the documentation of the URI form.
colour_type: an indication of the type of colour information supplied. For colour_type ‘nclx’:these fields are exactly the four bytes defined for PTM_COLOR_INFO( ) in A.7.2 of ISO/IEC 29199-2 but note that the full range flag is here in a different bit position
ICC_profile: an ICC profile as defined in ISO 15076-1 or ICC.1:2010 is supplied.
- mp4 box 信息 实例分析 2
- mp4 box信息实例分析 1
- mp4 box 信息3
- mp4-esds box分析
- mp4 box
- mp4的box信息——avcC,mdat
- MP4 esds box解析
- MP4 esds box解析
- MP4 box简述
- mp4 box 4
- 【Mp4】Stbl box
- MP4 box解析
- [mp4]mp4文件中的esds box解析
- MP4容器格式分析2
- android stagefright 播放MP4视频 打印信息分析
- MP4音频解码信息
- MP4音频解码信息
- 获取mp4文件信息
- java web上传文件保存的目录
- GUI显示系统之 SurfaceFlinger
- java连接mysql封装类
- Javascript 中的 IIFE
- SQLServer2008数据库的单表查询
- mp4 box 信息 实例分析 2
- Android 自定义属性用法详解
- 数据结构之Trie树
- 页面重构实战(二)---兼容性问题
- C# 合并dll到 exe当中
- 餐饮店装修不得不看的流程
- JSP传入后台 中文乱码问题
- 再谈向RichEdit中插入GIF动画的实现
- 问题描述: android.os.NetworkOnMainThreadException异常(不要在主线程访问网络资源)