opus_in_isobmff.html 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <link rel="stylesheet" type="text/css" href="opus_in_isobmff.css"/>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Encapsulation of Opus in ISO Base Media File Format</title>
  7. </head>
  8. <body bgcolor="0x333333" text="#60B0C0">
  9. <b><u>Encapsulation of Opus in ISO Base Media File Format</u></b><br>
  10. <font size="2">last updated: April 28, 2016</font><br>
  11. <br>
  12. <div class="normal_link pre frame_box">
  13. Encapsulation of Opus in ISO Base Media File Format
  14. Version 0.6.8 (incomplete)
  15. Table of Contents
  16. <a href="#1">1</a> Scope
  17. <a href="#2">2</a> Normative References
  18. <a href="#3">3</a> Terms and Definitions
  19. <a href="#4">4</a> Design Rules of Encapsulation
  20. <a href="#4.1">4.1</a> File Type Indentification
  21. <a href="#4.2">4.2</a> Overview of Track Structure
  22. <a href="#4.3">4.3</a> Definitions of Opus sample
  23. <a href="#4.3.1">4.3.1</a> Sample entry format
  24. <a href="#4.3.2">4.3.2</a> Opus Specific Box
  25. <a href="#4.3.3">4.3.3</a> Sample format
  26. <a href="#4.3.4">4.3.4</a> Duration of Opus sample
  27. <a href="#4.3.5">4.3.5</a> Sub-sample
  28. <a href="#4.3.6">4.3.6</a> Random Access
  29. <a href="#4.3.6.1">4.3.6.1</a> Random Access Point
  30. <a href="#4.3.6.2">4.3.6.2</a> Pre-roll
  31. <a href="#4.4">4.4</a> Trimming of Actual Duration
  32. <a href="#4.5">4.5</a> Channel Layout (informative)
  33. <a href="#4.6">4.6</a> Basic Structure (informative)
  34. <a href="#4.6.1">4.6.2</a> Initial Movie
  35. <a href="#4.6.2">4.6.3</a> Movie Fragments
  36. <a href="#4.7">4.7</a> Example of Encapsulation (informative)
  37. <a href="#5">5</a> Author's Address
  38. <a name="1"></a>
  39. 1 Scope
  40. This specification specifies the fundamental way of the encapsulation of Opus coded bitstreams in ISO Base Media
  41. file format and its derivatives. The encapsulation of Opus coded bitstreams in QuickTime file format is outside
  42. the scope of this specification.
  43. <a name="2"></a>
  44. 2 Normative References
  45. [1] ISO/IEC 14496-12:2015 Corrected version
  46. Information technology — Coding of audio-visual objects — Part 12: ISO base media file format
  47. [2] RFC 6716
  48. Definition of the Opus Audio Codec
  49. [3] draft-ietf-codec-oggopus-06
  50. Ogg Encapsulation for the Opus Audio Codec
  51. <a name="3"></a>
  52. 3 Terms and Definitions
  53. 3.1 active track
  54. enabled track from the non-alternate group or selected track from alternate group
  55. 3.2 actual duration
  56. duration constructed from valid samples
  57. 3.3 edit
  58. entry in the Edit List Box
  59. 3.4 padded samples
  60. PCM samples after decoding Opus sample(s) which are not valid samples
  61. An Opus bitstream always contains them partially at the beginning and may contain them in part at the end, as
  62. long as not physically removed yet at the beginning and/or the end.
  63. 3.5 priming samples
  64. padded samples at the beginning of the Opus bitstream
  65. 3.6 sample-accurate
  66. for any PCM sample, a timestamp exactly matching its sampling timestamp is present in the media timeline.
  67. 3.7 valid samples
  68. PCM samples after decoding Opus sample(s) corresponding to input PCM samples
  69. <a name="4"></a>
  70. 4 Design Rules of Encapsulation
  71. 4.1 File Type Indentification<a name="4.1"></a>
  72. This specification does not define any brand to declare files are conformant to this specification. However,
  73. files conformant to this specification shall contain at least one brand, which supports the requirements and the
  74. requirements described in this clause without contradiction, in the compatible brands list of the File Type Box.
  75. As an example, the minimal support of the encapsulation of Opus bitstreams in ISO Base Media file format requires
  76. the 'iso2' brand in the compatible brands list since support of roll groups is required.
  77. <a name="4.2"></a>
  78. 4.2 Overview of Track Structure
  79. This clause summarizes requirements of the encapsulation of Opus coded bitstream as media data in audio tracks
  80. in file formats compliant with the ISO Base Media File Format. The details are described in clauses after this
  81. clause.
  82. + The handler_type field in the Handler Reference Box shall be set to 'soun'.
  83. + The Media Information Box shall contain the Sound Media Header Box.
  84. + The codingname of the sample entry is 'Opus'.
  85. This specification does not define any encapsulation using MP4AudioSampleEntry with objectTypeIndication
  86. specified by the MPEG-4 Registration Authority (http://www.mp4ra.org/).
  87. See 4.3.1 Sample entry format to get the details about the sample entry.
  88. + The 'dOps' box is added to the sample entry to convey initializing information for the decoder.
  89. See 4.3.2 Opus Specific Box to get the details.
  90. + An Opus sample is exactly one Opus packet for each of different Opus bitstreams.
  91. See 4.3.3 Sample format to get the details.
  92. + Every Opus sample is a sync sample but requires pre-roll for every random access to get correct output.
  93. See 4.3.6 Random Access to get the details.
  94. <a name="4.3"></a>
  95. 4.3 Definitions of Opus sample
  96. 4.3.1 Sample entry format<a name="4.3.1"></a>
  97. For any track containing Opus bitstreams, at least one sample entry describing corresponding Opus bitstream
  98. shall be present inside the Sample Table Box. This version of the specification defines only one sample
  99. entry format named OpusSampleEntry whose codingname is 'Opus'. This sample entry includes exactly one Opus
  100. Specific Box defined in 4.3.2 as a mandatory box and indicates that Opus samples described by this sample
  101. entry are stored by the sample format described in 4.3.3.
  102. The syntax and semantics of the OpusSampleEntry is shown as follows.
  103. class OpusSampleEntry() extends AudioSampleEntry ('Opus'){
  104. OpusSpecificBox();
  105. }
  106. + channelcount:
  107. The channelcount field shall be set to the sum of the total number of Opus bitstreams and the number
  108. of Opus bitstreams producing two channels. This value is indentical with (M+N), where M is the value of
  109. the *Coupled Stream Count* field and N is the value of the *Stream Count* field in the *Channel Mapping
  110. Table* in the identification header defined in Ogg Opus [3].
  111. + samplesize:
  112. The samplesize field shall be set to 16.
  113. + samplerate:
  114. The samplerate field shall be set to 48000&lt&lt16.
  115. + OpusSpecificBox
  116. This box contains initializing information for the decoder as defined in 4.3.2.
  117. 4.3.2 Opus Specific Box<a name="4.3.2"></a>
  118. Exactly one Opus Specific Box shall be present in each OpusSampleEntry.
  119. The Opus Specific Box contains the Version field and this specification defines version 0 of this box.
  120. If incompatible changes occured in the fields after the Version field within the OpusSpecificBox in the
  121. future versions of this specification, another version will be defined.
  122. This box refers to Ogg Opus [3] at many parts but all the data are stored as big-endian format.
  123. The syntax and semantics of the Opus Specific Box is shown as follows.
  124. class ChannelMappingTable (unsigned int(8) OutputChannelCount){
  125. unsigned int(8) StreamCount;
  126. unsigned int(8) CoupledCount;
  127. unsigned int(8 * OutputChannelCount) ChannelMapping;
  128. }
  129. aligned(8) class OpusSpecificBox extends Box('dOps'){
  130. unsigned int(8) Version;
  131. unsigned int(8) OutputChannelCount;
  132. unsigned int(16) PreSkip;
  133. unsigned int(32) InputSampleRate;
  134. signed int(16) OutputGain;
  135. unsigned int(8) ChannelMappingFamily;
  136. if (ChannelMappingFamily != 0) {
  137. ChannelMappingTable(OutputChannelCount);
  138. }
  139. }
  140. + Version:
  141. The Version field shall be set to 0.
  142. In the future versions of this specification, this field may be set to other values. And without support
  143. of those values, the reader shall not read the fields after this within the OpusSpecificBox.
  144. + OutputChannelCount:
  145. The OutputChannelCount field shall be set to the same value as the *Output Channel Count* field in the
  146. identification header defined in Ogg Opus [3].
  147. + PreSkip:
  148. The PreSkip field indicates the number of the priming samples, that is, the number of samples at 48000 Hz
  149. to discard from the decoder output when starting playback. The value of the PreSkip field shall be at least
  150. 80 milliseconds' worth of PCM samples even when removing any number of Opus samples which may or may not
  151. contain the priming samples. The PreSkip field is not used for discarding the priming samples at the whole
  152. playback at all since it is informative only, and that task falls on the Edit List Box.
  153. + InputSampleRate:
  154. The InputSampleRate field shall be set to the same value as the *Input Sample Rate* field in the
  155. identification header defined in Ogg Opus [3].
  156. + OutputGain:
  157. The OutputGain field shall be set to the same value as the *Output Gain* field in the identification
  158. header define in Ogg Opus [3]. Note that the value is stored as 8.8 fixed-point.
  159. + ChannelMappingFamily:
  160. The ChannelMappingFamily field shall be set to the same value as the *Channel Mapping Family* field in
  161. the identification header defined in Ogg Opus [3].
  162. + StreamCount:
  163. The StreamCount field shall be set to the same value as the *Stream Count* field in the identification
  164. header defined in Ogg Opus [3].
  165. + CoupledCount:
  166. The CoupledCount field shall be set to the same value as the *Coupled Count* field in the identification
  167. header defined in Ogg Opus [3].
  168. + ChannelMapping:
  169. The ChannelMapping field shall be set to the same octet string as *Channel Mapping* field in the identi-
  170. fication header defined in Ogg Opus [3].
  171. 4.3.3 Sample format<a name="4.3.3"></a>
  172. An Opus sample is exactly one Opus packet for each of different Opus bitstreams. Due to support more than
  173. two channels, an Opus sample can contain frames from multiple Opus bitstreams but all Opus packets shall
  174. share with the total of frame sizes in a single Opus sample. The way of how to pack an Opus packet from
  175. each of Opus bitstreams into a single Opus sample follows Appendix B. in RFC 6716 [2].
  176. The endianness has nothing to do with any Opus sample since every Opus packet is processed byte-by-byte.
  177. In this specification, 'sample' means 'Opus sample' except for 'padded samples', 'priming samples', 'valid
  178. sample' and 'sample-accurate', i.e. 'sample' is 'sample' in the term defined in ISO/IEC 14496-12 [1].
  179. +-----------------------------------------+-------------------------------------+
  180. | Opus packet 0 (self-delimiting framing) | Opus packet 1 (undelimited framing) |
  181. +-----------------------------------------+-------------------------------------+
  182. |<---------------------------- the size of Opus sample ------------------------>|
  183. Figure 1 - Example structure of an Opus sample containing two Opus bitstreams
  184. 4.3.4 Duration of Opus sample<a name="4.3.4"></a>
  185. The duration of Opus sample is given by multiplying the total of frame sizes for a single Opus bitstream
  186. expressed in seconds by the value of the timescale field in the Media Header Box.
  187. Let's say an Opus sample consists of two Opus bitstreams, where the frame size of one bitstream is 40 milli-
  188. seconds and the frame size of another is 60 milliseconds, and the timescale field in the Media Header Box
  189. is set to 48000, then the duration of that Opus sample shall be 120 milliseconds since three 40 millisecond
  190. frame and two 60 millisecond frames shall be contained because of the maximum duration of Opus packet, 120
  191. milliseconds, and 5760 in the timescale indicated in the Media Header Box.
  192. To indicate the valid samples excluding the padded samples at the end of Opus bitstream, the duration of
  193. the last Opus sample of an Opus bitstream is given by multiplying the number of the valid samples by the
  194. value produced by dividing the value of the timescale field in the Media Header Box by 48000.
  195. 4.3.5 Sub-sample<a name="4.3.5"></a>
  196. The structure of the last Opus packet in an Opus sample is different from the others in the same Opus sample,
  197. and the others are invalid Opus packets as an Opus sample because of self-delimiting framing. To avoid
  198. complexities, sub-sample is not defined for Opus sample in this specification.
  199. 4.3.6 Random Access<a name="4.3.6"></a>
  200. This subclause describes the nature of the random access of Opus sample.
  201. 4.3.6.1 Random Access Point<a name="4.3.6.1"></a>
  202. All Opus samples can be independently decoded i.e. every Opus sample is a sync sample. Therefore, the
  203. Sync Sample Box shall not be present as long as there are no samples other than Opus samples in the same
  204. track. And the sample_is_non_sync_sample field for Opus samples shall be set to 0.
  205. 4.3.6.2 Pre-roll<a name="4.3.6.2"></a>
  206. Opus bitstream requires at least 80 millisecond pre-roll after each random access to get correct output.
  207. Pre-roll is indicated by the roll_distance field in AudioRollRecoveryEntry. AudioPreRollEntry shall not
  208. be used since every Opus sample is a sync sample in Opus bitstream. Note that roll_distance is expressed
  209. in sample units in a term of ISO Base Media File Format, and always takes negative values.
  210. For any track containing Opus bitstreams, at least one Sample Group Description Box and at least one
  211. Sample to Group Box within the Sample Table Box shall be present and these have the grouping_type field
  212. set to 'roll'. If any Opus sample is contained in a track fragment, the Sample to Group Box with the
  213. grouping_type field set to 'roll' shall be present for that track fragment.
  214. For the requirement of AudioRollRecoveryEntry, the compatible_brands field in the File Type Box shall
  215. contain at least one brand which requires support for roll groups.
  216. <a name="4.4"></a>
  217. 4.4 Trimming of Actual Duration
  218. Due to the priming samples (or the padding at the beginning) derived from the pre-roll for the startup and the
  219. padded samples at the end, we need trim from media to get the actual duration. An edit in the Edit List Box can
  220. achieve this demand, and the Edit Box and the Edit List Box shall be present.
  221. For sample-accurate trimming, proper timescale should be set to the timescale field in the Movie Header Box
  222. and the Media Header Box inside Track Box(es) for Opus bitstream. The timescale field in the Media Header Box is
  223. typically set to 48000. It is recommended that the timescale field in the Movie Header Box be set to the same
  224. value of the timescale field in the Media Header Box in order to avoid the rounding problem when specifying
  225. duration of edit if the timescales in all of the Media Header Boxes are set to the same value.
  226. For example, to indicate the actual duration of an Opus bitstream in a track with the timescale fields of both
  227. the Movie Header Box and the Media Header Box set to 48000, we would use the following edit:
  228. segment_duration = the number of the valid samples
  229. media_time = the number of the priming samples
  230. media_rate = 1 &lt&lt 16
  231. The Edit List Box is applied to whole movie including all movie fragments. Therefore, it is impossible to tell
  232. the actual duration in the case producing movie fragments on the fly such as live-streaming. In such cases,
  233. the duration of the last Opus sample may be helpful by setting zero to the segment_duration field since the
  234. value 0 represents implicit duration equal to the sum of the duration of all samples.
  235. <a name="4.5"></a>
  236. 4.5 Channel Layout (informative)
  237. By the application of alternate_group in the Track Header Box, whole audio channels in all active tracks from
  238. non-alternate group and/or different alternate group from each other are composited into the presentation. If
  239. an Opus sample consists of multiple Opus bitstreams, it can be splitted into individual Opus bitstreams and
  240. reconstructed into new Opus samples as long as every Opus bitstream has the same total duration in each Opus
  241. sample. This nature can be utilized to encapsulate a single Opus bitstream in each track without breaking the
  242. original channel layout.
  243. As an example, let's say there is a following track:
  244. OutputChannelCount = 6;
  245. StreamCount = 4;
  246. CoupledCount = 2;
  247. ChannelMapping = {0, 4, 1, 2, 3, 5}; // front left, front center, front right, rear left, rear right, LFE
  248. Here, to couple front left to front right channels into the first stream, and couple rear left to rear right
  249. channels into the second stream, reordering is needed since coupled streams must precede any non-coupled stream.
  250. You extract the four Opus bitstreams from this track and you encapsulate two of the four into a track and the
  251. others into another track. The former track is as follows.
  252. OutputChannelCount = 6;
  253. StreamCount = 2;
  254. CoupledCount = 2;
  255. ChannelMapping = {0, 255, 1, 2, 3, 255}; // front left, front center, front right, rear left, rear right, LFE
  256. And the latter track is as follows.
  257. OutputChannelCount = 6;
  258. StreamCount = 2;
  259. CoupledCount = 0;
  260. ChannelMapping = {255, 0, 255, 255, 255, 1}; // front left, front center, front right, rear left, rear right, LFE
  261. In addition, the value of the alternate_group field in the both tracks is set to 0. As the result, the player
  262. may play as if channels with 255 are not present, and play the presentation constructed from the both tracks
  263. in the same channel layout as the one of the original track. Keep in mind that the way of the composition, i.e.
  264. the mixing for playback, is not defined here, and maybe different results could occur except for the channel
  265. layout of the original, depending on an implementation or the definition of a derived file format.
  266. Note that some derived file formats may specify the restriction to ignore alternate grouping. In the context of
  267. such file formats, this application is not available. This unavailability does not mean incompatibilities among
  268. file formats unless the restriction to the value of the alternate_group field is specified and brings about
  269. any conflict among their definitions.
  270. <a name="4.6"></a>
  271. 4.6 Basic Structure (informative)
  272. 4.6.1 Initial Movie<a name="4.6.1"></a>
  273. This subclause shows a basic structure of the Movie Box as follows:
  274. +----+----+----+----+----+----+----+----+------------------------------+
  275. |moov| | | | | | | | Movie Box |
  276. +----+----+----+----+----+----+----+----+------------------------------+
  277. | |mvhd| | | | | | | Movie Header Box |
  278. +----+----+----+----+----+----+----+----+------------------------------+
  279. | |trak| | | | | | | Track Box |
  280. +----+----+----+----+----+----+----+----+------------------------------+
  281. | | |tkhd| | | | | | Track Header Box |
  282. +----+----+----+----+----+----+----+----+------------------------------+
  283. | | |edts| | | | | | Edit Box |
  284. +----+----+----+----+----+----+----+----+------------------------------+
  285. | | | |elst| | | | | Edit List Box |
  286. +----+----+----+----+----+----+----+----+------------------------------+
  287. | | |mdia| | | | | | Media Box |
  288. +----+----+----+----+----+----+----+----+------------------------------+
  289. | | | |mdhd| | | | | Media Header Box |
  290. +----+----+----+----+----+----+----+----+------------------------------+
  291. | | | |hdlr| | | | | Handler Reference Box |
  292. +----+----+----+----+----+----+----+----+------------------------------+
  293. | | | |minf| | | | | Media Information Box |
  294. +----+----+----+----+----+----+----+----+------------------------------+
  295. | | | | |smhd| | | | Sound Media Header Box |
  296. +----+----+----+----+----+----+----+----+------------------------------+
  297. | | | | |dinf| | | | Data Information Box |
  298. +----+----+----+----+----+----+----+----+------------------------------+
  299. | | | | | |dref| | | Data Reference Box |
  300. +----+----+----+----+----+----+----+----+------------------------------+
  301. | | | | | | |url | | DataEntryUrlBox |
  302. +----+----+----+----+----+----+ or +----+------------------------------+
  303. | | | | | | |urn | | DataEntryUrnBox |
  304. +----+----+----+----+----+----+----+----+------------------------------+
  305. | | | | |stbl| | | | Sample Table |
  306. +----+----+----+----+----+----+----+----+------------------------------+
  307. | | | | | |stsd| | | Sample Description Box |
  308. +----+----+----+----+----+----+----+----+------------------------------+
  309. | | | | | | |Opus| | OpusSampleEntry |
  310. +----+----+----+----+----+----+----+----+------------------------------+
  311. | | | | | | | |dOps| Opus Specific Box |
  312. +----+----+----+----+----+----+----+----+------------------------------+
  313. | | | | | |stts| | | Decoding Time to Sample Box |
  314. +----+----+----+----+----+----+----+----+------------------------------+
  315. | | | | | |stsc| | | Sample To Chunk Box |
  316. +----+----+----+----+----+----+----+----+------------------------------+
  317. | | | | | |stsz| | | Sample Size Box |
  318. +----+----+----+----+----+ or +----+----+------------------------------+
  319. | | | | | |stz2| | | Compact Sample Size Box |
  320. +----+----+----+----+----+----+----+----+------------------------------+
  321. | | | | | |stco| | | Chunk Offset Box |
  322. +----+----+----+----+----+ or +----+----+------------------------------+
  323. | | | | | |co64| | | Chunk Large Offset Box |
  324. +----+----+----+----+----+----+----+----+------------------------------+
  325. | | | | | |sgpd| | | Sample Group Description Box |
  326. +----+----+----+----+----+----+----+----+------------------------------+
  327. | | | | | |sbgp| | | Sample to Group Box |
  328. +----+----+----+----+----+----+----+----+------------------------------+
  329. | |mvex|* | | | | | | Movie Extends Box |
  330. +----+----+----+----+----+----+----+----+------------------------------+
  331. | | |trex|* | | | | | Track Extends Box |
  332. +----+----+----+----+----+----+----+----+------------------------------+
  333. Figure 2 - Basic structure of Movie Box
  334. It is strongly recommended that the order of boxes should follow the above structure.
  335. Boxes marked with an asterisk (*) may be present.
  336. For most boxes listed above, the definition is as is defined in ISO/IEC 14496-12 [1]. The additional boxes
  337. and the additional requirements, restrictions and recommendations to the other boxes are described in this
  338. specification.
  339. 4.6.2 Movie Fragments<a name="4.6.2"></a>
  340. This subclause shows a basic structure of the Movie Fragment Box as follows:
  341. +----+----+----+----+----+----+----+----+------------------------------+
  342. |moof| | | | | | | | Movie Fragment Box |
  343. +----+----+----+----+----+----+----+----+------------------------------+
  344. | |mfhd| | | | | | | Movie Fragment Header Box |
  345. +----+----+----+----+----+----+----+----+------------------------------+
  346. | |traf| | | | | | | Track Fragment Box |
  347. +----+----+----+----+----+----+----+----+------------------------------+
  348. | | |tfhd| | | | | | Track Fragment Header Box |
  349. +----+----+----+----+----+----+----+----+------------------------------+
  350. | | |trun| | | | | | Track Fragment Run Box |
  351. +----+----+----+----+----+----+----+----+------------------------------+
  352. | | |sgpd|* | | | | | Sample Group Description Box |
  353. +----+----+----+----+----+----+----+----+------------------------------+
  354. | | |sbgp|* | | | | | Sample to Group Box |
  355. +----+----+----+----+----+----+----+----+------------------------------+
  356. Figure 3 - Basic structure of Movie Fragment Box
  357. It is strongly recommended that the Movie Fragment Header Box and the Track Fragment Header Box be
  358. placed first in their container.
  359. Boxes marked with an asterisk (*) may be present.
  360. For the boxes listed above, the definition is as is defined in ISO/IEC 14496-12 [1].
  361. <a name="4.7"></a>
  362. 4.7 Example of Encapsulation (informative)
  363. [File]
  364. size = 17790
  365. [ftyp: File Type Box]
  366. position = 0
  367. size = 24
  368. major_brand = mp42 : MP4 version 2
  369. minor_version = 0
  370. compatible_brands
  371. brand[0] = mp42 : MP4 version 2
  372. brand[1] = iso2 : ISO Base Media file format version 2
  373. [moov: Movie Box]
  374. position = 24
  375. size = 757
  376. [mvhd: Movie Header Box]
  377. position = 32
  378. size = 108
  379. version = 0
  380. flags = 0x000000
  381. creation_time = UTC 2014/12/12, 18:41:19
  382. modification_time = UTC 2014/12/12, 18:41:19
  383. timescale = 48000
  384. duration = 33600 (00:00:00.700)
  385. rate = 1.000000
  386. volume = 1.000000
  387. reserved = 0x0000
  388. reserved = 0x00000000
  389. reserved = 0x00000000
  390. transformation matrix
  391. | a, b, u | | 1.000000, 0.000000, 0.000000 |
  392. | c, d, v | = | 0.000000, 1.000000, 0.000000 |
  393. | x, y, w | | 0.000000, 0.000000, 1.000000 |
  394. pre_defined = 0x00000000
  395. pre_defined = 0x00000000
  396. pre_defined = 0x00000000
  397. pre_defined = 0x00000000
  398. pre_defined = 0x00000000
  399. pre_defined = 0x00000000
  400. next_track_ID = 2
  401. [iods: Object Descriptor Box]
  402. position = 140
  403. size = 33
  404. version = 0
  405. flags = 0x000000
  406. [tag = 0x10: MP4_IOD]
  407. expandableClassSize = 16
  408. ObjectDescriptorID = 1
  409. URL_Flag = 0
  410. includeInlineProfileLevelFlag = 0
  411. reserved = 0xf
  412. ODProfileLevelIndication = 0xff
  413. sceneProfileLevelIndication = 0xff
  414. audioProfileLevelIndication = 0xfe
  415. visualProfileLevelIndication = 0xff
  416. graphicsProfileLevelIndication = 0xff
  417. [tag = 0x0e: ES_ID_Inc]
  418. expandableClassSize = 4
  419. Track_ID = 1
  420. [trak: Track Box]
  421. position = 173
  422. size = 608
  423. [tkhd: Track Header Box]
  424. position = 181
  425. size = 92
  426. version = 0
  427. flags = 0x000007
  428. Track enabled
  429. Track in movie
  430. Track in preview
  431. creation_time = UTC 2014/12/12, 18:41:19
  432. modification_time = UTC 2014/12/12, 18:41:19
  433. track_ID = 1
  434. reserved = 0x00000000
  435. duration = 33600 (00:00:00.700)
  436. reserved = 0x00000000
  437. reserved = 0x00000000
  438. layer = 0
  439. alternate_group = 0
  440. volume = 1.000000
  441. reserved = 0x0000
  442. transformation matrix
  443. | a, b, u | | 1.000000, 0.000000, 0.000000 |
  444. | c, d, v | = | 0.000000, 1.000000, 0.000000 |
  445. | x, y, w | | 0.000000, 0.000000, 1.000000 |
  446. width = 0.000000
  447. height = 0.000000
  448. [edts: Edit Box]
  449. position = 273
  450. size = 36
  451. [elst: Edit List Box]
  452. position = 281
  453. size = 28
  454. version = 0
  455. flags = 0x000000
  456. entry_count = 1
  457. entry[0]
  458. segment_duration = 33600
  459. media_time = 312
  460. media_rate = 1.000000
  461. [mdia: Media Box]
  462. position = 309
  463. size = 472
  464. [mdhd: Media Header Box]
  465. position = 317
  466. size = 32
  467. version = 0
  468. flags = 0x000000
  469. creation_time = UTC 2014/12/12, 18:41:19
  470. modification_time = UTC 2014/12/12, 18:41:19
  471. timescale = 48000
  472. duration = 34560 (00:00:00.720)
  473. language = und
  474. pre_defined = 0x0000
  475. [hdlr: Handler Reference Box]
  476. position = 349
  477. size = 51
  478. version = 0
  479. flags = 0x000000
  480. pre_defined = 0x00000000
  481. handler_type = soun
  482. reserved = 0x00000000
  483. reserved = 0x00000000
  484. reserved = 0x00000000
  485. name = Xiph Audio Handler
  486. [minf: Media Information Box]
  487. position = 400
  488. size = 381
  489. [smhd: Sound Media Header Box]
  490. position = 408
  491. size = 16
  492. version = 0
  493. flags = 0x000000
  494. balance = 0.000000
  495. reserved = 0x0000
  496. [dinf: Data Information Box]
  497. position = 424
  498. size = 36
  499. [dref: Data Reference Box]
  500. position = 432
  501. size = 28
  502. version = 0
  503. flags = 0x000000
  504. entry_count = 1
  505. [url : Data Entry Url Box]
  506. position = 448
  507. size = 12
  508. version = 0
  509. flags = 0x000001
  510. location = in the same file
  511. [stbl: Sample Table Box]
  512. position = 460
  513. size = 321
  514. [stsd: Sample Description Box]
  515. position = 468
  516. size = 79
  517. version = 0
  518. flags = 0x000000
  519. entry_count = 1
  520. [Opus: Audio Description]
  521. position = 484
  522. size = 63
  523. reserved = 0x000000000000
  524. data_reference_index = 1
  525. reserved = 0x0000
  526. reserved = 0x0000
  527. reserved = 0x00000000
  528. channelcount = 6
  529. samplesize = 16
  530. pre_defined = 0
  531. reserved = 0
  532. samplerate = 48000.000000
  533. [dOps: Opus Specific Box]
  534. position = 520
  535. size = 27
  536. Version = 0
  537. OutputChannelCount = 6
  538. PreSkip = 312
  539. InputSampleRate = 48000
  540. OutputGain = 0
  541. ChannelMappingFamily = 1
  542. StreamCount = 4
  543. CoupledCount = 2
  544. ChannelMapping
  545. 0 -> 0: front left
  546. 1 -> 4: fron center
  547. 2 -> 1: front right
  548. 3 -> 2: side left
  549. 4 -> 3: side right
  550. 5 -> 5: rear center
  551. [stts: Decoding Time to Sample Box]
  552. position = 547
  553. size = 24
  554. version = 0
  555. flags = 0x000000
  556. entry_count = 1
  557. entry[0]
  558. sample_count = 18
  559. sample_delta = 1920
  560. [stsc: Sample To Chunk Box]
  561. position = 571
  562. size = 40
  563. version = 0
  564. flags = 0x000000
  565. entry_count = 2
  566. entry[0]
  567. first_chunk = 1
  568. samples_per_chunk = 13
  569. sample_description_index = 1
  570. entry[1]
  571. first_chunk = 2
  572. samples_per_chunk = 5
  573. sample_description_index = 1
  574. [stsz: Sample Size Box]
  575. position = 611
  576. size = 92
  577. version = 0
  578. flags = 0x000000
  579. sample_size = 0 (variable)
  580. sample_count = 18
  581. entry_size[0] = 977
  582. entry_size[1] = 938
  583. entry_size[2] = 939
  584. entry_size[3] = 938
  585. entry_size[4] = 934
  586. entry_size[5] = 945
  587. entry_size[6] = 948
  588. entry_size[7] = 956
  589. entry_size[8] = 955
  590. entry_size[9] = 930
  591. entry_size[10] = 933
  592. entry_size[11] = 934
  593. entry_size[12] = 972
  594. entry_size[13] = 977
  595. entry_size[14] = 958
  596. entry_size[15] = 949
  597. entry_size[16] = 962
  598. entry_size[17] = 848
  599. [stco: Chunk Offset Box]
  600. position = 703
  601. size = 24
  602. version = 0
  603. flags = 0x000000
  604. entry_count = 2
  605. chunk_offset[0] = 797
  606. chunk_offset[1] = 13096
  607. [sgpd: Sample Group Description Box]
  608. position = 727
  609. size = 26
  610. version = 1
  611. flags = 0x000000
  612. grouping_type = roll
  613. default_length = 2 (constant)
  614. entry_count = 1
  615. roll_distance[0] = -2
  616. [sbgp: Sample to Group Box]
  617. position = 753
  618. size = 28
  619. version = 0
  620. flags = 0x000000
  621. grouping_type = roll
  622. entry_count = 1
  623. entry[0]
  624. sample_count = 18
  625. group_description_index = 1
  626. [free: Free Space Box]
  627. position = 781
  628. size = 8
  629. [mdat: Media Data Box]
  630. position = 789
  631. size = 17001
  632. <a name="5"></a>
  633. 5 Authors' Address
  634. Yusuke Nakamura
  635. Email: muken.the.vfrmaniac |at| gmail.com
  636. </div>
  637. </body>
  638. </html>