{"modulePath":"github.com/Monibuca/engine","version":"v1.2.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package avformat\n\n## Constants\n\n```go\nconst (\n\t// FLV Tag Type\n\tFLV_TAG_TYPE_AUDIO  = 0x08\n\tFLV_TAG_TYPE_VIDEO  = 0x09\n\tFLV_TAG_TYPE_SCRIPT = 0x12\n)\n```\n\n```go\nconst (\n\t// NALU Type\n\tNALU_Unspecified           = 0\n\tNALU_Non_IDR_Picture       = 1\n\tNALU_Data_Partition_A      = 2\n\tNALU_Data_Partition_B      = 3\n\tNALU_Data_Partition_C      = 4\n\tNALU_IDR_Picture           = 5\n\tNALU_SEI                   = 6\n\tNALU_SPS                   = 7\n\tNALU_PPS                   = 8\n\tNALU_Access_Unit_Delimiter = 9\n\tNALU_Sequence_End          = 10\n\tNALU_Stream_End            = 11\n\tNALU_Filler_Data           = 12\n\tNALU_SPS_Extension         = 13\n\tNALU_Prefix                = 14\n\tNALU_SPS_Subset            = 15\n\tNALU_DPS                   = 16\n\tNALU_Reserved1             = 17\n\tNALU_Reserved2             = 18\n\tNALU_Not_Auxiliary_Coded   = 19\n\tNALU_Coded_Slice_Extension = 20\n\tNALU_Reserved3             = 21\n\tNALU_Reserved4             = 22\n\tNALU_Reserved5             = 23\n\tNALU_NotReserved           = 24\n)\n```\n\n```go\nconst (\n\tADTS_HEADER_SIZE = 7\n)\n```\n\n## Variables\n\n```go\nvar (\n\tAVPacketPool = \u0026sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\treturn new(AVPacket)\n\t\t},\n\t}\n\tSendPacketPool = \u0026sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\treturn new(SendPacket)\n\t\t},\n\t}\n)\n```\n\n```go\nvar (\n\t// 音频格式. 4 bit\n\tSoundFormat = map[byte]string{\n\t\t0:  \"Linear PCM, platform endian\",\n\t\t1:  \"ADPCM\",\n\t\t2:  \"MP3\",\n\t\t3:  \"Linear PCM, little endian\",\n\t\t4:  \"Nellymoser 16kHz mono\",\n\t\t5:  \"Nellymoser 8kHz mono\",\n\t\t6:  \"Nellymoser\",\n\t\t7:  \"G.711 A-law logarithmic PCM\",\n\t\t8:  \"G.711 mu-law logarithmic PCM\",\n\t\t9:  \"reserved\",\n\t\t10: \"AAC\",\n\t\t11: \"Speex\",\n\t\t14: \"MP3 8Khz\",\n\t\t15: \"Device-specific sound\"}\n\n\t// 采样频率. 2 bit\n\tSoundRate = map[byte]int{\n\t\t0: 5500,\n\t\t1: 11000,\n\t\t2: 22000,\n\t\t3: 44000}\n\n\t// 量化精度. 1 bit\n\tSoundSize = map[byte]string{\n\t\t0: \"8Bit\",\n\t\t1: \"16Bit\"}\n\n\t// 音频类型. 1bit\n\tSoundType = map[byte]string{\n\t\t0: \"Mono\",\n\t\t1: \"Stereo\"}\n\n\t// 视频帧类型. 4bit\n\tFrameType = map[byte]string{\n\t\t1: \"keyframe (for AVC, a seekable frame)\",\n\t\t2: \"inter frame (for AVC, a non-seekable frame)\",\n\t\t3: \"disposable inter frame (H.263 only)\",\n\t\t4: \"generated keyframe (reserved for server use only)\",\n\t\t5: \"video info/command frame\"}\n\n\t// 视频编码类型. 4bit\n\tCodecID = map[byte]string{\n\t\t1:  \"JPEG (currently unused)\",\n\t\t2:  \"Sorenson H.263\",\n\t\t3:  \"Screen video\",\n\t\t4:  \"On2 VP6\",\n\t\t5:  \"On2 VP6 with alpha channel\",\n\t\t6:  \"Screen video version 2\",\n\t\t7:  \"AVC\",\n\t\t12: \"H265\"}\n)\n```\n\n```go\nvar (\n\tNALU_AUD_BYTE         = []byte{0x00, 0x00, 0x00, 0x01, 0x09, 0xF0}\n\tNALU_Delimiter1       = []byte{0x00, 0x00, 0x01}\n\tNALU_Delimiter2       = []byte{0x00, 0x00, 0x00, 0x01}\n\tRTMP_AVC_HEAD         = []byte{0x17, 0x00, 0x00, 0x00, 0x00, 0x01, 0x42, 0x00, 0x1E, 0xFF}\n\tRTMP_KEYFRAME_HEAD    = []byte{0x17, 0x01, 0x00, 0x00, 0x00}\n\tRTMP_NORMALFRAME_HEAD = []byte{0x27, 0x01, 0x00, 0x00, 0x00}\n)\n```\n\n```go\nvar ErrDecconfInvalid = errors.New(\"decode error\")\n```\n\tfunc (p *AVCDecoderConfigurationRecord) Marshal(b []byte) (n int) {\n\t\tb[0] = 1\n\t\tb[1] = p.AVCProfileIndication\n\t\tb[2] = p.ProfileCompatibility\n\t\tb[3] = p.AVCLevelIndication\n\t\tb[4] = p.LengthSizeMinusOne | 0xfc\n\t\tb[5] = uint8(len(p.SPS)) | 0xe0\n\t\tn += 6\n\n\t\tfor _, sps := range p.SPS {\n\t\t\tpio.PutU16BE(b[n:], uint16(len(sps)))\n\t\t\tn += 2\n\t\t\tcopy(b[n:], sps)\n\t\t\tn += len(sps)\n\t\t}\n\n\t\tb[n] = uint8(len(p.PPS))\n\t\tn++\n\n\t\tfor _, pps := range p.PPS {\n\t\t\tpio.PutU16BE(b[n:], uint16(len(pps)))\n\t\t\tn += 2\n\t\t\tcopy(b[n:], pps)\n\t\t\tn += len(pps)\n\t\t}\n\n\t\treturn\n\t}\n\n```go\nvar FLVHeader = []byte{0x46, 0x4c, 0x56, 0x01, 0x05, 0, 0, 0, 9, 0, 0, 0, 0}\n```\n\n```go\nvar NALU_SEI_BYTE []byte\n```\n\n```go\nvar SamplingFrequencies = [...]int{96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, 0}\n```\nProfile:\n\n0: Main profile 1: Low Complexity profile(LC) 2: Scalable Sampling Rate profile(SSR) 3: Reserved\n\n## Functions\n\n```go\nfunc ADTSToAudioSpecificConfig(data []byte) []byte\n```\n所以说number\\_of\\_raw\\_data\\_blocks\\_in\\_frame == 0 表示说ADTS帧中有一个AAC数据块并不是说没有。(一个AAC原始帧包含一段时间内1024个采样及相关数据)\n\n```go\nfunc ReadPPS(w io.Writer)\n```\n\n```go\nfunc WriteFLVTag(w io.Writer, tag *SendPacket) (err error)\n```\n\n## Types\n\n```go\ntype ADTS struct {\n\tADTSFixedHeader\n\tADTSVariableHeader\n}\n```\nISO/IEC 13838-7 20(25)/page\n\n### Advanced Audio Coding {#hdr-Advanced_Audio_Coding}\n\nAudioDataTransportStream\n\n```go\nfunc AudioSpecificConfigToADTS(asc AudioSpecificConfig, rawDataLength int) (adts ADTS, adtsByte []byte, err error)\n```\n\n```go\ntype ADTSFixedHeader struct {\n\tSyncWord               uint16 // 12 bits The bit string ‘1111 1111 1111’. See ISO/IEC 11172-3,subclause 2.4.2.3 (Table 8)\n\tID                     byte   // 1 bit MPEG identifier, set to ‘1’. See ISO/IEC 11172-3,subclause 2.4.2.3 (Table 8)\n\tLayer                  byte   // 2 bits Indicates which layer is used. Set to ‘00’. See ISO/IEC 11172-3,subclause 2.4.2.3 (Table 8)\n\tProtectionAbsent       byte   // 1 bit Indicates whether error_check() data is present or not. Same assyntax element ‘protection_bit’ in ISO/IEC 11172-3,subclause 2.4.1 and 2.4.2 (Table 8)\n\tProfile                byte   // 2 bits profile used. See clause 2 (Table 8)\n\tSamplingFrequencyIndex byte   // 4 bits indicates the sampling frequency used according to the followingtable (Table 8)\n\tPrivateBit             byte   // 1 bit see ISO/IEC 11172-3, subclause 2.4.2.3 (Table 8)\n\tChannelConfiguration   byte   // 3 bits indicates the channel configuration used. Ifchannel_configuration is greater than 0, the channelconfiguration is given in Table 42, see subclause 8.5.3.1. Ifchannel_configuration equals 0, the channel configuration is notspecified in the header and must be given by aprogram_config_element() following as first syntactic element inthe first raw_data_block() after the header (seesubclause 8.5.3.2), or by the implicit configuration (seesubclause 8.5.3.3) or must be known in the application (Table 8)\n\tOriginalCopy           byte   // 1 bit see ISO/IEC 11172-3, definition of data element copyright\n\tHome                   byte   // 1 bit see ISO/IEC 11172-3, definition of data element original/copy\n}\n```\n28 bits\n\n```go\ntype ADTSVariableHeader struct {\n\tCopyrightIdentificationBit   byte   // 1 bit One bit of the 72-bit copyright identification field (seecopyright_id above). The bits of this field are transmitted frame by frame; the first bit is indicated by the copyright_identification_start bit set to ‘1’. The field consists of an 8-bit copyright_identifier, followed by a 64-bit copyright_number.The copyright identifier is given by a Registration Authority as designated by SC29. The copyright_number is a value which identifies uniquely the copyrighted material. See ISO/IEC 13818-3, subclause 2.5.2.13 (Table 9)\n\tCopyrightIdentificationStart byte   // 1 bit One bit to indicate that the copyright_identification_bit in this audio frame is the first bit of the 72-bit copyright identification. If no copyright identification is transmitted, this bit should be kept '0'.'0' no start of copyright identification in this audio frame '1' start of copyright identification in this audio frame See ISO/IEC 13818-3, subclause 2.5.2.13 (Table 9)\n\tAACFrameLength               uint16 // 13 bits Length of the frame including headers and error_check in bytes(Table 9)\n\tADTSBufferFullness           uint16 // 11 bits state of the bit reservoir in the course of encoding the ADTS frame, up to and including the first raw_data_block() and the optionally following adts_raw_data_block_error_check(). It is transmitted as the number of available bits in the bit reservoir divided by NCC divided by 32 and truncated to an integer value (Table 9). A value of hexadecimal 7FF signals that the bitstream is a variable rate bitstream. In this case, buffer fullness is not applicable\n\tNumberOfRawDataBlockInFrame  byte   // 2 bits Number of raw_data_block()’s that are multiplexed in the adts_frame() is equal to number_of_raw_data_blocks_in_frame + 1. The minimum value is 0 indicating 1 raw_data_block()(Table 9)\n}\n```\n28 bits\n\n```go\ntype AVCDecoderConfigurationRecord struct {\n\tConfigurationVersion       byte // 8 bits Version\n\tAVCProfileIndication       byte // 8 bits\n\tProfileCompatibility       byte // 8 bits\n\tAVCLevelIndication         byte // 8 bits\n\tReserved1                  byte // 6 bits\n\tLengthSizeMinusOne         byte // 2 bits 非常重要,每个NALU包前面都(lengthSizeMinusOne \u0026 3)+1个字节的NAL包长度描述\n\tReserved2                  byte // 3 bits\n\tNumOfSequenceParameterSets byte // 5 bits SPS 的个数,计算方法是 numOfSequenceParameterSets \u0026 0x1F\n\tNumOfPictureParameterSets  byte // 8 bits PPS 的个数\n\n\tSequenceParameterSetLength  uint16 // 16 byte SPS Length\n\tSequenceParameterSetNALUnit []byte // n byte  SPS\n\tPictureParameterSetLength   uint16 // 16 byte PPS Length\n\tPictureParameterSetNALUnit  []byte // n byte  PPS\n}\n```\n\n```go\nfunc (p *AVCDecoderConfigurationRecord) Unmarshal(b []byte) (n int, err error)\n```\n\n```go\ntype AVPacket struct {\n\tTimestamp     uint32\n\tType          byte //8 audio,9 video\n\tIsAACSequence bool\n\tIsADTS        bool\n\t// Video\n\tVideoFrameType byte //4bit\n\tIsAVCSequence  bool\n\tPayload        []byte\n\tRefCount       int //Payload的引用次数\n}\n```\nVideo or Audio\n\n```go\nfunc NewAVPacket(avType byte) (p *AVPacket)\n```\n\n```go\nfunc ReadFLVTag(r io.Reader) (tag *AVPacket, err error)\n```\n\n```go\nfunc (av *AVPacket) ADTS2ASC() (tagPacket *AVPacket)\n```\n\n```go\nfunc (av *AVPacket) IsKeyFrame() bool\n```\n\n```go\nfunc (av *AVPacket) Recycle()\n```\n\n```go\ntype AdditionalMetadataContainerBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/87\n\nBox Type: meco Container: File, Movie Box (‘moov’), or Track Box (‘trak’) Mandatory: No Quantity: Zero or one\n\n```go\ntype AudioSampleEntry struct {\n\tReserved1    [2]uint32 // 32 bits array,\n\tChannelCount uint16    // 16 bits, is the number of channels such as 1 (mono) or 2 (stereo)\n\tSampleSize   uint16    // 16 bits, is in bits, and takes the default value of 16\n\tPreDefined   uint16    // 16 bits,\n\tReserved2    uint16    // 16 bits,\n\tSampleRate   uint32    // 32 bits, is the sampling rate expressed as a 16.16 fixed-point number (hi.lo)\n}\n```\nAudio Sequences\n\n```go\ntype AudioSampleGroupEntry struct{}\n```\n\n```go\ntype AudioSpecificConfig struct {\n\tAudioObjectType        byte // 5 bits\n\tSamplingFrequencyIndex byte // 4 bits\n\tChannelConfiguration   byte // 4 bits\n\tGASpecificConfig\n}\n```\n\n```go\ntype AuxInfo struct {\n\tAuxInfoType          uint32 // 32 bits,\n\tAuxInfoTypeParameter uint32 // 32 bits,\n}\n```\n\n```go\ntype BinaryXMLBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tData []uint8 // 8 bits array,\n}\n```\n\n```go\ntype BitRateBox struct {\n\tMP4BoxHeader // standard header\n\n\tBufferSizeDB uint32 // 32 bits, gives the size of the decoding buffer for the elementary stream in bytes.\n\tMaxBitrate   uint32 // 32 bits, gives the maximum rate in bits/second over any window of one second.\n\tAvgBitrate   uint32 // 32 bits, gives the average rate in bits/second over the entire presentation.\n}\n```\nBox Types: btrt\n\n```go\ntype ChunkLargeOffsetBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount  uint32   // 32 bits, is an integer that gives the number of entries in the following table\n\tChunkOffset []uint64 // 64 bits array, entry count elements.\n}\n```\nBox Type: co64\n\n```go\ntype ChunkOffsetBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount  uint32   // 32 bits, is an integer that gives the number of entries in the following table\n\tChunkOffset []uint32 // 32 bits array, entry count elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/59\n\nBox Type: stco, co64 Container: Sample Table Box (‘stbl’) Mandatory: Yes Quantity: Exactly one variant must be present\n\n```go\ntype CleanApertureBox struct {\n\tMP4BoxHeader // standard header\n\n\tCleanApertureWidthN  uint32 // 32 bits, a fractional number which defines the exact clean aperture width, in counted pixels, of the video image\n\tCleanApertureWidthD  uint32 // 32 bits, a fractional number which defines the exact clean aperture width, in counted pixels, of the video image\n\tCleanApertureHeightN uint32 // 32 bits, a fractional number which defines the exact clean aperture height, in counted pixels, of the video image\n\tCleanApertureHeightD uint32 // 32 bits, a fractional number which defines the exact clean aperture height, in counted pixels, of the video image\n\tHorizOffN            uint32 // 32 bits, a fractional number which defines the horizontal offset of clean aperture centre minus (width-1)/2. Typically 0\n\tHorizOffD            uint32 // 32 bits, a fractional number which defines the horizontal offset of clean aperture centre minus (width-1)/2. Typically 0\n\tVertOffN             uint32 // 32 bits, a fractional number which defines the vertical offset of clean aperture centre minus (height-1)/2. Typically 0\n\tVertOffD             uint32 // 32 bits, a fractional number which defines the vertical offset of clean aperture centre minus (height-1)/2. Typically 0\n}\n```\nBox Types: clap Visual Sequences\n\n```go\ntype ColourInformationBox struct {\n\tMP4BoxHeader // standard header\n\n\tColourType uint32 // 32 bits, 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\n}\n```\nBox Types: colr\n\n```go\ntype CompactSampleSizeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tReserved    [3]uint8    // 24 bits,\n\tFieldSize   uint8       // 8 bits, is an integer specifying the size in bits of the entries in the following table; it shall take the value 4, 8 or 16. If the value 4 is used, then each byte contains two values: entry[i]\u003c\u003c4 + entry[i+1]; if the sizes do not fill an integral number of bytes, the last byte is padded with zeros.\n\tSampleCount uint32      // 32 bits,  is an integer that gives the number of entries in the following table\n\tEntrySize   interface{} //\n}\n```\nBox Type: stz2\n\n```go\ntype CompositionOffsetBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32                   // 32 bits, is an integer that gives the number of entries in the following table\n\tTable      []CompositionOffsetTable // Composition Offset Table, EntryCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/49\n\nBox Type: ctts Container: Sample Table Box (‘stbl’) Mandatory: No Quantity: Zero or one\n\n```go\ntype CompositionOffsetTable struct {\n\tSampleCount  uint32      // 32 bits, is an integer that counts the number of consecutive samples that have the given offset.\n\tSampleOffset interface{} // int32 or uint32, is an integer that gives the offset between CT and DT, such that CT(n) = DT(n) + CTTS(n).\n}\n```\n\n```go\ntype CompositionToDecodeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tCompositionToDTSShift        int32 // 32 bits, signed, if this value is added to the composition times (as calculated by the CTS offsets from the DTS), then for all samples, their CTS is guaranteed to be greater than or equal to their DTS, and the buffer model implied by the indicated profile/level will be honoured; if leastDecodeToDisplayDelta is positive or zero, this field can be 0; otherwise it should be at least (- leastDecodeToDisplayDelta)\n\tLeastDecodeToDisplayDelta    int32 // 32 bits, signed, the smallest composition offset in the CompositionTimeToSample box in this track\n\tGreatestDecodeToDisplayDelta int32 // 32 bits, signed, the largest composition offset in the CompositionTimeToSample box in this track\n\tCompositionStartTime         int32 // 32 bits, signed, the smallest computed composition time (CTS) for any sample in the media of this track\n\tCompositionEndTime           int32 // 32 bits, signed, the composition time plus the composition duration, of the sample with the largest computed composition time (CTS) in the media of this track; if this field takes the value 0, the composition end time is unknown.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/50\n\nBox Type: cslg Container: Sample Table Box (‘stbl’) Mandatory: No Quantity: Zero or one\n\n```go\ntype CopyrightBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tPad      byte    // 1 bit,\n\tLanguage [2]byte // 15 bits, declares the language code for the following text. See ISO 639-2/T for the set of three character codes. Each character is packed as the difference between its ASCII value and 0x60. The code is confined to being three lower-case letters, so these values are strictly positive.\n\tNotice   string  // string, is a null-terminated string in either UTF-8 or UTF-16 characters, giving a copyright notice. If UTF- 16 is used, the string shall start with the BYTE ORDER MARK (0xFEFF), to distinguish it from a UTF- 8 string. This mark does not form part of the final string.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/78\n\nBox Type: cprt Container: User data box (‘udta’) Mandatory: No Quantity: Zero or more\n\nThe Copyright box contains a copyright declaration which applies to the entire presentation, when contained within the Movie Box, or, when contained in a track, to that entire track. There may be multiple copyright boxes using different language codes.\n\n```go\ntype DataEntryUrlBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tLocation string // string,\n}\n```\n\n```go\ntype DataEntryUrnBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tName     string // string,\n\tLocation string // string,\n}\n```\n\n```go\ntype DataInformationBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/56\n\nBox Type: dinf Container: Media Information Box ('minf') or Meta Box ('meta') Mandatory: Yes (required within 'minf' box) and No (optional within 'meta' box) Quantity: Exactly one\n\nThe data information box contains objects that declare the location of the media information in a track\n\n```go\ntype DataReferenceBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32      // 32 bits, is an integer that gives the number of entries in the following table\n\tDataEntry  interface{} // DataEntryUrlBox or DataEntryUrnBox.\n}\n```\n\\-------------------------------------------------------------------------------------------------------\n\nISO\\_IEC\\_14496-12\\_2012.pdf Page/56\n\nBox Types: url, urn, dref Container: Data Information Box ('dinf') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype DegradationPriorityBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tPriority []uint16 // 16 bits array, sample count elements, is integer specifying the degradation priority for each sample.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/46\n\nBox Type: stdp Container: Sample Table Box (‘stbl’). Mandatory: No. Quantity: Zero or one.\n\nThis box contains the degradation priority of each sample. The values are stored in the table, one for each sample. The size of the table, sample\\_count is taken from the sample\\_count in the Sample Size Box ('stsz'). Specifications derived from this define the exact meaning and acceptable range of the priority field.\n\n```go\ntype EditBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/54\n\nBox Type: edts Container: Track Box (‘trak’) Mandatory: No Quantity: Zero or one\n\n```go\ntype EditListBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32          // 32 bits, is an integer that gives the number of entries in the following table\n\tTables     []EditListTable // Edit List Table\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/54\n\nBox Type: elst Container: Edit Box (‘edts’) Mandatory: No Quantity: Zero or one\n\n```go\ntype EditListTable struct {\n\tSegmentDuration   interface{} // uint64 or uint32, is an integer that specifies the duration of this edit segment in units of the timescale in the Movie Header Box\n\tMediaTime         interface{} // uint64 or uint32, is an integer containing the starting time within the media of this edit segment (in media time scale units, in composition time). If this field is set to –1, it is an empty edit. The last edit in a track shall never be an empty edit. Any difference between the duration in the Movie Header Box, and the track’s duration is expressed as an implicit empty edit at the end.\n\tMediaRateInteger  int16       // 16 bits,\n\tMediaRateFraction int16       // 16 bits,\n}\n```\n\n```go\ntype FDItemInformationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint16            // 16 bits,\n\tPE         []PartitionEntry  // EntryCount elements.\n\tFDSGB      FDSessionGroupBox // optional\n\tGidToNameB GroupIdToNameBox  // optional\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/95\n\nBox Type: fiin Container: Meta Box (‘meta’) Mandatory: No Quantity: Zero or one\n\nThe FD item information box is optional, although it is mandatory for files using FD hint tracks. It provides information on the partitioning of source files and how FD hint tracks are combined into FD sessions. Each partition entry provides details on a particular file partitioning, FEC encoding and associated File and FEC reservoirs. It is possible to provide multiple entries for one source file (identified by its item ID) if alternative FEC encoding schemes or partitionings are used in the file. All partition entries are implicitly numbered and the first entry has number 1.\n\n```go\ntype FDSessionGroupBox struct {\n\tMP4BoxHeader // standard header\n\n\tNumSessionGroups uint16                // 16 bits,\n\tTable            []FDSessionGroupTable // FD Session Group Table, NumSessionGroups elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/97\n\nBox Type: segr Container: FD Information Box (‘fiin’) Mandatory: No Quantity: Zero or One\n\n```go\ntype FDSessionGroupIDTable struct {\n\tGroupID uint32 // 32 bits\n}\n```\n\n```go\ntype FDSessionGroupTable struct {\n\tEntryCount                uint8                       // 8 bits,\n\tGIDTable                  []FDSessionGroupIDTable     // FDSession Group ID Table, EntryCount elements.\n\tNumChannelsInSessionGroup uint16                      // 16 bits\n\tHTIDTable                 []FDSessionHintTrackIDTable // FDSession Hint Track ID Table, NumChannelsInSessionGroup elements.\n}\n```\n\n```go\ntype FDSessionHintTrackIDTable struct {\n\tHintTrackID uint32 // 32 bits\n}\n```\n\n```go\ntype FECReservoirBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint16              // 16 bits,\n\tTable      []FECReservoirTable // FEC Reservoir Table, EntryCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/97\n\nBox Type: fecr Container: Partition Entry (‘paen’) Mandatory: No Quantity: Zero or One\n\nThe FEC reservoir box associates the source file identified in the file partition box ('fpar') with FEC reservoirs stored as additional items. It contains a list that starts with the first FEC reservoir associated with the first source block of the source file and continues sequentially through the source blocks of the source file.\n\n```go\ntype FECReservoirTable struct {\n\tItemID      uint16 // 16 bits, indicates the location of the FEC reservoir associated with a source block.\n\tSymbolCount uint32 // 32 bits, indicates the number of repair symbols contained in the FEC reservoir.\n}\n```\n\n```go\ntype FilePartitionBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tItemID                     uint16               // 16 bits,\n\tPacketPayloadSize          uint16               // 16 bits,\n\tReserved                   uint8                // 8 bits,\n\tFECEncodingID              uint8                // 8 bits,\n\tFECInstanceID              uint16               // 16 bits,\n\tMaxSourceBlockLength       uint16               // 16 bits,\n\tEncodingSymbolLength       uint16               // 16 bits,\n\tMaxNumberOfEncodingSymbols uint16               // 16 bits,\n\tSchemeSpecificInfo         string               // string,\n\tEntryCount                 uint16               // 16 bits,\n\tTanble                     []FilePartitionTable //File Partition Table, EntryCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/95\n\nBox Type: fpar Container: Partition Entry (‘paen’) Mandatory: Yes Quantity: Exactly one\n\nThe File Partition box identifies the source file and provides a partitioning of that file into source blocks and symbols. Further information about the source file, e.g., filename, content location and group IDs, is contained in the Item Information box ('iinf'), where the Item Information entry corresponding to the item ID of the source file is of version 1 and includes a File Delivery Item Information Extension ('fdel').\n\n```go\ntype FilePartitionTable struct {\n\tBlockCount uint16 // 16 bits,\n\tBlockSize  uint32 // 32 bits,\n}\n```\n\n```go\ntype FileReservoirBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint16               // 16 bits, gives the number of entries in the following list. An entry count here should match the total number or blocks in the corresponding file partition box.\n\tTable      []FileReservoirTable // EntryCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/99\n\nBox Type: fire Container: Partition Entry (‘paen’) Mandatory: No Quantity: Zero or One\n\nThe File reservoir box associates the source file identified in the file partition box ('fpar') with File reservoirs stored as additional items. It contains a list that starts with the first File reservoir associated with the first source block of the source file and continues sequentially through the source blocks of the source file.\n\n```go\ntype FileReservoirTable struct {\n\tItemID      uint16 // 16 bits, indicates the location of the File reservoir associated with a source block.\n\tSymbolCount uint32 // 32 bits, indicates the number of source symbols contained in the File reservoir.\n}\n```\n\n```go\ntype FileTypeBox struct {\n\tMP4BoxHeader // standard header\n\n\tMajorBrand       uint32   // 32 bits, is a brand identifier\n\tMinorVersion     uint32   // 32 bits, is an informative integer for the minor version of the major brand\n\tCompatibleBrands []uint32 // 32 bits array, is a list, to the end of the box, of brands\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/18\n\nBox Type: ftyp Container: File Mandatory: Yes Quantity: Exactly one (but see below)\n\nEach brand is a printable four-character code, registered with ISO, that identifies a precise specification\n\n```go\nfunc NewFileTypeBox() (box *FileTypeBox)\n```\n\n```go\ntype FreeSpaceBox struct {\n\tMP4BoxHeader // standard header\n\n\tData []uint8 // 8 bits array,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/29\n\nBox Types: free, skip Container: File or other box Mandatory: No Quantity: Zero or more\n\nThe contents of a free-space box are irrelevant and may be ignored, or the object deleted, without affecting the presentation. (Care should be exercised when deleting the object, as this may invalidate the offsets used in the sample table, unless this object is after all the media data).\n\n```go\ntype GASpecificConfig struct {\n\tFrameLengthFlag    byte // 1 bit\n\tDependsOnCoreCoder byte // 1 bit\n\tExtensionFlag      byte // 1 bit\n}\n```\n\n```go\ntype GroupIdToNameBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint16             // 16 bits, gives the number of entries in the following list.\n\tTable      []GroupIdToNameBox // Group Id To Name Table, EntryCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/98\n\nBox Type: gitn Container: FD Information Box (‘fiin’) Mandatory: No Quantity: Zero or One\n\nThe Group ID to Name box associates file group names to file group IDs used in the version 1 item information entries in the item information box ('iinf').\n\n```go\ntype GroupIdToNameTable struct {\n\tGroupID   uint32 // 32 bits, indicates a file group.\n\tGroupName string // string, is a null-terminated string in UTF-8 characters containing a file group name.\n}\n```\n\n```go\ntype H264 struct {\n}\n```\n\n```go\ntype HandlerBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tPreDefined  uint32    // 32 bits,\n\tHandlerType uint32    // 32 bits, when present in a meta box, contains an appropriate value to indicate the format of the meta box contents. The value 'null' can be used in the primary meta box to indicate that it is merely being used to hold resources\n\tReserved    [3]uint32 // 32 bits,\n\tName        string    // string, is a null-terminated string in UTF-8 characters which gives a human-readable name for the track type (for debugging and inspection purposes).\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/37\n\nBox Type: hdlr Container: Media Box ('mdia') or Meta Box ('meta') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype HintMediaHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tMaxPDUSize uint16 // 16 bits, gives the size in bytes of the largest PDU in this (hint) stream\n\tAvgPDUSize uint16 // 16 bits, gives the average size of a PDU over the entire presentation\n\tMaxBitrate uint32 // 32 bits, gives the maximum rate in bits/second over any window of one second\n\tAvgBitrate uint32 // 32 bits, gives the average rate in bits/second over the entire presentation\n\tReserved   uint32 // 32 bits,\n}\n```\nBox Types: hmhd The hint media header contains general information, independent of the protocol, for hint tracks. (A PDU is a Protocol Data Unit.)\n\n```go\ntype HintSampleEntry struct {\n\tData []uint8 // 8 bits array,\n}\n```\n\n```go\ntype HintSampleGroupEntry struct{}\n```\n\n```go\ntype IPMPControlBox struct{}\n```\n\n```go\ntype IndependentAndDisposableSamplesBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTable []IndependentAndDisposableSamplesTable // Independent And Disposable Samples Table, sample count elements\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/53\n\nBox Types: sdtp Container: Sample Table Box (‘stbl’) Mandatory: No Quantity: Zero or one\n\n```go\ntype IndependentAndDisposableSamplesTable struct {\n\tIsLeading           byte // 2 bits,\n\tSampleDependsOn     byte // 2 bits,\n\tSampleIsDependedOn  byte // 2 bits,\n\tSampleHasTedundancy byte // 2 bits,\n}\n```\n\n```go\ntype ItemDataBox struct {\n\tMP4BoxHeader // standard header\n\n\tData []byte // 8 bits array, is the contained meta data\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/90\n\nBox Type: idat Container: Metadata box (‘meta’) Mandatory: No Quantity: Zero or one\n\nThis box contains the data of metadata items that use the construction method indicating that an item’s data extents are stored within this box.\n\n```go\ntype ItemInfoBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint16          // 16 bits,\n\tItemInfos  []ItemInfoEntry // EntryCount elements.\n}\n```\n\n```go\ntype ItemInfoEntry struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tItemID              uint16 // 16 bits\n\tItemProtectionIndex uint16 // 16 bits\n\tItemType            uint32 // 32 bits,\n\tItemName            string // string,\n\tContentType         string // string,\n\tContentEncoding     string // string, optional\n\tItemUriType         string // string,\n\tExtensionType       uint32 // 32 bits, optional\n\tItemInfoExtension          // optional\n}\n```\nBox Type: infe\n\n```go\ntype ItemInfoExtension struct {\n}\n```\n\n```go\ntype ItemLocationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tOffsetSize     byte        // 4 bits,\n\tLengthSize     byte        // 4 bits,\n\tBaseOffsetSize byte        // 4 bits,\n\tIndexSize      byte        // 4 bits, if version == 1, index_size replace to reserved.\n\tItemCount      uint16      // 16 bits,\n\tTable          interface{} // version == 1 -\u003e ItemLocationTable1 , version == 2 -\u003e ItemLocationTable2, ItemCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/82\n\nBox Type: iloc Container: Meta box (‘meta’) Mandatory: No Quantity: Zero or one\n\n```go\ntype ItemLocationExtentTable1 struct {\n\tExtentIndex interface{} // unsigned int(index_size*8)\n\tItemLocationExtentTable2\n}\n```\n\n```go\ntype ItemLocationExtentTable2 struct {\n\tExtentOffset interface{} // unsigned int(offset_size*8)\n\tExtentLength interface{} // unsigned int(length_size*8)\n}\n```\n\n```go\ntype ItemLocationTable1 struct {\n\tItemID             uint16                     // 16 bits,\n\tReserved           uint16                     // 12 bits,\n\tConstructionMethod byte                       // 4 bits,\n\tDataReferenceIndex uint16                     // 16 bits,\n\tBaseOffset         interface{}                // unsigned int(base_offset_size*8),\n\tExtentCount        uint16                     // 16 bits,\n\tExtentTable        []ItemLocationExtentTable1 // Item Location Extent Table1, ExtentCount elements.\n}\n```\n\n```go\ntype ItemLocationTable2 struct {\n\tItemID             uint16                     // 16 bits,\n\tDataReferenceIndex uint16                     // 16 bits,\n\tBaseOffset         interface{}                // unsigned int(base_offset_size*8),\n\tExtentCount        uint16                     // 16 bits,\n\tExtentTable        []ItemLocationExtentTable2 // Item Location Extent Table2, ExtentCount elements.\n}\n```\n\n```go\ntype ItemProtectionBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tProtectionCount uint16                // 16 bits,\n\tTable           []ItemProtectionTable // Item Protection Table, ProtectionCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/85\n\nBox Type: ipro Container: Meta box (‘meta’) Mandatory: No Quantity: Zero or one\n\nThe item protection box provides an array of item protection information, for use by the Item Information Box.\n\n```go\ntype ItemProtectionTable struct {\n\tProtectionInformation ProtectionSchemeInfoBox\n}\n```\n\n```go\ntype ItemReferenceBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSITRB []SingleItemTypeReferenceBox\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/91\n\nBox Type: iref Container: Metadata box (‘meta’) Mandatory: No Quantity: Zero or one\n\nThe item reference box allows the linking of one item to others via typed references. All the references for one item of a specific type are collected into a single item type reference box, whose type is the reference type, and which has a ‘from item ID’ field indicating which item is linked. The items linked to are then represented by an array of ‘to item ID’s. All these single item type reference boxes are then collected into the item reference box. The reference types defined for the track reference box defined in 8.3.3 may be used here if appropriate, or other registered reference types.\n\n```go\ntype LevelAssignmentBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tLevelCount uint8                  // 8 bits, specifies the number of levels each fraction is grouped into. level_count shall be greater than or equal to 2.\n\tTable      []LevelAssignmentTable // Level Assignment Table, level count elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/72\n\nBox Type: leva Container: Movie Extends Box (\\`mvex’) Mandatory: No Quantity: Zero or one\n\n```go\ntype LevelAssignmentTable struct {\n\tTrackId        uint32 // 32 bits, for loop entry j specifies the track identifier of the track assigned to level j.\n\tPaddingFlag    byte   // 1 bit, equal to 1 indicates that a conforming fraction can be formed by concatenating any positive integer number of levels within a fraction and padding the last Media Data box by zero bytes up to the full size that is indicated in the header of the last Media Data box. The semantics of padding_flag equal to 0 are that this is not assured.\n\tAssignmentType byte   // 7 bits,\n}\n```\n\n```go\ntype MP4 interface {\n}\n```\n\n```go\ntype MP4Body struct{}\n```\n\n```go\ntype MP4Box interface {\n\tHeader() *MP4Header\n\tBody() *MP4Body\n}\n```\n\n```go\ntype MP4BoxHeader struct {\n\tBoxSize uint32 // 32 bits, is an integer that specifies the number of bytes in this box, including all its fields and contained boxes; if size is 1 then the actual size is in the field largesize; if size is 0, then this box is the last one in the file, and its contents extend to the end of the file (normally only used for a Media Data Box)\n\tBoxType uint32 // 32 bits, identifies the box type; standard boxes use a compact type, which is normally four printable characters, to permit ease of identification, and is shown so in the boxes below. User extensions use an extended type; in this case, the type field is set to ‘uuid’.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/17\n\nThe standard boxes all use compact types (32-bit) and most boxes will use the compact (32-bit) size standard header\n\n```go\ntype MP4BoxLargeHeader struct {\n\tLargeSize uint64    // 64 bits\n\tUUIDs     [16]uint8 // 128 bits\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/17\n\nTypically only the Media Data Box(es) need the 64-bit size. lagesize box header\n\n```go\ntype MP4FullBoxHeader struct {\n\tVersion uint8   // 8 bits, is an integer that specifies the version of this format of the box.\n\tFlags   [3]byte // 24 bits, is a map of flags\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/17\n\nMany objects also contain a version number and flags field full box header\n\n```go\ntype MP4Header struct {\n\tMP4BoxHeader\n}\n```\n\n```go\ntype MediaBox struct {\n\tMP4BoxHeader // standard header\n\n\tMhb MediaHeaderBox // the first child box(header box)\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/36\n\nBox Type: mdia Container: Track Box ('trak') Mandatory: Yes Quantity: Exactly one\n\nThe media declaration container contains all the objects that declare information about the media data within a track.\n\n```go\ntype MediaDataBox struct {\n\tMP4BoxHeader // standard header\n\n\tData []byte // 8 bits array, is the contained media data.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/29\n\nBox Type: mdat Container: File Mandatory: No Quantity: Zero or more\n\n```go\ntype MediaHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tCreationTime     interface{} // int64 or int32, is an integer that declares the creation time of the presentation (in seconds since midnight, Jan. 1, 1904, in UTC time)\n\tModificationTime interface{} // int64 or int32, is an integer that declares the most recent time the presentation was modified (in seconds since midnight, Jan. 1, 1904, in UTC time)\n\tTimeScale        uint32      // 32 bits, is an integer that specifies the time-scale for the entire presentation; this is the number of time units that pass in one second. For example, a time coordinate system that measures time in sixtieths of a second has a time scale of 60.\n\tDuration         interface{} // int64 or int32, is an integer that declares length of the presentation (in the indicated timescale). This property is derived from the presentation's tracks: the value of this field corresponds to the duration of the longest track in the presentation. If the duration cannot be determined then duration is set to all 1s.\n\tPad              byte        // 1 bit,\n\tLanguage         [2]byte     // 15 bits, unsigned int(5)[3], declares the language code for this media. See ISO 639-2/T for the set of three charactercodes. Each character is packed as the difference between its ASCII value and 0x60. Since the code is confined to being three lower-case letters, these values are strictly positive\n\tPreDefined       uint16      // 16 bits,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/36\n\nBox Type: mdhd Container: Media Box ('mdia') Mandatory: Yes Quantity: Exactly one\n\nThe media header declares overall information that is media-independent, and relevant to characteristics of the media in a track.\n\n```go\ntype MediaInformationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/38\n\nBox Type: minf Container: Media Box ('mdia') Mandatory: Yes Quantity: Exactly one\n\nThis box contains all the objects that declare characteristic information of the media in the track.\n\n```go\ntype MediaInformationHeaderBoxes struct {\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/38\n\nBox Types: vmhd, smhd, hmhd, nmhd Container: Media Information Box (‘minf’) Mandatory: Yes Quantity: Exactly one specific media header shall be present\n\nThere is a different media information header for each track type (corresponding to the media handler-type); the matching header shall be present, which may be one of those defined here, or one defined in a derived specification\n\n```go\ntype MetaBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tPrimaryResource PrimaryItemBox     // optional\n\tFileLocations   DataInformationBox // optional\n\tItemLocations   ItemLocationBox    // optional\n\tProtections     ItemProtectionBox  // optional\n\tItemInfos       ItemInfoBox        // optional\n\tIPMPControl     IPMPControlBox     // optional\n\tItemRefs        ItemReferenceBox   // optional\n\tItemData        ItemDataBox        // optional\n\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/81\n\nBox Type: meta Container: File, Movie Box (‘moov’), Track Box (‘trak’), or Additional Metadata Container Box (‘meco’) Mandatory: No Quantity: Zero or one (in File, ‘moov’, and ‘trak’), One or more (in ‘meco’)\n\n```go\ntype MetaDataSampleEntry struct{}\n```\n\n```go\ntype MetaboxRelationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tFirstMetaboxHandlerType  uint32 // 32 bits, indicates the first meta box to be related.\n\tSecondMetaboxHandlerType uint32 // 32 bits,  indicates the second meta box to be related.\n\tMetaboxRelation          uint8  // 8 bits, indicates the relation between the two meta boxes.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/88\n\nBox Type: mere Container: Additional Metadata Container Box (‘meco’) Mandatory: No Quantity: Zero or more\n\nThe metabox relation box indicates a relation between two meta boxes at the same level, i.e., the top level of the file, the Movie Box, or Track Box. The relation between two meta boxes is unspecified if there is no metabox relation box for those meta boxes. Meta boxes are referenced by specifying their handler types.\n\n```go\ntype MovieBox struct {\n\tMP4BoxHeader // standard header\n\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/30\n\nBox Type: moov Container: File Mandatory: Yes Quantity: Exactly one\n\nThe metadata for a presentation is stored in the single Movie Box which occurs at the top-level of a file. Normally this box is close to the beginning or end of the file, though this is not required\n\n```go\nfunc NewMovieBox() (box *MovieBox)\n```\n\n```go\ntype MovieExtendsBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/64\n\nBox Type: mvex Container: Movie Box (‘moov’) Mandatory: No Quantity: Zero or one\n\n```go\ntype MovieExtendsHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/65\n\nBox Type: mehd Container: Movie Extends Box(‘mvex’) Mandatory: No Quantity: Zero or one\n\nThe Movie Extends Header is optional, and provides the overall duration, including fragments, of a fragmented movie. If this box is not present, the overall duration must be computed by examining each fragment.\n\n```go\ntype MovieFragmentBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/66\n\nBox Type: moof Container: File Mandatory: No Quantity: Zero or more\n\n```go\ntype MovieFragmentHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSequenceNumber uint32 // 32 bits, the ordinal number of this fragment, in increasing order\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/66\n\nBox Type: mfhd Container: Movie Fragment Box ('moof') Mandatory: Yes Quantity: Exactly one\n\nThe movie fragment header contains a sequence number, as a safety check. The sequence number usually starts at 1 and must increase for each movie fragment in the file, in the order in which they occur. This allows readers to verify integrity of the sequence; it is an error to construct a file where the fragments are out of sequence.\n\n```go\ntype MovieFragmentRandomAccessBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/69\n\nBox Type: mfra Container: File Mandatory: No Quantity: Zero or one\n\n```go\ntype MovieFragmentRandomAccessOffsetBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSize uint32 // 32 bits, is an integer gives the number of bytes of the enclosing ‘mfra’ box. This field is placed at the last of the enclosing box to assist readers scanning from the end of the file in finding the ‘mfra’ box.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/71\n\nBox Type: mfro Container: Movie Fragment Random Access Box (‘mfra’) Mandatory: Yes Quantity: Exactly one\n\nThe Movie Fragment Random Access Offset Box provides a copy of the length field from the enclosing Movie Fragment Random Access Box. It is placed last within that box, so that the size field is also last in the enclosing Movie Fragment Random Access Box. When the Movie Fragment Random Access Box is also last in the file this permits its easy location. The size field here must be correct. However, neither the presence of the Movie Fragment Random Access Box, nor its placement last in the file, are assured.\n\n```go\ntype MovieHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tCreationTime     interface{} // uint64 or uint32, is an integer that declares the creation time of the presentation (in seconds since midnight, Jan. 1, 1904, in UTC time)\n\tModificationTime interface{} // uint64 or uint32, is an integer that declares the most recent time the presentation was modified (in seconds since midnight, Jan. 1, 1904, in UTC time)\n\tTimeScale        uint32      // 32 bits, is an integer that specifies the time-scale for the entire presentation; this is the number of time units that pass in one second. For example, a time coordinate system that measures time in sixtieths of a second has a time scale of 60.\n\tDuration         interface{} // uint64 or uint32, is an integer that declares length of the presentation (in the indicated timescale). This property is derived from the presentation's tracks: the value of this field corresponds to the duration of the longest track in the presentation. If the duration cannot be determined then duration is set to all 1s.\n\tRate             int32       // 32 bits, is a fixed point 16.16 number that indicates the preferred rate to play the presentation; 1.0 (0x00010000) is normal forward playback\n\tVolume           int16       // 16 bits, is a fixed point 8.8 number that indicates the preferred playback volume. 1.0 (0x0100) is full volume.\n\tReserved1        int16       // 16 bits, bit[16]\n\tReserved2        [2]uint32   // 32 bits array, const unsigned int(32)[2]\n\tMatrix           [9]int32    // 32 bits array, provides a transformation matrix for the video; (u,v,w) are restricted here to (0,0,1), hex values(0,0,0x40000000).\n\tPreDefined       [6]int32    // 32 bits array, bit(32)[6]\n\tNextTrackID      uint32      // 32 bits, is a non-zero integer that indicates a value to use for the track ID of the next track to be added to this presentation. Zero is not a valid track ID value. The value of next_track_ID shall be larger than the largest track-ID in use. If this value is equal to all 1s (32-bit maxint), and a new media track is to be added, then a search must be made in the file for an unused track identifier.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/31\n\nBox Type: mvhd Container: Movie Box ('moov') Mandatory: Yes Quantity: Exactly one\n\nThis box defines overall information which is media-independent, and relevant to the entire presentation considered as a whole\n\n```go\ntype NALUHeader struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype NALUnit struct {\n\tNALUHeader\n\tRBSP\n}\n```\n\n```go\ntype NullMediaHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n}\n```\nBox Types: nmhd Streams other than visual and audio (e.g., timed metadata streams) may use a null Media Header Box, as defined here.\n\n```go\ntype OriginalFormatBox struct {\n\tMP4BoxHeader // standard header\n\n\tDataFormat uint32 // 32 bits, is the four-character-code of the original un-transformed sample entry (e.g. “mp4v” if the stream contains protected or restricted MPEG-4 visual material).\n}\n```\n\n```go\ntype PaddingBitsBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSampleCount uint32             // 32 bits, counts the number of samples in the track; it should match the count in other tables\n\tTable       []PaddingBitsTable // Padding Bits Table, (sample count + 1) / 2 elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/60\n\nBox Type: padb Container: Sample Table (‘stbl’) Mandatory: No Quantity: Zero or one\n\nIn some streams the media samples do not occupy all bits of the bytes given by the sample size, and are padded at the end to a byte boundary. In some cases, it is necessary to record externally the number of padding bits used. This table supplies that information.\n\n```go\ntype PaddingBitsTable struct {\n\tReserved1 byte // 1 bit,\n\tPad1      byte // 3 bits, a value from 0 to 7, indicating the number of bits at the end of sample (i*2)+1.\n\tReserved2 byte // 1 bit,\n\tPad2      byte // 3 bits, a value from 0 to 7, indicating the number of bits at the end of sample (i*2)+2.\n}\n```\n\n```go\ntype PartitionEntry struct {\n\tFPB   FilePartitionBox //\n\tFECRB FECReservoirBox  //optional\n\tFRB   FileReservoirBox //optional\n}\n```\nBox Type: paen\n\n```go\ntype PixelAspectRatioBox struct {\n\tMP4BoxHeader // standard header\n\n\tHSpacing uint32 // 32 bits, define the relative width and height of a pixel;\n\tVSpacing uint32 // 32 bits, define the relative width and height of a pixel;\n}\n```\nBox Types: pasp\n\n```go\ntype PrimaryItemBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tItemID uint16 // 16 bits, is the identifier of the primary item\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/93\n\nBox Type: pitm Container: Meta box (‘meta’) Mandatory: No Quantity: Zero or one\n\nFor a given handler, the primary data may be one of the referenced items when it is desired that it be stored elsewhere, or divided into extents; or the primary metadata may be contained in the meta-box (e.g. in an XML box). Either this box must occur, or there must be a box within the meta-box (e.g. an XML box) containing the primary information in the format required by the identified handler.\n\n```go\ntype ProducerReferenceTimeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tReferenceTrackID uint32      // 32 bits, provides the track_ID for the reference track.\n\tNtpTimestamp     uint64      // 64 bits, indicates a UTC time in NTP format corresponding to decoding_time.\n\tMediaTime        interface{} // uint32 or uint64, corresponds to the same time as ntp_timestamp, but in the time units used for the reference track, and is measured on this media clock as the media is produced.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/111\n\nBox Type: prft Container: File Mandatory: No Quantity: Zero or more\n\n```go\ntype ProgressiveDownloadInformationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tRate         uint32 // 32 bits, is a download rate expressed in bytes/second\n\tInitialDelay uint32 // 32 bits, is the suggested delay to use when playing the file, such that if download continues at the given rate, all data within the file will arrive in time for its use and playback should not need to stall.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/30\n\nBox Types: pdin Container: File Mandatory: No Quantity: Zero or One\n\n```go\ntype ProtectionSchemeInfoBox struct {\n\tMP4BoxHeader // standard header\n\n\tOriginalFormat OriginalFormatBox    //\n\tType           SchemeTypeBox        // optional\n\tInfo           SchemeInformationBox // optional\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/92\n\nBox Types: sinf Container: Protected Sample Entry, or Item Protection Box (‘ipro’) Mandatory: Yes Quantity: One or More\n\n```go\ntype RBSP interface {\n}\n```\n\n```go\ntype SPSInfo struct {\n\tProfileIdc uint\n\tLevelIdc   uint\n\n\tMbWidth  uint\n\tMbHeight uint\n\n\tCropLeft   uint\n\tCropRight  uint\n\tCropTop    uint\n\tCropBottom uint\n\n\tWidth  uint\n\tHeight uint\n}\n```\n\n```go\nfunc ParseSPS(data []byte) (self SPSInfo, err error)\n```\n\n```go\ntype SampleAuxiliaryInformationOffsetsBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/63\n\nBox Type: saio Container: Sample Table Box (‘stbl’) or Track Fragment Box ('traf') Mandatory: No Quantity: Zero or More\n\n```go\ntype SampleAuxiliaryInformationSizesBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTable interface{} // SampleAuxiliaryInformationSizesTable1 or SampleAuxiliaryInformationSizesTable2.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/62\n\nBox Type: saiz Container: Sample Table Box (‘stbl’) or Track Fragment Box ('traf') Mandatory: No Quantity: Zero or More\n\n```go\ntype SampleAuxiliaryInformationSizesTable1 struct {\n\tAuxInfoType           uint32 // 32 bits,\n\tAuxInfoTypeParameter  uint32 // 32 bits,\n\tDefaultSampleInfoSize uint8  // 8 bits,  is an integer specifying the sample auxiliary information size for the case where all the indicated samples have the same sample auxiliary information size. If the size varies then this field shall be zero.\n\tSampleCount           uint32 // 32 bits,\n}\n```\n\n```go\ntype SampleAuxiliaryInformationSizesTable2 struct {\n\tDefaultSampleInfoSize uint8  // 8 bits,  is an integer specifying the sample auxiliary information size for the case where all the indicated samples have the same sample auxiliary information size. If the size varies then this field shall be zero.\n\tSampleCount           uint32 // 32 bits,\n}\n```\n\n```go\ntype SampleDescriptionBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32 // 32 bits, is an integer that gives the number of entries in the following table\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/40\n\nBox Types: stsd Container: Sample Table Box ('stbl') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype SampleEntry struct {\n\tReserved           [6]uint8 // 48 bits,\n\tDataReferenceIndex uint16   // 16 bits, 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.\n}\n```\nis the appropriate sample entry\n\n```go\ntype SampleGroupDescriptionBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tGroupingType uint32 // 32 bits, is an integer that identifies the SampleToGroup box that is associated with this sample group description.\n\tEntryCount   uint32 // 32 bits, is an integer that gives the number of entries in the following table.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/76\n\nBox Type: sgpd Container: Sample Table Box (‘stbl’) or Track Fragment Box (‘traf’) Mandatory: No Quantity: Zero or more, with one for each Sample to Group Box.\n\n```go\ntype SampleGroupDescriptionEntry struct{}\n```\n\n```go\ntype SampleSizeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSampleSize  uint32      // 32 bits, is integer specifying the default sample size. If all the samples are the same size, this field contains that size value. If this field is set to 0, then the samples have different sizes, and those sizes are stored in the sample size table. If this field is not 0, it specifies the constant sample size, and no array follows.\n\tSampleCount uint32      // 32 bits, is an integer that gives the number of samples in the track; if sample-size is 0, then it is also the number of entries in the following table.\n\tEntrySize   interface{} // 32 bits array, SampleCount elements, is an integer specifying the size of a sample, indexed by its number.\n}\n```\nBox Type: stsz\n\n```go\ntype SampleSizeBoxes struct{}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/57\n\nBox Type: stsz, stz2 Container: Sample Table Box (‘stbl’) Mandatory: Yes Quantity: Exactly one variant must be present\n\n```go\ntype SampleTableBox struct {\n\tMP4BoxHeader // standard header\n}\n```\n\\-------------------------------------------------------------------------------------------------------\n\nISO\\_IEC\\_14496-12\\_2012.pdf Page/40\n\nBox Type: stbl Container: Media Information Box ('minf') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype SampleToChunkBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32               // 32 bits, is an integer that gives the number of entries in the following table\n\tTable      []SampleToChunkTable // Sample To Chunk Table, entry count elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/58\n\nBox Type: stsc Container: Sample Table Box ('stbl') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype SampleToChunkTable struct {\n\tFirstChunk             []uint32 // 32 bits, is an integer that gives the index of the first chunk in this run of chunks that share the same samples-per-chunk and sample-description-index; the index of the first chunk in a track has the value 1 (the first_chunk field in the first record of this box has the value 1, identifying that the first sample maps to the first chunk).\n\tSamplesPerChunk        []uint32 // 32 bits, is an integer that gives the number of samples in each of these chunks\n\tSampleDescriptionIndex []uint32 // 32 bits, is an integer that gives the index of the sample entry that describes the samples in this chunk. The index ranges from 1 to the number of sample entries in the Sample Description Box\n}\n```\n\n```go\ntype SampleToGroupBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tGroupingType uint32               // 32 bits, is an integer that identifies the type (i.e. criterion used to form the sample groups) of the sample grouping and links it to its sample group description table with the same value for grouping type. At most one occurrence of this box with the same value for grouping_type (and, if used, grouping_type_parameter) shall exist for a track.\n\tEntryCount   uint32               // 32 bits, is an integer that gives the number of entries in the following table.\n\tTable        []SampleToGroupTable // Sample To Group Table, entry count elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/75\n\nBox Type: sbgp Container: Sample Table Box (‘stbl’) or Track Fragment Box (‘traf’) Mandatory: No Quantity: Zero or more.\n\n```go\ntype SampleToGroupTable struct {\n\tSampleCount           uint32 // 32 bits, is an integer that gives the number of consecutive samples with the same sample group descriptor. If the sum of the sample count in this box is less than the total sample count, then the reader should effectively extend it with an entry that associates the remaining samples with no group. It is an error for the total in this box to be greater than the sample_count documented elsewhere, and the reader behaviour would then be undefined.\n\tGroupDescriptionIndex uint32 // 32 bits, is an integer that gives the index of the sample group entry which describes the samples in this group. The index ranges from 1 to the number of sample group entries in the SampleGroupDescription Box, or takes the value 0 to indicate that this sample is a member of no group of this type.\n}\n```\n\n```go\ntype SchemeInformationBox struct {\n\tMP4BoxHeader // standard header\n\n\tSchemeSpecificData []SchemeTypeBox\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/94\n\nBox Types: schi Container: Protection Scheme Information Box (‘sinf’), Restricted Scheme Information Box (‘rinf’), or SRTP Process box (‘srpp‘) Mandatory: No Quantity: Zero or one The Scheme Information Box is a container Box that is only interpreted by the scheme being used. Any information the encryption or restriction system needs is stored here. The content of this box is a series of boxes whose type and format are defined by the scheme declared in the Scheme Type Box.\n\n```go\ntype SchemeTypeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSchemeType    uint32 // 32 bits, is the code defining the protection or restriction scheme.\n\tSchemeVersion uint32 // 32 bits, is the version of the scheme (used to create the content)\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/93\n\nBox Types: schm Container: Protection Scheme Information Box (‘sinf’), Restricted Scheme Information Box (‘rinf’), or SRTP Process box (‘srpp‘) Mandatory: No\n\nQuantity: Zero or one in ‘sinf’, depending on the protection structure; Exactly one in ‘rinf’ and ‘srpp’ The Scheme Type Box (‘schm’) identifies the protection or restriction scheme.\n\n```go\ntype SegmentIndexBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tReferenceID              uint32              // 32 bits,\n\tTimeScale                uint32              // 32 bits,\n\tEarliestPresentationTime interface{}         // uint32 or uint64,\n\tFirstOffset              interface{}         // uint32 or uint64,\n\tReserved                 uint16              // 16 bits,\n\tReferenceCount           uint16              // 16 bits,\n\tTable                    []SegmentIndexTable // Segment Index Table, ReferenceCount elements\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/106\n\nBox Type: sidx Container: File Mandatory: No Quantity: Zero or more\n\n```go\ntype SegmentIndexTable struct {\n\tReferenceType      byte   // 1 bit\n\tReferencedSize     uint32 // 32 bits\n\tSubSegmentDuration uint32 // 32 bits,\n\tStartsWithSAP      byte   // 1 bit\n\tSAPType            byte   // 3 bits,\n\tSAPDeltaTime       uint32 // 28 bits,\n}\n```\n\n```go\ntype SendPacket struct {\n\tTimestamp uint32\n\tPacket    *AVPacket\n}\n```\n\n```go\nfunc NewSendPacket(p *AVPacket, timestamp uint32) (result *SendPacket)\n```\n\n```go\nfunc (packet *SendPacket) Recycle()\n```\n\n```go\ntype ShadowSyncSampleBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32                  // 32 bits, is an integer that gives the number of entries in the following table.\n\tTable      []ShadowSyncSampleTable // Shadow Sync Sample Table, entry count elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/52\n\nBox Type: stsh Container: Sample Table Box (‘stbl’) Mandatory: No Quantity: Zero or one\n\n```go\ntype ShadowSyncSampleTable struct {\n\tShadowedSampleNumber uint32 // 32 bits, gives the number of a sample for which there is an alternative sync sample.\n\tSyncSampleNumber     uint32 // 32 bits, gives the number of the alternative sync sample.\n}\n```\n\n```go\ntype SingleItemTypeReferenceBox struct {\n\tMP4BoxHeader // standard header\n\n\tFromItemID     uint16                         // 16 bits, contains the ID of the item that refers to other items\n\tReferenceCount uint16                         // 16 bits, is the number of references\n\tTable          []SingleItemTypeReferenceTable // Single Item Type Reference Table, ReferenceCount elements.\n}\n```\n\n```go\ntype SingleItemTypeReferenceTable struct {\n\tToItemID uint16 // 16 bits, contains the ID of the item referred to\n}\n```\n\n```go\ntype SoundMediaHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tBalance  int16  // 16 bits, is a fixed-point 8.8 number that places mono audio tracks in a stereo space; 0 is centre (the normal value); full left is -1.0 and full right is 1.0\n\tReserved uint16 // 16 bits,\n}\n```\nBox Types: smhd The sound media header contains general presentation information, independent of the coding, for audio media. This header is used for all tracks containing audio.\n\n```go\ntype SubSampleCountTable struct {\n\tSubsampleSize     interface{} // uint16 or uint32, is an integer that specifies the size, in bytes, of the current sub-sample\n\tSubsamplePriority uint8       // 8 bits, is an integer specifying the degradation priority for each sub-sample. Higher values of subsample_priority, indicate sub-samples which are important to, and have a greater impact on, the decoded quality.\n\tDiscardAble       uint8       // 8 bits, equal to 0 means that the sub-sample is required to decode the current sample, while equal to 1 means the sub-sample is not required to decode the current sample but may be used for enhancements, e.g., the sub-sample consists of supplemental enhancement information (SEI) messages.\n\tReserved          uint32      // 32 bits,\n}\n```\n\n```go\ntype SubSampleInformationBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32                      // 32 bits, is an integer that gives the number of entries in the following table.\n\tTable      []SubSampleInformationTable // Sub-Sample Information Table, entry count elements.\n\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/61\n\nBox Type: subs Container: Sample Table Box (‘stbl’) or Track Fragment Box (‘traf’) Mandatory: No Quantity: Zero or one\n\n```go\ntype SubSampleInformationTable struct {\n\tSampleDelta    uint32                // 32 bits, is an integer that specifies the sample number of the sample having sub-sample structure. It is coded as the difference between the desired sample number, and the sample number indicated in the previous entry. If the current entry is the first entry, the value indicates the sample number of the first sample having sub-sample information, that is, the value is the difference between the sample number and zero (0).\n\tSubsampleCount uint16                // 16 bits, is an integer that specifies the number of sub-sample for the current sample. If there is no sub-sample structure, then this field takes the value 0.\n\tCountTable     []SubSampleCountTable // Sub-Sample Information Table1, subsample count elements.\n}\n```\n\n```go\ntype SubTrack struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/100\n\nBox Type: strk Container: User Data box (‘udta’) of the corresponding Track box (‘trak’) Mandatory: No Quantity: Zero or more\n\nThis box contains objects that define and provide information about a sub track in the present track.\n\n```go\ntype SubTrackDefinition struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/101\n\nBox Type: strd Container: Sub Track box (‘strk’) Mandatory: Yes Quantity: One\n\nThis box contains objects that provide a definition of the sub track.\n\n```go\ntype SubTrackInformation struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSwitchGroup    int16    // 16 bits,\n\tAlternateGroup int16    // 16 bits,\n\tSubTrackID     uint32   // 32 bits, is an integer. A non-zero value uniquely identifies the sub track locally within the track. A zero value (default) means that sub track ID is not assigned.\n\tAttributeList  []uint32 // 32 bits array, is a list, to the end of the box, of attributes. The attributes in this list should be used as descriptions of sub tracks or differentiating criteria for tracks and sub tracks in the same alternate or switch group\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/100\n\nBox Type: stri Container: Sub Track box (‘strk’) Mandatory: Yes Quantity: One\n\n```go\ntype SubsegmentIndexBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSubSegmentCount uint32                 // 32 bits, is a positive integer specifying the number of subsegments for which partial subsegment information is specified in this box. subsegment_count shall be equal to reference_count (i.e., the number of movie fragment references) in the immediately preceding Segment Index box.\n\tTable           []SubsegmentIndexTable // Subsegment Index Table, SubSegmentCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/109\n\nBox Type: ssix Container: File Mandatory: No Quantity: Zero or more\n\n```go\ntype SubsegmentIndexTable struct {\n\tRangesCount uint32                  // 32 bits, specifies the number of partial subsegment levels into which the media data is grouped. This value shall be greater than or equal to 2.\n\tRtable      []SubsegmentRangesTable // Subsegment Ranges Table, RangesCount elements.\n}\n```\n\n```go\ntype SubsegmentRangesTable struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype SyncSampleBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount   uint32   // 32 bits, is an integer that gives the number of entries in the following table. If entry_count is zero, there are no sync samples within the stream and the following table is empty\n\tSampleNumber []uint32 // 32 bits array, entry count elements. gives the numbers of the samples that are sync samples in the stream.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/51\n\nBox Type: stss Container: Sample Table Box (‘stbl’) Mandatory: No Quantity: Zero or one\n\nThis box provides a compact marking of the sync samples within the stream. The table is arranged in strictly increasing order of sample number. If the sync sample box is not present, every sample is a sync sample.\n\n```go\ntype TextMetaDataSampleEntry struct {\n\tContentEncoding string     // optional, is a null-terminated string in UTF-8 characters, and provides a MIME type which identifies the content encoding of the timed metadata\n\tMimeFormat      string     // string, provides a MIME type which identifies the content format of the timed metadata. Examples for this field are ‘text/html’ and ‘text/plain’.\n\tBrb             BitRateBox // optional\n}\n```\n\n```go\ntype TimeToSampleBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tEntryCount uint32              // 32 bits, is an integer that gives the number of entries in the following table\n\tTable      []TimeToSampleTable // Time To Sample Table , EntryCount elements\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/48\n\nBox Type: stts Container: Sample Table Box ('stbl') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype TimeToSampleTable struct {\n\tSampleCount []uint32 // 32 bits, is an integer that counts the number of consecutive samples that have the given duration\n\tSampleDelta []uint32 // 32 bits, is an integer that gives the delta of these samples in the time-scale of the media.\n}\n```\n\n```go\ntype TrackBox struct {\n\tMP4BoxHeader // standard header\n\n\tThb TrackHeaderBox // the first child box(header box)\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/32\n\nBox Type: trak Container: Movie Box ('moov') Mandatory: Yes Quantity: One or more\n\n```go\ntype TrackExtendsBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTrackID                       uint32 // 32 bits, identifies the track; this shall be the track ID of a track in the Movie Box\n\tDefaultSampleDescriptionIndex uint32 // 32 bits,\n\tDefaultSampleDuration         uint32 // 32 bits,\n\tDefaultSampleSize             uint32 // 32 bits,\n\tDefaultSampleFlags            uint32 // 32 bits,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/65\n\nBox Type: trex Container: Movie Extends Box (‘mvex’) Mandatory: Yes Quantity: Exactly one for each track in the Movie Box\n\n```go\ntype TrackFragmentBaseMediaDecodeTimeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tBaseMediaDecodeTime interface{} // uint32 or uint64, is an integer equal to the sum of the decode durations of all earlier samples in the media, expressed in the media's timescale. It does not include the samples added in the enclosing track fragment.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/71\n\nBox Type: tfdt Container: Track Fragment box (‘traf’) Mandatory: No Quantity: Zero or one\n\n```go\ntype TrackFragmentBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/67\n\nBox Type: traf Container: Movie Fragment Box ('moof') Mandatory: No Quantity: Zero or more\n\n```go\ntype TrackFragmentHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTrackID uint32 // 32 bits,\n\n\t// all the following are optional fields\n\tBaseDataOffset         uint64 // 64 bits, the base offset to use when calculating data offsets\n\tSampleDescriptionIndex uint32 // 32 bits,\n\tDefaultSampleDuration  uint32 // 32 bits,\n\tDefaultSampleSize      uint32 // 32 bits,\n\tDefaultSampleFlags     uint32 // 32 bits,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/67\n\nBox Type: tfhd Container: Track Fragment Box ('traf') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype TrackFragmentRandomAccessBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTrackID               uint32                           // 32 bits, is an integer identifying the track_ID.\n\tReserved              uint32                           // 26 bits,\n\tLengthSizeOfTrafNum   byte                             // 2 bits, indicates the length in byte of the traf_number field minus one.\n\tLengthSizeOfTrunNum   byte                             // 2 bits, indicates the length in byte of the trun_number field minus one.\n\tLengthSizeOfSampleNum byte                             // 2 bits, indicates the length in byte of the sample_number field minus one.\n\tNumberOfEntry         uint32                           // 32 bits, is an integer that gives the number of the entries for this track. If this value is zero, it indicates that every sample is a sync sample and no table entry follows.\n\tTable                 []TrackFragmentRandomAccessTable // Track Fragment RandomAccess Table 1, NumberOfEntry elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/70\n\nBox Type: tfra Container: Movie Fragment Random Access Box (‘mfra’) Mandatory: No Quantity: Zero or one per track\n\n```go\ntype TrackFragmentRandomAccessTable struct {\n\tTime         interface{} // uint32 or uint64, is 32 or 64 bits integer that indicates the presentation time of the sync sample in units defined in the ‘mdhd’ of the associated track.\n\tMoofoffset   interface{} // uint32 or uint64, is 32 or 64 bits integer that gives the offset of the ‘moof’ used in this entry. Offset is the byte-offset between the beginning of the file and the beginning of the ‘moof’.\n\tTrafNumber   interface{} // unsigned int((length_size_of_traf_num+1) * 8). indicates the ‘traf’ number that contains the sync sample. The number ranges from 1 (the first ‘traf’ is numbered 1) in each ‘moof’.\n\tTrunNumber   interface{} // unsigned int((length_size_of_trun_num+1) * 8). indicates the ‘trun’ number that contains the sync sample. The number ranges from 1 in each ‘traf’\n\tSampleNumber interface{} // unsigned int((length_size_of_sample_num+1) * 8) . indicates the sample number of the sync sample. The number ranges from 1 in each ‘trun’.\n}\n```\n\n```go\ntype TrackFragmentRunBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSampleCount uint32 // 32 bits, the number of samples being added in this run; also the number of rows in the following table (the rows can be empty)\n\n\t// the following are optional fields\n\tDataOffset       int32  // 32 bits, signed, is added to the implicit or explicit data_offset established in the track fragment header.\n\tFirstSampleFlags uint32 // 32 bits, provides a set of flags for the first sample only of this run.\n\n\t// all fields in the following array are optional\n\tTable []TrackFragmentRunTable // Track Fragment Run Table 1, SampleCount elements.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/68\n\nBox Type: trun Container: Track Fragment Box ('traf') Mandatory: No Quantity: Zero or more\n\n```go\ntype TrackFragmentRunTable struct {\n\tSampleDuration              uint32      // 32 bits,\n\tSampleSize                  uint32      // 32 bits,\n\tSampleFlags                 uint32      // 32 bits,\n\tSampleCompositionTimeOffset interface{} // uint32 or int32,\n}\n```\n\n```go\ntype TrackGroupBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/35\n\nBox Type: trgr Container: Track Box (‘trak’) Mandatory: No Quantity: Zero or one\n\n```go\ntype TrackGroupTypeBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTrackGroupID uint32 // 32 bits, indicates the grouping type and shall be set to one of the following values, or a value registered, or a value from a derived specification or registration\n}\n```\n\n```go\ntype TrackHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tCreationTime     interface{} // uint64 or uint32,\n\tModificationTime interface{} // uint64 or uint32,\n\tTrackID          uint32      // 32 bits, is an integer that uniquely identifies this track over the entire life-time of this presentation. Track IDs are never re-used and cannot be zero\n\tReserved1        uint32      // 32 bits,\n\tDuration         interface{} // uint64 or uint32,\n\tReserved2        [2]uint32   // 32 bits array,\n\tLayer            int16       // 16 bits, specifies the front-to-back ordering of video tracks; tracks with lower numbers are closer to the viewer. 0 is the normal value, and -1 would be in front of track 0, and so on\n\tAlternateGroup   int16       // 16 bits,\n\tVolume           int16       // 16 bits, if track_is_audio 0x0100 else 0\n\tReserved3        uint16      // 16 bits,\n\tMatrix           [9]int32    // 32 bits array, provides a transformation matrix for the video; (u,v,w) are restricted here to (0,0,1), hex (0,0,0x40000000). { 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 }\n\tWidth            uint32      // 32 bits,\n\tHeight           uint32      // 32 bits,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/32\n\nBox Type: tkhd Container: Track Box ('trak') Mandatory: Yes Quantity: Exactly one\n\n```go\ntype TrackReferenceBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/34\n\nBox Type: tref Container: Track Box (‘trak’) Mandatory: No Quantity: Zero or one\n\n```go\ntype TrackReferenceTypeBox struct {\n\tMP4BoxHeader // standard header\n\n\tTrackIDs []uint32 // 32 bits, is an integer that provides a reference from the containing track to another track in the presentation. track_IDs are never re-used and cannot be equal to zero\n}\n```\n\n```go\ntype TrackSelectionBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tSwitchGroup   int32    // 32 bits, is an integer that specifies a group or collection of tracks. If this field is 0 (default value) or if the Track Selection box is absent there is no information on whether the track can be used for switching during playing or streaming. If this integer is not 0 it shall be the same for tracks that can be used for switching between each other. Tracks that belong to the same switch group shall belong to the same alternate group. A switch group may have only one member.\n\tAttributeList []uint32 // 32 bits array, to end of the box, is a list, to the end of the box, of attributes. The attributes in this list should be used as descriptions of tracks or differentiation criteria for tracks in the same alternate or switch group. Each differentiating attribute is associated with a pointer to the field or information that distinguishes the track.\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/79\n\nBox Type: tsel Container: User Data Box (‘udta’) Mandatory: No Quantity: Zero or One\n\nThe track selection box is contained in the user data box of the track it modifies.\n\n```go\ntype URIBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tTheURI string // string, is a URI formatted according to the rules in 6.2.4\n}\n```\n\n```go\ntype URIInitBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tUriInitializationData []uint8 // 8 bits array,  is opaque data whose form is defined in the documentation of the URI form.\n}\n```\n\n```go\ntype URIMetaSampleEntry struct {\n\tTheLabel URIBox\n\tInit     URIInitBox // optional\n\n}\n```\n\n```go\ntype UserDataBox struct {\n\tMP4BoxHeader // standard header\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/78\n\nBox Type: udta Container: Movie Box (‘moov’) or Track Box (‘trak’) Mandatory: No Quantity: Zero or one\n\n```go\ntype VideoMediaHeaderBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tGraphicsMode uint16    // 16 bits, specifies a composition mode for this video track, from the following enumerated set, which may be extended by derived specifications: copy = 0 copy over the existing image\n\tOpcolor      [3]uint16 // 16 bits array, is a set of 3 colour values (red, green, blue) available for use by graphics modes\n}\n```\nBox Types: vmhd The video media header contains general presentation information, independent of the coding, for video media. Note that the flags field has the value 1.\n\n```go\ntype VisualSampleEntry struct {\n\tPreDefined1     uint16              // 16 bits,\n\tReserved1       uint16              // 16 bits,\n\tPreDefined2     [3]uint32           // 96 bits,\n\tWidth           uint16              // 16 bits, are the maximum visual width and height of the stream described by this sample description, in pixels\n\tHeight          uint16              // 16 bits, are the maximum visual width and height of the stream described by this sample description, in pixels\n\tHorizreSolution uint32              // 32 bits, fields give the resolution of the image in pixels-per-inch, as a fixed 16.16 number\n\tVertreSolution  uint32              // 32 bits, fields give the resolution of the image in pixels-per-inch, as a fixed 16.16 number\n\tReserved3       uint32              // 32 bits,\n\tFrameCount      uint16              // 16 bits, 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\n\tCompressorName  [32]string          // 32 string, 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.\n\tDepth           uint16              // 16 bits, takes one of the following values 0x0018 – images are in colour with no alpha\n\tPreDefined3     int16               // 16 bits,\n\tCab             CleanApertureBox    // optional, other boxes from derived specifications\n\tParb            PixelAspectRatioBox // optional, other boxes from derived specifications\n}\n```\n\n```go\ntype VisualSampleGroupEntry struct{}\n```\n\n```go\ntype XMLBox struct {\n\tMP4BoxHeader     // standard header\n\tMP4FullBoxHeader // full box header\n\n\tXML string // string,\n}\n```\nISO\\_IEC\\_14496-12\\_2012.pdf Page/82\n\nBox Type: ‘xml ‘ or ‘bxml’ Container: Meta box (‘meta’) Mandatory: No Quantity: Zero or one\n\nWhen the primary data is in XML format and it is desired that the XML be stored directly in the meta-box, one of these forms may be used. The Binary XML Box may only be used when there is a single well-defined binarization of the XML for that defined format as identified by the handler. Within an XML box the data is in UTF-8 format unless the data starts with a byte-order-mark (BOM), which indicates that the data is in UTF-16 format.\n\n```go\ntype XMLMetaDataSampleEntry struct {\n\tContentEncoding string     // optional, is a null-terminated string in UTF-8 characters, and provides a MIME type which identifies the content encoding of the timed metadata\n\tNameSpace       string     // string, gives the namespace of the schema for the timed XML metadata\n\tSchemaLocation  string     // optional, 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.\n\tBrb             BitRateBox // optional\n}\n```\n\n","path":"github.com/Monibuca/engine/avformat","name":"avformat","synopsis":"","isRedistributable":true}
