{"id":676,"date":"2013-08-07T18:03:05","date_gmt":"2013-08-07T10:03:05","guid":{"rendered":"http:\/\/guoh.ai\/lifelog\/?p=676"},"modified":"2013-08-15T12:38:21","modified_gmt":"2013-08-15T04:38:21","slug":"format-of-container-file-and-iso-iec-14496-12","status":"publish","type":"post","link":"https:\/\/guoh.ai\/lifelog\/2013\/08\/format-of-container-file-and-iso-iec-14496-12\/","title":{"rendered":"\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f\u4ee5\u53caISO\/IEC 14496-12\u89c4\u8303"},"content":{"rendered":"<p>\u7f51\u7edc\u4e0a\u5f88\u591a\u8bb2\u89e3\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f(\u6bd4\u5982MP4\u6863\u6848)\u7684\u6587\u7ae0\uff0c\u6709\u4e0d\u5c11\u662f\u4f5c\u8005\u61c2\u4e86\u76f8\u5173\u7684\u4e1c\u897f\uff0c\u7136\u540e\u518d\u81ea\u5df1\u603b\u7ed3\u51fa\u6765\u7684\uff0c\u4f18\u70b9\u5c31\u662f\u4ed6\u4eec\u6293\u4f4f\u91cd\u70b9\uff0c\u5199\u51fa\u6ce8\u610f\u7684\u5730\u65b9\uff0c\u7f3a\u70b9\u5c31\u662f\u6709\u65f6\u5019\u4f60\u4f1a\u89c9\u5f97\u5f88\u7a81\u7136\uff0c\u7a81\u7136\u5c31\u51fa\u6765\u4e00\u4e2a\u65b0\u7684\u6982\u5ff5\uff0c\u5b9a\u4e49\uff0c\u56e0\u4e3a\u4ed6\u4eec\u9ed8\u8ba4\u4f60\u5e94\u8be5\u719f\u6089\u76f8\u5e94\u7684\u89c4\u8303\u3002\u6211\u5728\u8fd9\u91cc\u4ece\u57fa\u672c\u70b9\u5165\u624b\uff0c\u5199\u70b9\u5173\u4e8e\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u9996\u5148\u4f60\u5e94\u8be5\u6709\u4e00\u4efd<strong>ISO\/IEC 14496-12(Part 12: ISO base media file format)<\/strong>\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u4ece<a href=\"http:\/\/standards.iso.org\/ittf\/PubliclyAvailableStandards\/index.html\" target=\"_blank\">http:\/\/standards.iso.org\/ittf\/PubliclyAvailableStandards\/index.html<\/a>\u514d\u8d39\u4e0b\u8f7d\u5230\u3002\u867d\u7136\u662f\u82f1\u6587\u7684\uff0c\u4f46\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u4e1c\u897f\u8fd8\u662f\u4e0d\u96be\u3002<br \/>\n\u5f53\u7136\u4f60\u5e94\u8be5\u77e5\u9053\u4e00\u4e9b\u57fa\u672c\u7684\u6982\u5ff5\uff0c\u6bd4\u5982container file, codec, track\u7b49\u7b49\u3002\u6bd4\u5982\u901a\u5e38\u770b\u5230\u7684\u4e00\u4e2aMP4\u6587\u4ef6\u5b83\u5c31\u662f\u4e00\u4e2acontainer file\uff0c\u5b83\u91cc\u9762\u88c5\u4e86\u6765\u81eacodec\u7f16\u7801\u540e\u7684\u6570\u636e\uff0c\u53ef\u80fd\u5305\u62ec\u4e00\u4e2a\u6216\u8005\u591a\u4e2atrack(\u901a\u5e38\u6709\u4e00\u4e2a\u89c6\u9891track\uff0c\u4e00\u4e2a\u97f3\u9891track\uff0c\u6709\u7684\u53ef\u80fd\u6709\u591a\u4e2a\u97f3\u9891track\uff0c\u6bd4\u5982\u4e2d\u6587\/\u82f1\u6587\/\u5e7f\u4e1c\u8bdd\/\u897f\u73ed\u7259\u8bed\uff0c\u8fd8\u6709\u53ef\u80fd\u6709\u5b57\u5e55track)\u3002<\/p>\n<p>\u9996\u5148\u9700\u8981\u9605\u8bfb\u6700\u57fa\u672c\u7684\u51e0\u4e2a\u7ae0\u8282\u5c31\u53ef\u4ee5<br \/>\n<strong>3 Terms, definitions, and abbreviated terms<\/strong><br \/>\n<strong>4 Object-structured File Organization<\/strong><br \/>\n<strong>5 Design Considerations<\/strong><br \/>\n\u5373\u4e00\u4e9b\u57fa\u672c\u672f\u8bed\uff0c\u5b9a\u4e49\uff0c\u6bd4\u5982<strong>Box<\/strong>, <strong>Chunk<\/strong>, <strong>Container Box<\/strong>, <strong>Hint Box<\/strong>, <strong>Sample<\/strong>\u7b49\u7b49<br \/>\n\u5176\u4e2d\u6587\u4ef6\u7ec4\u7ec7\u7ed3\u6784\u5f53\u4e2d\u89c4\u5b9a\u4e86\u6587\u4ef6\u662f\u6709\u4e00\u7cfb\u5217\u7684Box\u7ec4\u6210\uff0c\u5728\u6587\u4ef6\u5f53\u4e2d\u9664\u4e86Box\u6ca1\u6709\u5176\u4ed6\u4e1c\u897f\uff0c\u6240\u6709\u6570\u636e\u90fd\u662f\u5305\u542b\u5728Box\u5f53\u4e2d\uff0c\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u8981\u91c7\u53d6\u8fd9\u6837\u9762\u76f8\u5bf9\u8c61\u7684\u8bbe\u8ba1\u3002<br \/>\n\u901a\u5e38Box\u7531header\u548c\u5305\u542b\u5728\u5176\u4e2d\u7684data\u7ec4\u6210\uff0cheader\u4e2d\u5305\u542b\u4e86\u8fd9\u4e2aBox\u7684size\u548ctype\u4fe1\u606f\uff0c\u5f53\u7136size\u662f\u5305\u542b\u4e86\u8fd9\u4e2aBox\u5f53\u4e2d\u6240\u6709\u6570\u636e\u5728\u5185\uff0c\u4e5f\u5305\u542b\u8fd9\u4e2aheader\u3002<br \/>\n\u5982\u679cBox\u7684type\u4e0d\u80fd\u88ab\u8bc6\u522b\uff0c\u90a3\u4e48\u8fd9\u4e2aBox\u5c31\u8be5\u88ab\u5ffd\u7565\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naligned(8) class Box(unsigned int(32) boxtype,\r\n\t\toptional unsigned int(8)&#x5B;16] extended_type) {\r\n\tunsigned int(32) size;\r\n\tunsigned int(32) type = boxtype;\r\n\tif (size == 1) { \/\/ \u5982\u679csize\u4e3a1\u5c31\u7528largesize\u6765\u8868\u793a\u8fd9\u4e2aBox\u7684\u5927\u5c0f\r\n\t\tunsigned int(64) largesize;\r\n\t} else if (size == 0) {\r\n\t\t\/\/ box extends to end of file\r\n\t}\r\n\tif (boxtype == &#039;uuid&#039;) { \/\/ \u8fd9\u91cc\u8868\u793a\u81ea\u5b9a\u4e49\u7684\u7c7b\u578b\r\n\t\tunsigned int(8)&#x5B;16] usertype = extended_type;\r\n\t}\r\n}\r\n<\/pre>\n<p>\u8fd9\u91cc\u90fd\u662f\u6309\u71678\u4f4d\u5bf9\u9f50\uff0c\u6240\u4ee5\u6700\u5c0f\u5355\u5143\u662f8\u4f4d\uff0c\u5373\u4e00\u4e2a\u5b57\u8282\uff0c\u672c\u6587\u7ae0\u4e2d\u6240\u6307\u7684\u5355\u5143\u5747\u662f\u8fd9\u91cc\u8868\u8ff0\u7684\u610f\u601d\u3002<br \/>\n\u6240\u4ee5\u4f60\u5c31\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u77e5\u9053\uff0c\u5c5e\u6027size\u548ctype\u5206\u522b\u5404\u81ea\u5360\u75284\u4e2a\u5355\u5143\u3002<\/p>\n<p>\u53e6\u5916\u5f88\u591aBox\u90fd\u5305\u542bversion\u548cflag\u8fd9\u4e24\u4e2a\u5b57\u6bb5\uff0c\u6240\u4ee5\u53c8\u62bd\u8c61\u51fa\u6765\u4e00\u4e2aFullBox<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naligned(8) class FullBox(unsigned int(32) boxtype, unsigned int(8) v, bit(24) f)\r\n\t\textends Box(boxtype) {\r\n\tunsigned int(8) version = v; \/\/ 1\u4e2a\u5355\u5143\r\n\tbit(24) flags = f; \/\/ 3\u4e2a\u5355\u5143\r\n}\r\n<\/pre>\n<p>\u5982\u679cBox\u7684version\u4e0d\u80fd\u88ab\u8bc6\u522b\uff0c\u90a3\u4e48\u8fd9\u4e2aBox\u5c31\u8be5\u88ab\u5ffd\u7565\u3002<\/p>\n<p>\u6240\u6709\u7b26\u5408\u8fd9\u89c4\u8303\u7684\u6587\u4ef6\u90fd\u5e94\u5f53\u5305\u542b\u4e00\u4e2aFile Type Box\uff0c\u5e76\u4e14\u8fd9\u4e2aBox\u5e94\u5f53\u653e\u7f6e\u5728\u6587\u4ef6\u5c3d\u53ef\u80fd\u65e9\u7684\u4f4d\u7f6e\uff0c\u90a3\u4e48\u8fd9\u662f\u4e2a\u4ec0\u4e48\u6837\u7684\u4e1c\u897f\uff1f<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naligned(8) class FileTypeBox\r\n\t\textends Box(&#039;ftyp&#039;) {\r\n\tunsigned int(32) major_brand;\r\n\tunsigned int(32) minor_version;\r\n\tunsigned int(32) compatible_brands&#x5B;]; \/\/ to end of the box \/\/ \u8fd9\u4e2a\u662f\u4e0d\u5b9a\u957f\u7684\uff0c\u53ef\u4ee5\u662f1\u4e2a\u5355\u5143\uff0c\u4e5f\u53ef\u4ee5\u662f2\uff0c\u4ec0\u4e48\u65f6\u5019\u7ed3\u675f\u9760\u524d\u9762\u7684size\u51b3\u5b9a\r\n}\r\n<\/pre>\n<p>\u90a3\u6211\u4eec\u8fd8\u53ef\u4ee5\u77e5\u9053\uff0c\u4e00\u4e2a\u5178\u578b\u7684\u7b26\u5408\u89c4\u8303\u7684\u6587\u4ef6\u5305\u62ecmoov\u548cmdat\u8fd9\u4e24\u4e2aBoxes\uff0c\u90a3\u8fd9\u53c8\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u5c31\u8981\u7ee7\u7eed\u5f80\u4e0b\u770b<br \/>\n<strong>6 ISO Base Media File organization<\/strong><br \/>\n\u4e86\uff0c<strong>Table 1 \u2014 Box types, structure, and cross-reference<\/strong>\u8fd9\u5f20\u56fe\u5199\u51fa\u4e86\u57fa\u672c\u4e0a\u6240\u6709\u7684Boxes\uff0c\u53ef\u4ee5\u7b80\u5355\u7684\u7406\u89e3\u5c31\u662fmoov(Movie Box)\u662f\u5305\u542b\u63cf\u8ff0\u4fe1\u606f\u7684Box\uff0cmdat(Media Data Box)\u662f\u5305\u542b\u771f\u5b9e\u591a\u5a92\u4f53\u6570\u636e\u7684Box\uff0c\u800c\u4e14\u8fd9\u4e9bBoxes\u90fd\u662f\u5e76\u5217\u6216\u8005\u5d4c\u5957\u7684\u5173\u7cfb\uff0cIt&#8217;s tree-like\u3002\u5230\u8fd9\u91cc\u6700\u91cd\u8981\u7684\u4e1c\u897f\u5df2\u7ecf\u90fd\u63a5\u89e6\u4e86\uff0c\u7136\u540e\u4f60\u8fd8\u8981\u77e5\u9053\u8fd9\u4e9b\u5e76\u5217\u6216\u8005\u5d4c\u5957\u7684Boxes\u8981\u600e\u4e48\u6446\u653e\uff0c\u4e5f\u5c31\u662f\u5b83\u7684\u987a\u5e8f\uff0c\u7279\u522b\u662fmoov(Movie Box)\u5f53\u4e2d\u7684\u5b50Boxes\u7684\u987a\u5e8f\uff0c\u53e6\u5916\u56e0\u4e3a\u6709Streaming Support\/Realtime downloading and playing\u7684\u9700\u6c42\uff0cmoov\u653e\u5728mdat\u7684\u524d\u9762\uff0c\u8fd9\u6837\u53ea\u8981\u4e0b\u8f7d\u5b8cmoov\u6570\u636e\u5c31\u53ef\u4ee5\u89e3\u6790\u51fa\u6765\u8fd9\u6bb5\u89c6\u9891\u6709\u591a\u957f\uff0c\u4ec0\u4e48\u8bed\u8a00\uff0c\u7b49\u7b49\u4fe1\u606f\uff0c\u7136\u540e\u5c31\u5f00\u59cb\u64ad\u653e\uff0c\u540e\u9762mdat\u6570\u636e\u6162\u6162\u6765\u4e0b\u8f7d\uff0c\u56e0\u4e3amdat\u901a\u5e38\u6bd4moov\u5927\u7684\u591a\uff1b\u56e0\u4e3a\u5f55\u5f71\u529f\u80fd\uff0c\u6211\u4eec\u4e0d\u77e5\u9053\u4ec0\u4e48\u65f6\u5019\u5f55\u5f71\u7ed3\u675f\uff0c\u800c\u4e14moov\u76f8\u5bf9\u8f83\u5c0f\u522b\u4e14\u5927\u5c0f\u53ef\u80fd\u53d7\u5230mdat\u5927\u5c0f\u7684\u5f71\u54cd\uff0c\u6240\u4ee5\u6211\u4eec\u4e5f\u4f1a\u628amoov\u653e\u5230mdat\u540e\u9762(\u5f55\u5f71\u8fc7\u7a0b\u5f53\u4e2d\u5148\u628amoov\u4fdd\u5b58\u5728\u5185\u5b58\u5f53\u4e2d\uff0c\u7b49mdat\u5199\u5b8c\u4e86\u518d\u8ffd\u52a0\u5230\u5c3e\u90e8\u53bb)\u3002<\/p>\n<p>\u8fd9\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u7406\u8bba\uff0c\u5f53\u7136\u8fd8\u6709\u5f88\u591a\u4e1c\u897f\u6ca1\u6709\u5728\u8fd9\u91cc\u6307\u51fa\uff0c\u4f60\u9700\u8981\u9605\u8bfb\u89c4\u8303\u6765\u4e86\u89e3\uff0c\u5173\u4e8e\u5177\u4f53Box\u76f8\u5173\u7684\uff0c\u5efa\u8bae\u4f60\u7528\u5230\u8fd9\u4e2aBox\u7684\u65f6\u5019\u5c31\u53bb\u8bfb\uff0c\u56e0\u4e3a\u5b9e\u5728\u662f\u592a\u591a\u7684Boxes\u4e86\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u5b9e\u4f8b\u6765\u770b\u4e0b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nguohai@KNIGHT:~$ AtomicParsley \/path\/to\/VID_FILE.mp4 -T\r\nAtom ftyp @ 0 of size: 24, ends @ 24\r\nAtom moov @ 24 of size: 53884, ends @ 53908\r\n     Atom mvhd @ 32 of size: 108, ends @ 140\r\n     Atom trak @ 140 of size: 45719, ends @ 45859\r\n         Atom tkhd @ 148 of size: 92, ends @ 240\r\n         Atom mdia @ 240 of size: 45619, ends @ 45859\r\n             Atom mdhd @ 248 of size: 32, ends @ 280\r\n             Atom hdlr @ 280 of size: 44, ends @ 324\r\n             Atom minf @ 324 of size: 45535, ends @ 45859\r\n                 Atom vmhd @ 332 of size: 20, ends @ 352\r\n                 Atom dinf @ 352 of size: 36, ends @ 388\r\n                     Atom dref @ 360 of size: 28, ends @ 388\r\n                 Atom stbl @ 388 of size: 45471, ends @ 45859\r\n                     Atom stsd @ 396 of size: 151, ends @ 547\r\n                         Atom avc1 @ 412 of size: 135, ends @ 547\r\n                             Atom avcC @ 498 of size: 33, ends @ 531\r\n                             Atom pasp @ 531 of size: 16, ends @ 547\t\t\t ~\r\n                     Atom stts @ 547 of size: 21024, ends @ 21571\r\n                     Atom stss @ 21571 of size: 232, ends @ 21803\r\n                     Atom stsz @ 21803 of size: 10536, ends @ 32339\r\n                     Atom stsc @ 32339 of size: 7072, ends @ 39411\r\n                     Atom stco @ 39411 of size: 6448, ends @ 45859\r\n     Atom trak @ 45859 of size: 8049, ends @ 53908\r\n         Atom tkhd @ 45867 of size: 92, ends @ 45959\r\n         Atom mdia @ 45959 of size: 7949, ends @ 53908\r\n             Atom mdhd @ 45967 of size: 32, ends @ 45999\r\n             Atom hdlr @ 45999 of size: 44, ends @ 46043\r\n             Atom minf @ 46043 of size: 7865, ends @ 53908\r\n                 Atom smhd @ 46051 of size: 16, ends @ 46067\r\n                 Atom dinf @ 46067 of size: 36, ends @ 46103\r\n                     Atom dref @ 46075 of size: 28, ends @ 46103\r\n                 Atom stbl @ 46103 of size: 7805, ends @ 53908\r\n                     Atom stsd @ 46111 of size: 69, ends @ 46180\r\n                         Atom samr @ 46127 of size: 53, ends @ 46180\r\n                             Atom damr @ 46163 of size: 17, ends @ 46180\r\n                     Atom stts @ 46180 of size: 32, ends @ 46212\r\n                     Atom stsz @ 46212 of size: 20, ends @ 46232\r\n                     Atom stsc @ 46232 of size: 52, ends @ 46284\r\n                     Atom stco @ 46284 of size: 7624, ends @ 53908\r\nAtom free @ 53908 of size: 351116, ends @ 405024\r\nAtom mdat @ 405024 of size: 39866486, ends @ 40271510\r\n<\/pre>\n<p>\u770b\u5230\u8fd9\u4e9b\u4e0d\u8981\u614c\u5f20\uff0c\u8fd9\u5176\u5b9e\u5c31\u662f\u4e00\u4e2aMP4\u6587\u4ef6\u5f53\u4e2d\u6240\u6709\u7684Boxes\u7684\u6811\u5f62\u5c55\u793a\uff0c\u6211\u4eec\u662f\u901a\u8fc7AtomicParsley\u628a\u5b83\u663e\u793a\u51fa\u6765\uff0c\u770b\u770b\u6700\u5916\u9762\u6709ftyp\uff0cmoov\uff0cfree\u548cmdat\u8fd9\u56db\u4e2aBoxes\uff0cBox\u5728\u6709\u7684\u5730\u65b9\u53c8\u88ab\u79f0\u4e3aAtom\uff0c\u662f\u4e00\u4e2a\u610f\u601d\u3002\u5982\u679c\u4f60\u4e0d\u660e\u767dfree\u662f\u4ec0\u4e48Box\uff0c\u90a3\u4e48\u4f60\u5c31\u9700\u8981\u53bb\u8bfb\u4e0b\u89c4\u8303\u4e86\u3002<\/p>\n<p>\u5177\u4f53\u770b\u4e0b\u7b2c\u4e00\u884c<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Atom ftyp @ 0 of size: 24, ends @ 24<\/pre>\n<p>\u8868\u793aftyp\u4ece\u7b2c0\u4e2a\u5355\u5143\u5f00\u59cb\uff0c\u5927\u5c0f\u662f24\uff0c\u7ed3\u675f\u572824\u5355\u5143\u4e4b\u524d\u3002<br \/>\n\u5176\u5b83\u884c\u4ee5\u7c7b\u4f3c\u7684\u65b9\u6cd5\u53ef\u4ee5\u8bfb\u61c2\u3002<\/p>\n<p>\u6216\u8005\u4f60\u53ef\u4ee5\u53bb\u4e0b\u8f7d\u4e00\u4e2a\u53eb\u505aMp4Info\u7684\u56fe\u5f62\u5316\u5de5\u5177\u6765\u67e5\u770b\u8fd9\u68f5\u7531Boxes\u7ec4\u6210\u7684\u6811\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u8f6f\u4ef6\u53ea\u80fd\u5728Windows\u4e0b\u4f7f\u7528\uff0c\u800c\u4e14\u6709\u65f6\u5019\u4f1acrash\uff0c\u6709\u4e9bBox\u7684Hex\u6570\u636e\u4e5f\u663e\u793a\u4e0d\u5168\uff0c\u4e0d\u8fc7\u57fa\u672c\u4e0a\u4f7f\u7528\u8fd8\u662f\u53ef\u4ee5\u7684\uff0c\u67e5\u770b\u6570\u636e\u53ef\u4ee5\u7528\u4e13\u95e8\u768416\u8fdb\u5236\u7f16\u8f91\u5668\u3002\u6211\u8fd9\u91cc\u7528\u7684\u662f\u4e00\u4e2a\u53eb\u505aBless\u7684\u5de5\u5177\u3002<br \/>\n\u8fd8\u6709\u5f88\u591a\u5de5\u5177\uff0c\u53ef\u4ee5\u5230\u7f51\u4e0a\u53bb\u641c\u7d22\u3002<\/p>\n<p>\u73b0\u5728\u4ee5\u5b9e\u9645\u4f8b\u5b50\u6765\u5206\u6790\u4e0b\u3002<\/p>\n<p>\u6211\u4eec\u77e5\u9053\u7b2c\u4e00\u4e2aBox\u662fftyp\uff0c\u4ece0\u5f00\u59cb\uff0c\u5927\u5c0f\u662f24\u3002\u90a3\u4e48\u5b83\u7684\u6570\u636e\u5c31\u662f\u4e0b\u9762(\u7528Bless\u6253\u5f00MP4\u6863\u6848\u770b\u5230\u7684)\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">00 00 00 18 66 74 79 70 69 73 6F 6D 00 00 00 00 69 73 6F 6D 33 67 70 34<\/pre>\n<p>\u6700\u5f00\u59cb4\u4e2a\u5355\u5143\u662fsize\uff0c\u5176\u503c\u4e3a00 00 00 18\uff0c\u6362\u6210decimal\u4e3a24<\/p>\n<p>\u63a5\u4e0b\u67654\u4e2a\u5355\u5143\u662ftype\uff0c\u5176\u503c\u4e3a66 74 79 70\uff0c\u5bf9\u5e94&#8217;f&#8217;, &#8216;t&#8217;, &#8216;y&#8217;, &#8216;p&#8217;\u8fd94\u4e2a\u5b57\u7b26\u7684ASCII\u7f16\u7801<\/p>\n<p>major_brand\u4ece\u7b2c9\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a69 73 6F 6D\uff0c\u5bf9\u5e94&#8217;i&#8217;, &#8216;s&#8217;, &#8216;o&#8217;, &#8216;m&#8217;<\/p>\n<p>minor_version\u4ece\u7b2c13\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a00 00 00 00\uff0c\u4e5f\u5c31\u662f0<\/p>\n<p>compatible_brands\u4ece\u7b2c17\u5355\u5143\u5f00\u59cb\uff0c\u5305\u542b\u4e862\u7ec44\u4e2a\u5355\u5143\u7684\u6570\u636e\uff0c\u4e5f\u5c31\u662f8\u4e2a\u5355\u5143\uff0c\u4e4b\u524d\u6211\u4eec\u8bf4\u8fc7\u4e86\uff0c\u5b83\u662f\u4e0d\u5b9a\u957f\u7684\uff0c\u5927\u5c0f\u53d7\u6574\u4e2aBox\u7684\u5927\u5c0f\u63a7\u5236\uff0c\u5176\u503c\u4e3a69 73 6F 6D 33 67 70 34\uff0c\u5bf9\u5e94&#8217;i&#8217;, &#8216;s&#8217;, &#8216;o&#8217;, &#8216;m&#8217;, &#8216;3&#8217;, &#8216;g&#8217;, &#8216;p&#8217;, &#8216;4&#8217;<\/p>\n<p>\u8fd9\u5c31\u662fftyp\u8fd9\u4e2aBox\u7684\u6240\u6709\u4fe1\u606f\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u518d\u770b\u4e0bmvhd\uff0c\u5b83\u662fmoov\u7684header\uff0c\u957f\u5ea6\u5171\u8ba1108\u4e2a\u5355\u5143(version\u4e3a0\uff0c\u5176\u5b83\u7248\u672c\u8bf7\u67e5\u770b\u89c4\u8303)\uff0c\u5b83\u7684\u6570\u636e\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">00 00 00 6C 6D 76 68 64 00 00 00 00 50 4C 2C 57 50 4C 2C 57 00 00 03 E8 00 03 7B 90 00 01 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03<\/pre>\n<p>\u89c4\u8303\u4e2dMovieHeaderBox\u7684\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naligned(8) class MovieHeaderBox extends FullBox(&#039;mvhd&#039;, version, 0) {\r\n\tif (version == 1) {\r\n\t\tunsigned int(64) creation_time;\r\n\t\tunsigned int(64) modification_time;\r\n\t\tunsigned int(32) timescale;\r\n\t\tunsigned int(64) duration;\r\n\t} else { \/\/ version==0\r\n\t\tunsigned int(32) creation_time;\r\n\t\tunsigned int(32) modification_time;\r\n\t\tunsigned int(32) timescale;\r\n\t\tunsigned int(32) duration;\r\n\t}\r\n\r\n\ttemplate int(32) rate = 0x00010000; \/\/ typically 1.0\r\n\ttemplate int(16) volume = 0x0100; \/\/ typically, full volume\r\n\tconst bit(16) reserved = 0;\r\n\tconst unsigned int(32)&#x5B;2] reserved = 0;\r\n\ttemplate int(32)&#x5B;9] matrix =\r\n\t\t{ 0x00010000,0,0,0,0x00010000,0,0,0,0x40000000 }; \/\/ Unity matrix\r\n\tbit(32)&#x5B;6] pre_defined = 0;\r\n\tunsigned int(32) next_track_ID;\r\n}\r\n<\/pre>\n<p>\u6700\u5f00\u59cb4\u4e2a\u5355\u5143\u662fsize\uff0c\u5176\u503c\u4e3a00 00 00 6C\uff0c\u6362\u6210decimal\u4e3a108(6 * 16 + 12)<\/p>\n<p>\u63a5\u4e0b\u67654\u4e2a\u5355\u5143\u662ftype\uff0c\u5176\u503c\u4e3a6D 76 68 64\uff0c\u5bf9\u5e94&#8217;m&#8217;, &#8216;v&#8217;, &#8216;h&#8217;, &#8216;d&#8217;\u8fd94\u4e2a\u5b57\u7b26\u7684ASCII\u7f16\u7801<\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u662fversion, flag, creation_time, modification_time\u7b49\u7b49<\/p>\n<p>\u8fd9\u91cc\u6709\u70b9\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u89c4\u8303\u4e0a\u8bf4\u5bf9\u4e8eversion\u4e3a0\u548c\u4e3a1\u6709\u4e9b\u5c5e\u6027\u7684\u957f\u5ea6\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u6211\u4eec\u8fd9\u91cc\u53ef\u4ee5\u6765\u770b\u4e00\u4e0b\u3002<\/p>\n<p>\u6bd4\u5982\u8fd9\u91ccversion\u662f9\u5355\u5143\uff0c\u5b83\u53ea\u5360\u7528\u4e00\u4e2a\u5b57\u8282\uff0c\u5176\u503c\u4e3a00\uff0c\u4e5f\u5c31\u662f0\uff0c\u90a3\u4e48\u540e\u9762creation_time\uff0cmodification_time\uff0ctime scale\u548cduration\u5747\u6bcf\u4e2a\u5c5e\u6027\u5360\u75284\u4e2a\u5355\u5143\u3002<\/p>\n<p>creation_time\u4ece13\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a50 4C 2C 57\uff0c\u8fd9\u662f\u4e00\u4e2atimestamp\uff0c\u8f6c\u5316\u6210string\u7c7b\u578b\u8868\u793a\u4e3a&#8221;2012-09-09 13:42:47&#8243;<\/p>\n<p>modification_time\u4ece17\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a50 4C 2C 57\uff0c\u5982\u4e0a\uff0c\u6240\u4ee5\u8fd9\u4e2a\u6863\u6848\u662f\u57282012-09-09 13:42:47\u521b\u5efa\u8fc7\u4e4b\u540e\u4e5f\u6ca1\u6709\u4fee\u6539\u8fc7\u3002<\/p>\n<p>time scale\u4ece21\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a00 00 03 E8\uff0c\u6362\u7b97\u6210decimal\u4e3a1000<\/p>\n<p>duration\u4ece25\u5355\u5143\u5f00\u59cb\uff0c\u5176\u503c\u4e3a00 03 7B 90\uff0c\u6362\u7b97\u6210decimal\u4e3a228240<\/p>\n<p>\u8be5duration\u662f\u6240\u6709track\u5f53\u4e2d\u6700\u957f\u7684\u90a3\u4e2a\uff0c\u5728\u89c4\u8303\u5f53\u4e2d\u6709\u5199\uff0c\u53e6\u5916\u8fd9\u91cc\u7684duration\u662f\u901a\u8fc7time scale\u8868\u793a\u7684\u3002<\/p>\n<p>\u6362\u7b97\u6210\u6211\u4eec\u901a\u5e38\u7684\u65f6\u95f4\u5750\u6807\u7cfb\u5c31\u662f228240 \/ 1000 = 228.24\uff0c\u7ea6\u4e3a228\u79d2\uff0c\u5373228240\u6beb\u79d2\u3002<\/p>\n<p>\u5a92\u4f53\u6863\u6848\u683c\u5f0f\u57fa\u672c\u5c31\u662f\u6309\u7167\u6b64\u7c7b\u65b9\u6cd5\u6765\u5206\u6790\u7684\uff0c\u6bd4\u5982\u8fd9\u6bb5\u89c6\u9891\u6709\u51e0\u4e2atrack\uff0c\u4ee5\u53ca\u662f\u5206\u522b\u662f\u4ec0\u4e48track\uff0c\u5c31\u53ea\u9700\u8981\u53bb\u89e3\u6790\u5b83\u7684moov\/trak\u7684Box\u3002<\/p>\n<p>\u9047\u5230\u4e0d\u662f\u5f88\u660e\u767d\u7684\u6982\u5ff5\u7684\u65f6\u5019\u5c3d\u53ef\u80fd\u7684\u5148\u5230\u89c4\u8303\u5f53\u4e2d\u627e\u627e\u770b\u6709\u6ca1\u6709\u5b9a\u4e49\uff0c\u4e00\u822c\u89e3\u91ca\u7684\u90fd\u8fd8\u662f\u6bd4\u8f83\u6e05\u695a\u3002\u6bd4\u5982\u4e0b\u9762\u8fd9\u4e2a\u6700\u57fa\u672c\u7684\u3002<\/p>\n<p>[mvhd]<br \/>\ntimescale 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.<\/p>\n<p>[mvhd]<br \/>\nduration is an integer that declares length of the presentation (in the indicated timescale). This property is derived from the presentation&#8217;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.<\/p>\n<p>[mvhd]<br \/>\nrate is a fixed point 16.16 number that indicates the preferred rate to play the presentation; 1.0 (0x00010000) is normal forward playback<\/p>\n<p>[trak]<br \/>\nduration is an integer that indicates the duration of this track (in the timescale indicated in the Movie Header Box). The value of this field is equal to the sum of the durations of all of the track&#8217;s edits. If there is no edit list, then the duration is the sum of the sample durations, converted into the timescale in the Movie Header Box. If the duration of this track cannot be determined then duration is set to all 1s.<\/p>\n<p>[trak]<br \/>\nlayer 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.<\/p>\n<p>\u6709\u6839\u636e\u89c4\u8303\u548cAOSP\u7684\u4ee3\u7801\u5199\u4e00\u4e2a\u5728Linux x86_64\u4e0b\u9a8c\u8bc1\u8fc7\u7684MPEG4\u6587\u4ef6\u89e3\u6790\u5de5\u5177\uff0c<a href=\"https:\/\/github.com\/guohai\/gmpe4\" target=\"_blank\">https:\/\/github.com\/guohai\/gmpe4<\/a>\uff0c\u6b22\u8fce\u5927\u5bb6\u4f7f\u7528\uff0c\u63d0\u610f\u89c1\u6216\u8005\u5b8c\u5584\u5b83\u3002<\/p>\n<p>\u63a8\u8350\u53c2\u8003\u7684\u8d44\u6599\uff1a<br \/>\n<a href=\"http:\/\/blog.sina.com.cn\/s\/blog_48f93b530100jz4b.html\" target=\"_blank\">MP4\u6587\u4ef6\u683c\u5f0f\u89e3\u6790\u7cfb\u5217<\/a>(http:\/\/blog.sina.com.cn\/s\/blog_48f93b530100jz4b.html)<br \/>\n<a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=QuickTime_container\" target=\"_blank\">QuickTime container<\/a>(http:\/\/wiki.multimedia.cx\/index.php?title=QuickTime_container)<br \/>\n<a href=\"http:\/\/mp4ra.org\/atoms.html\" target=\"_blank\">http:\/\/mp4ra.org\/atoms.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u7edc\u4e0a\u5f88\u591a\u8bb2\u89e3\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f(\u6bd4\u5982MP4\u6863\u6848)\u7684\u6587\u7ae0\uff0c\u6709\u4e0d\u5c11\u662f\u4f5c\u8005\u61c2\u4e86\u76f8\u5173\u7684\u4e1c\u897f\uff0c\u7136\u540e\u518d\u81ea\u5df1\u603b\u7ed3\u51fa\u6765\u7684\uff0c\u4f18\u70b9\u5c31\u662f\u4ed6\u4eec\u6293\u4f4f\u91cd\u70b9\uff0c\u5199\u51fa\u6ce8\u610f\u7684\u5730\u65b9\uff0c\u7f3a\u70b9\u5c31\u662f\u6709\u65f6\u5019\u4f60\u4f1a\u89c9\u5f97\u5f88\u7a81\u7136\uff0c\u7a81\u7136\u5c31\u51fa\u6765\u4e00\u4e2a\u65b0\u7684\u6982\u5ff5\uff0c\u5b9a\u4e49\uff0c\u56e0\u4e3a\u4ed6\u4eec\u9ed8\u8ba4\u4f60\u5e94\u8be5\u719f\u6089\u76f8\u5e94\u7684\u89c4\u8303\u3002\u6211\u5728\u8fd9\u91cc\u4ece\u57fa\u672c\u70b9\u5165\u624b\uff0c\u5199\u70b9\u5173\u4e8e\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f\u7684\u4e1c\u897f\u3002 \u9996\u5148\u4f60\u5e94\u8be5\u6709\u4e00\u4efdISO\/IEC 14496-12(Part 12: ISO base media file format)\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u4ecehttp:\/\/standards.iso.org\/ittf\/PubliclyAvailableStandards\/index.html\u514d\u8d39\u4e0b\u8f7d\u5230\u3002\u867d\u7136\u662f\u82f1\u6587\u7684\uff0c\u4f46\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u4e1c\u897f\u8fd8\u662f\u4e0d\u96be\u3002 \u5f53\u7136\u4f60\u5e94\u8be5\u77e5\u9053\u4e00\u4e9b\u57fa\u672c\u7684\u6982\u5ff5\uff0c\u6bd4\u5982container file, codec, track\u7b49\u7b49\u3002\u6bd4\u5982\u901a\u5e38\u770b\u5230\u7684\u4e00\u4e2aMP4\u6587\u4ef6\u5b83\u5c31\u662f\u4e00\u4e2acontainer file\uff0c\u5b83\u91cc\u9762\u88c5\u4e86\u6765\u81eacodec\u7f16\u7801\u540e\u7684\u6570\u636e\uff0c\u53ef\u80fd\u5305\u62ec\u4e00\u4e2a\u6216\u8005\u591a\u4e2atrack(\u901a\u5e38\u6709\u4e00\u4e2a\u89c6\u9891track\uff0c\u4e00\u4e2a\u97f3\u9891track\uff0c\u6709\u7684\u53ef\u80fd\u6709\u591a\u4e2a\u97f3\u9891track\uff0c\u6bd4\u5982\u4e2d\u6587\/\u82f1\u6587\/\u5e7f\u4e1c\u8bdd\/\u897f\u73ed\u7259\u8bed\uff0c\u8fd8\u6709\u53ef\u80fd\u6709\u5b57\u5e55track)\u3002 \u9996\u5148\u9700\u8981\u9605\u8bfb\u6700\u57fa\u672c\u7684\u51e0\u4e2a\u7ae0\u8282\u5c31\u53ef\u4ee5 3 Terms, definitions, and abbreviated terms 4 Object-structured File Organization 5 Design Considerations \u5373\u4e00\u4e9b\u57fa\u672c\u672f\u8bed\uff0c\u5b9a\u4e49\uff0c\u6bd4\u5982Box, Chunk, Container Box, Hint Box, Sample\u7b49\u7b49 \u5176\u4e2d\u6587\u4ef6\u7ec4\u7ec7\u7ed3\u6784\u5f53\u4e2d\u89c4\u5b9a\u4e86\u6587\u4ef6\u662f\u6709\u4e00\u7cfb\u5217\u7684Box\u7ec4\u6210\uff0c\u5728\u6587\u4ef6\u5f53\u4e2d\u9664\u4e86Box\u6ca1\u6709\u5176\u4ed6\u4e1c\u897f\uff0c\u6240\u6709\u6570\u636e\u90fd\u662f\u5305\u542b\u5728Box\u5f53\u4e2d\uff0c\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u8981\u91c7\u53d6\u8fd9\u6837\u9762\u76f8\u5bf9\u8c61\u7684\u8bbe\u8ba1\u3002 \u901a\u5e38Box\u7531header\u548c\u5305\u542b\u5728\u5176\u4e2d\u7684data\u7ec4\u6210\uff0cheader\u4e2d\u5305\u542b\u4e86\u8fd9\u4e2aBox\u7684size\u548ctype\u4fe1\u606f\uff0c\u5f53\u7136size\u662f\u5305\u542b\u4e86\u8fd9\u4e2aBox\u5f53\u4e2d\u6240\u6709\u6570\u636e\u5728\u5185\uff0c\u4e5f\u5305\u542b\u8fd9\u4e2aheader\u3002 \u5982\u679cBox\u7684type\u4e0d\u80fd\u88ab\u8bc6\u522b\uff0c\u90a3\u4e48\u8fd9\u4e2aBox\u5c31\u8be5\u88ab\u5ffd\u7565\u3002 aligned(8) class Box(unsigned int(32) boxtype, optional unsigned int(8)&#x5B;16] extended_type) { unsigned int(32) size; unsigned int(32) type = &hellip; <a href=\"https:\/\/guoh.ai\/lifelog\/2013\/08\/format-of-container-file-and-iso-iec-14496-12\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f\u4ee5\u53caISO\/IEC 14496-12\u89c4\u8303<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-676","post","type-post","status-publish","format-standard","hentry","category-multimedia"],"_links":{"self":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/comments?post=676"}],"version-history":[{"count":6,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/676\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/676\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/media?parent=676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/categories?post=676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/tags?post=676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}