animation 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. #------------------------------------------------------------------------------
  2. # animation: file(1) magic for animation/movie formats
  3. #
  4. # animation formats
  5. # MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
  6. # FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
  7. # SGI and Apple formats
  8. 0 string MOVI Silicon Graphics movie file
  9. !:mime video/x-sgi-movie
  10. 4 string moov Apple QuickTime
  11. !:mime video/quicktime
  12. >12 string mvhd \b movie (fast start)
  13. >12 string mdra \b URL
  14. >12 string cmov \b movie (fast start, compressed header)
  15. >12 string rmra \b multiple URLs
  16. 4 string mdat Apple QuickTime movie (unoptimized)
  17. !:mime video/quicktime
  18. #4 string wide Apple QuickTime movie (unoptimized)
  19. #!:mime video/quicktime
  20. #4 string skip Apple QuickTime movie (modified)
  21. #!:mime video/quicktime
  22. #4 string free Apple QuickTime movie (modified)
  23. #!:mime video/quicktime
  24. 4 string idsc Apple QuickTime image (fast start)
  25. !:mime image/x-quicktime
  26. #4 string idat Apple QuickTime image (unoptimized)
  27. #!:mime image/x-quicktime
  28. 4 string pckg Apple QuickTime compressed archive
  29. !:mime application/x-quicktime-player
  30. 4 string/B jP JPEG 2000 image
  31. !:mime image/jp2
  32. 4 string ftyp ISO Media
  33. >8 string isom \b, MPEG v4 system, version 1
  34. !:mime video/mp4
  35. >8 string iso2 \b, MPEG v4 system, part 12 revision
  36. >8 string mp41 \b, MPEG v4 system, version 1
  37. !:mime video/mp4
  38. >8 string mp42 \b, MPEG v4 system, version 2
  39. !:mime video/mp4
  40. >8 string mp7t \b, MPEG v4 system, MPEG v7 XML
  41. >8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML
  42. >8 string/B jp2 \b, JPEG 2000
  43. !:mime image/jp2
  44. >8 string 3gp \b, MPEG v4 system, 3GPP
  45. !:mime video/3gpp
  46. >>11 byte 4 \b v4 (H.263/AMR GSM 6.10)
  47. >>11 byte 5 \b v5 (H.263/AMR GSM 6.10)
  48. >>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10)
  49. >8 string mmp4 \b, MPEG v4 system, 3GPP Mobile
  50. !:mime video/mp4
  51. >8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC
  52. !:mime video/3gpp
  53. >8 string/B M4A \b, MPEG v4 system, iTunes AAC-LC
  54. !:mime audio/mp4
  55. >8 string/B M4V \b, MPEG v4 system, iTunes AVC-LC
  56. !:mime video/mp4
  57. >8 string/B M4P \b, MPEG v4 system, iTunes AES encrypted
  58. >8 string/B M4B \b, MPEG v4 system, iTunes bookmarked
  59. >8 string/B qt \b, Apple QuickTime movie
  60. !:mime video/quicktime
  61. # MPEG sequences
  62. # Scans for all common MPEG header start codes
  63. 0 belong 0x00000001 JVT NAL sequence
  64. >4 byte&0x1F 0x07 \b, H.264 video
  65. >>5 byte 66 \b, baseline
  66. >>5 byte 77 \b, main
  67. >>5 byte 88 \b, extended
  68. >>7 byte x \b @ L %u
  69. 0 string \000\000\001 MPEG sequence
  70. >3 byte 0xBA
  71. >>4 byte &0x40 \b, v2, program multiplex
  72. >>4 byte ^0x40 \b, v1, system multiplex
  73. >3 byte 0xBB \b, v1/2, multiplex (missing pack header)
  74. >3 byte&0x1F 0x07 \b, H.264 video
  75. >>4 byte 66 \b, baseline
  76. >>4 byte 77 \b, main
  77. >>4 byte 88 \b, extended
  78. >>6 byte x \b @ L %u
  79. >3 byte 0xB0 \b, v4
  80. >>5 belong 0x000001B5
  81. >>>9 byte &0x80
  82. >>>>10 byte&0xF0 16 \b, video
  83. >>>>10 byte&0xF0 32 \b, still texture
  84. >>>>10 byte&0xF0 48 \b, mesh
  85. >>>>10 byte&0xF0 64 \b, face
  86. >>>9 byte&0xF8 8 \b, video
  87. >>>9 byte&0xF8 16 \b, still texture
  88. >>>9 byte&0xF8 24 \b, mesh
  89. >>>9 byte&0xF8 32 \b, face
  90. >>4 byte 1 \b, simple @ L1
  91. >>4 byte 2 \b, simple @ L2
  92. >>4 byte 3 \b, simple @ L3
  93. >>4 byte 4 \b, simple @ L0
  94. >>4 byte 17 \b, simple scalable @ L1
  95. >>4 byte 18 \b, simple scalable @ L2
  96. >>4 byte 33 \b, core @ L1
  97. >>4 byte 34 \b, core @ L2
  98. >>4 byte 50 \b, main @ L2
  99. >>4 byte 51 \b, main @ L3
  100. >>4 byte 53 \b, main @ L4
  101. >>4 byte 66 \b, n-bit @ L2
  102. >>4 byte 81 \b, scalable texture @ L1
  103. >>4 byte 97 \b, simple face animation @ L1
  104. >>4 byte 98 \b, simple face animation @ L2
  105. >>4 byte 99 \b, simple face basic animation @ L1
  106. >>4 byte 100 \b, simple face basic animation @ L2
  107. >>4 byte 113 \b, basic animation text @ L1
  108. >>4 byte 114 \b, basic animation text @ L2
  109. >>4 byte 129 \b, hybrid @ L1
  110. >>4 byte 130 \b, hybrid @ L2
  111. >>4 byte 145 \b, advanced RT simple @ L!
  112. >>4 byte 146 \b, advanced RT simple @ L2
  113. >>4 byte 147 \b, advanced RT simple @ L3
  114. >>4 byte 148 \b, advanced RT simple @ L4
  115. >>4 byte 161 \b, core scalable @ L1
  116. >>4 byte 162 \b, core scalable @ L2
  117. >>4 byte 163 \b, core scalable @ L3
  118. >>4 byte 177 \b, advanced coding efficiency @ L1
  119. >>4 byte 178 \b, advanced coding efficiency @ L2
  120. >>4 byte 179 \b, advanced coding efficiency @ L3
  121. >>4 byte 180 \b, advanced coding efficiency @ L4
  122. >>4 byte 193 \b, advanced core @ L1
  123. >>4 byte 194 \b, advanced core @ L2
  124. >>4 byte 209 \b, advanced scalable texture @ L1
  125. >>4 byte 210 \b, advanced scalable texture @ L2
  126. >>4 byte 211 \b, advanced scalable texture @ L3
  127. >>4 byte 225 \b, simple studio @ L1
  128. >>4 byte 226 \b, simple studio @ L2
  129. >>4 byte 227 \b, simple studio @ L3
  130. >>4 byte 228 \b, simple studio @ L4
  131. >>4 byte 229 \b, core studio @ L1
  132. >>4 byte 230 \b, core studio @ L2
  133. >>4 byte 231 \b, core studio @ L3
  134. >>4 byte 232 \b, core studio @ L4
  135. >>4 byte 240 \b, advanced simple @ L0
  136. >>4 byte 241 \b, advanced simple @ L1
  137. >>4 byte 242 \b, advanced simple @ L2
  138. >>4 byte 243 \b, advanced simple @ L3
  139. >>4 byte 244 \b, advanced simple @ L4
  140. >>4 byte 245 \b, advanced simple @ L5
  141. >>4 byte 247 \b, advanced simple @ L3b
  142. >>4 byte 248 \b, FGS @ L0
  143. >>4 byte 249 \b, FGS @ L1
  144. >>4 byte 250 \b, FGS @ L2
  145. >>4 byte 251 \b, FGS @ L3
  146. >>4 byte 252 \b, FGS @ L4
  147. >>4 byte 253 \b, FGS @ L5
  148. >3 byte 0xB5 \b, v4
  149. >>4 byte &0x80
  150. >>>5 byte&0xF0 16 \b, video (missing profile header)
  151. >>>5 byte&0xF0 32 \b, still texture (missing profile header)
  152. >>>5 byte&0xF0 48 \b, mesh (missing profile header)
  153. >>>5 byte&0xF0 64 \b, face (missing profile header)
  154. >>4 byte&0xF8 8 \b, video (missing profile header)
  155. >>4 byte&0xF8 16 \b, still texture (missing profile header)
  156. >>4 byte&0xF8 24 \b, mesh (missing profile header)
  157. >>4 byte&0xF8 32 \b, face (missing profile header)
  158. >3 byte 0xB3
  159. >>12 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video
  160. >>12 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video
  161. >>12 belong 0x000001B5 \b, v2,
  162. >>>16 byte&0x0F 1 \b HP
  163. >>>16 byte&0x0F 2 \b Spt
  164. >>>16 byte&0x0F 3 \b SNR
  165. >>>16 byte&0x0F 4 \b MP
  166. >>>16 byte&0x0F 5 \b SP
  167. >>>17 byte&0xF0 64 \b@HL
  168. >>>17 byte&0xF0 96 \b@H-14
  169. >>>17 byte&0xF0 128 \b@ML
  170. >>>17 byte&0xF0 160 \b@LL
  171. >>>17 byte &0x08 \b progressive
  172. >>>17 byte ^0x08 \b interlaced
  173. >>>17 byte&0x06 2 \b Y'CbCr 4:2:0 video
  174. >>>17 byte&0x06 4 \b Y'CbCr 4:2:2 video
  175. >>>17 byte&0x06 6 \b Y'CbCr 4:4:4 video
  176. >>11 byte &0x02
  177. >>>75 byte &0x01
  178. >>>>140 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video
  179. >>>>140 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video
  180. >>>>140 belong 0x000001B5 \b, v2,
  181. >>>>>144 byte&0x0F 1 \b HP
  182. >>>>>144 byte&0x0F 2 \b Spt
  183. >>>>>144 byte&0x0F 3 \b SNR
  184. >>>>>144 byte&0x0F 4 \b MP
  185. >>>>>144 byte&0x0F 5 \b SP
  186. >>>>>145 byte&0xF0 64 \b@HL
  187. >>>>>145 byte&0xF0 96 \b@H-14
  188. >>>>>145 byte&0xF0 128 \b@ML
  189. >>>>>145 byte&0xF0 160 \b@LL
  190. >>>>>145 byte &0x08 \b progressive
  191. >>>>>145 byte ^0x08 \b interlaced
  192. >>>>>145 byte&0x06 2 \b Y'CbCr 4:2:0 video
  193. >>>>>145 byte&0x06 4 \b Y'CbCr 4:2:2 video
  194. >>>>>145 byte&0x06 6 \b Y'CbCr 4:4:4 video
  195. >>76 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video
  196. >>76 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video
  197. >>76 belong 0x000001B5 \b, v2,
  198. >>>80 byte&0x0F 1 \b HP
  199. >>>80 byte&0x0F 2 \b Spt
  200. >>>80 byte&0x0F 3 \b SNR
  201. >>>80 byte&0x0F 4 \b MP
  202. >>>80 byte&0x0F 5 \b SP
  203. >>>81 byte&0xF0 64 \b@HL
  204. >>>81 byte&0xF0 96 \b@H-14
  205. >>>81 byte&0xF0 128 \b@ML
  206. >>>81 byte&0xF0 160 \b@LL
  207. >>>81 byte &0x08 \b progressive
  208. >>>81 byte ^0x08 \b interlaced
  209. >>>81 byte&0x06 2 \b Y'CbCr 4:2:0 video
  210. >>>81 byte&0x06 4 \b Y'CbCr 4:2:2 video
  211. >>>81 byte&0x06 6 \b Y'CbCr 4:4:4 video
  212. >>4 belong&0xFFFFFF00 0x78043800 \b, HD-TV 1920P
  213. >>>7 byte&0xF0 0x10 \b, 16:9
  214. >>4 belong&0xFFFFFF00 0x50002D00 \b, SD-TV 1280I
  215. >>>7 byte&0xF0 0x10 \b, 16:9
  216. >>4 belong&0xFFFFFF00 0x30024000 \b, PAL Capture
  217. >>>7 byte&0xF0 0x10 \b, 4:3
  218. >>4 beshort&0xFFF0 0x2C00 \b, 4CIF
  219. >>>5 beshort&0x0FFF 0x01E0 \b NTSC
  220. >>>5 beshort&0x0FFF 0x0240 \b PAL
  221. >>>7 byte&0xF0 0x20 \b, 4:3
  222. >>>7 byte&0xF0 0x30 \b, 16:9
  223. >>>7 byte&0xF0 0x40 \b, 11:5
  224. >>>7 byte&0xF0 0x80 \b, PAL 4:3
  225. >>>7 byte&0xF0 0xC0 \b, NTSC 4:3
  226. >>4 belong&0xFFFFFF00 0x2801E000 \b, LD-TV 640P
  227. >>>7 byte&0xF0 0x10 \b, 4:3
  228. >>4 belong&0xFFFFFF00 0x1400F000 \b, 320x240
  229. >>>7 byte&0xF0 0x10 \b, 4:3
  230. >>4 belong&0xFFFFFF00 0x0F00A000 \b, 240x160
  231. >>>7 byte&0xF0 0x10 \b, 4:3
  232. >>4 belong&0xFFFFFF00 0x0A007800 \b, 160x120
  233. >>>7 byte&0xF0 0x10 \b, 4:3
  234. >>4 beshort&0xFFF0 0x1600 \b, CIF
  235. >>>5 beshort&0x0FFF 0x00F0 \b NTSC
  236. >>>5 beshort&0x0FFF 0x0120 \b PAL
  237. >>>7 byte&0xF0 0x20 \b, 4:3
  238. >>>7 byte&0xF0 0x30 \b, 16:9
  239. >>>7 byte&0xF0 0x40 \b, 11:5
  240. >>>7 byte&0xF0 0x80 \b, PAL 4:3
  241. >>>7 byte&0xF0 0xC0 \b, NTSC 4:3
  242. >>>5 beshort&0x0FFF 0x0240 \b PAL 625
  243. >>>>7 byte&0xF0 0x20 \b, 4:3
  244. >>>>7 byte&0xF0 0x30 \b, 16:9
  245. >>>>7 byte&0xF0 0x40 \b, 11:5
  246. >>4 beshort&0xFFF0 0x2D00 \b, CCIR/ITU
  247. >>>5 beshort&0x0FFF 0x01E0 \b NTSC 525
  248. >>>5 beshort&0x0FFF 0x0240 \b PAL 625
  249. >>>7 byte&0xF0 0x20 \b, 4:3
  250. >>>7 byte&0xF0 0x30 \b, 16:9
  251. >>>7 byte&0xF0 0x40 \b, 11:5
  252. >>4 beshort&0xFFF0 0x1E00 \b, SVCD
  253. >>>5 beshort&0x0FFF 0x01E0 \b NTSC 525
  254. >>>5 beshort&0x0FFF 0x0240 \b PAL 625
  255. >>>7 byte&0xF0 0x20 \b, 4:3
  256. >>>7 byte&0xF0 0x30 \b, 16:9
  257. >>>7 byte&0xF0 0x40 \b, 11:5
  258. >>7 byte&0x0F 1 \b, 23.976 fps
  259. >>7 byte&0x0F 2 \b, 24 fps
  260. >>7 byte&0x0F 3 \b, 25 fps
  261. >>7 byte&0x0F 4 \b, 29.97 fps
  262. >>7 byte&0x0F 5 \b, 30 fps
  263. >>7 byte&0x0F 6 \b, 50 fps
  264. >>7 byte&0x0F 7 \b, 59.94 fps
  265. >>7 byte&0x0F 8 \b, 60 fps
  266. >>11 byte &0x04 \b, Constrained
  267. # MPEG ADTS Audio (*.mpx/mxa/aac)
  268. # from dreesen@math.fu-berlin.de
  269. # modified to fully support MPEG ADTS
  270. # MP3, M1A
  271. # modified by Joerg Jenderek
  272. # GRR the original test are too common for many DOS files
  273. # so don't accept as MP3 until we've tested the rate
  274. 0 beshort&0xFFFE
  275. # rates
  276. >2 byte&0xF0 0x10 MPEG ADTS, layer III, v1, 32 kbps
  277. !:mime audio/mpeg
  278. >2 byte&0xF0 0x20 MPEG ADTS, layer III, v1, 40 kbps
  279. !:mime audio/mpeg
  280. >2 byte&0xF0 0x30 MPEG ADTS, layer III, v1, 48 kbps
  281. !:mime audio/mpeg
  282. >2 byte&0xF0 0x40 MPEG ADTS, layer III, v1, 56 kbps
  283. !:mime audio/mpeg
  284. >2 byte&0xF0 0x50 MPEG ADTS, layer III, v1, 64 kbps
  285. !:mime audio/mpeg
  286. >2 byte&0xF0 0x60 MPEG ADTS, layer III, v1, 80 kbps
  287. !:mime audio/mpeg
  288. >2 byte&0xF0 0x70 MPEG ADTS, layer III, v1, 96 kbps
  289. !:mime audio/mpeg
  290. >2 byte&0xF0 0x80 MPEG ADTS, layer III, v1, 112 kbps
  291. !:mime audio/mpeg
  292. >2 byte&0xF0 0x90 MPEG ADTS, layer III, v1, 128 kbps
  293. !:mime audio/mpeg
  294. >2 byte&0xF0 0xA0 MPEG ADTS, layer III, v1, 160 kbps
  295. !:mime audio/mpeg
  296. >2 byte&0xF0 0xB0 MPEG ADTS, layer III, v1, 192 kbps
  297. !:mime audio/mpeg
  298. >2 byte&0xF0 0xC0 MPEG ADTS, layer III, v1, 224 kbps
  299. !:mime audio/mpeg
  300. >2 byte&0xF0 0xD0 MPEG ADTS, layer III, v1, 256 kbps
  301. !:mime audio/mpeg
  302. >2 byte&0xF0 0xE0 MPEG ADTS, layer III, v1, 320 kbps
  303. !:mime audio/mpeg
  304. # timing
  305. >2 byte&0x0C 0x00 \b, 44.1 kHz
  306. >2 byte&0x0C 0x04 \b, 48 kHz
  307. >2 byte&0x0C 0x08 \b, 32 kHz
  308. # channels/options
  309. >3 byte&0xC0 0x00 \b, Stereo
  310. >3 byte&0xC0 0x40 \b, JntStereo
  311. >3 byte&0xC0 0x80 \b, 2x Monaural
  312. >3 byte&0xC0 0xC0 \b, Monaural
  313. #>1 byte ^0x01 \b, Data Verify
  314. #>2 byte &0x02 \b, Packet Pad
  315. #>2 byte &0x01 \b, Custom Flag
  316. #>3 byte &0x08 \b, Copyrighted
  317. #>3 byte &0x04 \b, Original Source
  318. #>3 byte&0x03 1 \b, NR: 50/15 ms
  319. #>3 byte&0x03 3 \b, NR: CCIT J.17
  320. # MP2, M1A
  321. 0 beshort&0xFFFE 0xFFFC MPEG ADTS, layer II, v1
  322. # rates
  323. >2 byte&0xF0 0x10 \b, 32 kbps
  324. >2 byte&0xF0 0x20 \b, 48 kbps
  325. >2 byte&0xF0 0x30 \b, 56 kbps
  326. >2 byte&0xF0 0x40 \b, 64 kbps
  327. >2 byte&0xF0 0x50 \b, 80 kbps
  328. >2 byte&0xF0 0x60 \b, 96 kbps
  329. >2 byte&0xF0 0x70 \b, 112 kbps
  330. >2 byte&0xF0 0x80 \b, 128 kbps
  331. >2 byte&0xF0 0x90 \b, 160 kbps
  332. >2 byte&0xF0 0xA0 \b, 192 kbps
  333. >2 byte&0xF0 0xB0 \b, 224 kbps
  334. >2 byte&0xF0 0xC0 \b, 256 kbps
  335. >2 byte&0xF0 0xD0 \b, 320 kbps
  336. >2 byte&0xF0 0xE0 \b, 384 kbps
  337. # timing
  338. >2 byte&0x0C 0x00 \b, 44.1 kHz
  339. >2 byte&0x0C 0x04 \b, 48 kHz
  340. >2 byte&0x0C 0x08 \b, 32 kHz
  341. # channels/options
  342. >3 byte&0xC0 0x00 \b, Stereo
  343. >3 byte&0xC0 0x40 \b, JntStereo
  344. >3 byte&0xC0 0x80 \b, 2x Monaural
  345. >3 byte&0xC0 0xC0 \b, Monaural
  346. #>1 byte ^0x01 \b, Data Verify
  347. #>2 byte &0x02 \b, Packet Pad
  348. #>2 byte &0x01 \b, Custom Flag
  349. #>3 byte &0x08 \b, Copyrighted
  350. #>3 byte &0x04 \b, Original Source
  351. #>3 byte&0x03 1 \b, NR: 50/15 ms
  352. #>3 byte&0x03 3 \b, NR: CCIT J.17
  353. # MPA, M1A
  354. # updated by Joerg Jenderek
  355. # GRR the original test are too common for many DOS files, so test 32 <= kbits <= 448
  356. # GRR this test is still too general as it catches a BOM of UTF-16 files (0xFFFE)
  357. #0 beshort&0xFFFE 0xFFFE
  358. #>2 ubyte&0xF0 >0x0F
  359. #>>2 ubyte&0xF0 <0xE1 MPEG ADTS, layer I, v1
  360. ## rate
  361. #>>>2 byte&0xF0 0x10 \b, 32 kbps
  362. #>>>2 byte&0xF0 0x20 \b, 64 kbps
  363. #>>>2 byte&0xF0 0x30 \b, 96 kbps
  364. #>>>2 byte&0xF0 0x40 \b, 128 kbps
  365. #>>>2 byte&0xF0 0x50 \b, 160 kbps
  366. #>>>2 byte&0xF0 0x60 \b, 192 kbps
  367. #>>>2 byte&0xF0 0x70 \b, 224 kbps
  368. #>>>2 byte&0xF0 0x80 \b, 256 kbps
  369. #>>>2 byte&0xF0 0x90 \b, 288 kbps
  370. #>>>2 byte&0xF0 0xA0 \b, 320 kbps
  371. #>>>2 byte&0xF0 0xB0 \b, 352 kbps
  372. #>>>2 byte&0xF0 0xC0 \b, 384 kbps
  373. #>>>2 byte&0xF0 0xD0 \b, 416 kbps
  374. #>>>2 byte&0xF0 0xE0 \b, 448 kbps
  375. ## timing
  376. #>>>2 byte&0x0C 0x00 \b, 44.1 kHz
  377. #>>>2 byte&0x0C 0x04 \b, 48 kHz
  378. #>>>2 byte&0x0C 0x08 \b, 32 kHz
  379. ## channels/options
  380. #>>>3 byte&0xC0 0x00 \b, Stereo
  381. #>>>3 byte&0xC0 0x40 \b, JntStereo
  382. #>>>3 byte&0xC0 0x80 \b, 2x Monaural
  383. #>>>3 byte&0xC0 0xC0 \b, Monaural
  384. ##>1 byte ^0x01 \b, Data Verify
  385. ##>2 byte &0x02 \b, Packet Pad
  386. ##>2 byte &0x01 \b, Custom Flag
  387. ##>3 byte &0x08 \b, Copyrighted
  388. ##>3 byte &0x04 \b, Original Source
  389. ##>3 byte&0x03 1 \b, NR: 50/15 ms
  390. ##>3 byte&0x03 3 \b, NR: CCIT J.17
  391. # MP3, M2A
  392. 0 beshort&0xFFFE 0xFFF2 MPEG ADTS, layer III, v2
  393. # rate
  394. >2 byte&0xF0 0x10 \b, 8 kbps
  395. >2 byte&0xF0 0x20 \b, 16 kbps
  396. >2 byte&0xF0 0x30 \b, 24 kbps
  397. >2 byte&0xF0 0x40 \b, 32 kbps
  398. >2 byte&0xF0 0x50 \b, 40 kbps
  399. >2 byte&0xF0 0x60 \b, 48 kbps
  400. >2 byte&0xF0 0x70 \b, 56 kbps
  401. >2 byte&0xF0 0x80 \b, 64 kbps
  402. >2 byte&0xF0 0x90 \b, 80 kbps
  403. >2 byte&0xF0 0xA0 \b, 96 kbps
  404. >2 byte&0xF0 0xB0 \b, 112 kbps
  405. >2 byte&0xF0 0xC0 \b, 128 kbps
  406. >2 byte&0xF0 0xD0 \b, 144 kbps
  407. >2 byte&0xF0 0xE0 \b, 160 kbps
  408. # timing
  409. >2 byte&0x0C 0x00 \b, 22.05 kHz
  410. >2 byte&0x0C 0x04 \b, 24 kHz
  411. >2 byte&0x0C 0x08 \b, 16 kHz
  412. # channels/options
  413. >3 byte&0xC0 0x00 \b, Stereo
  414. >3 byte&0xC0 0x40 \b, JntStereo
  415. >3 byte&0xC0 0x80 \b, 2x Monaural
  416. >3 byte&0xC0 0xC0 \b, Monaural
  417. #>1 byte ^0x01 \b, Data Verify
  418. #>2 byte &0x02 \b, Packet Pad
  419. #>2 byte &0x01 \b, Custom Flag
  420. #>3 byte &0x08 \b, Copyrighted
  421. #>3 byte &0x04 \b, Original Source
  422. #>3 byte&0x03 1 \b, NR: 50/15 ms
  423. #>3 byte&0x03 3 \b, NR: CCIT J.17
  424. # MP2, M2A
  425. 0 beshort&0xFFFE 0xFFF4 MPEG ADTS, layer II, v2
  426. # rate
  427. >2 byte&0xF0 0x10 \b, 8 kbps
  428. >2 byte&0xF0 0x20 \b, 16 kbps
  429. >2 byte&0xF0 0x30 \b, 24 kbps
  430. >2 byte&0xF0 0x40 \b, 32 kbps
  431. >2 byte&0xF0 0x50 \b, 40 kbps
  432. >2 byte&0xF0 0x60 \b, 48 kbps
  433. >2 byte&0xF0 0x70 \b, 56 kbps
  434. >2 byte&0xF0 0x80 \b, 64 kbps
  435. >2 byte&0xF0 0x90 \b, 80 kbps
  436. >2 byte&0xF0 0xA0 \b, 96 kbps
  437. >2 byte&0xF0 0xB0 \b, 112 kbps
  438. >2 byte&0xF0 0xC0 \b, 128 kbps
  439. >2 byte&0xF0 0xD0 \b, 144 kbps
  440. >2 byte&0xF0 0xE0 \b, 160 kbps
  441. # timing
  442. >2 byte&0x0C 0x00 \b, 22.05 kHz
  443. >2 byte&0x0C 0x04 \b, 24 kHz
  444. >2 byte&0x0C 0x08 \b, 16 kHz
  445. # channels/options
  446. >3 byte&0xC0 0x00 \b, Stereo
  447. >3 byte&0xC0 0x40 \b, JntStereo
  448. >3 byte&0xC0 0x80 \b, 2x Monaural
  449. >3 byte&0xC0 0xC0 \b, Monaural
  450. #>1 byte ^0x01 \b, Data Verify
  451. #>2 byte &0x02 \b, Packet Pad
  452. #>2 byte &0x01 \b, Custom Flag
  453. #>3 byte &0x08 \b, Copyrighted
  454. #>3 byte &0x04 \b, Original Source
  455. #>3 byte&0x03 1 \b, NR: 50/15 ms
  456. #>3 byte&0x03 3 \b, NR: CCIT J.17
  457. # MPA, M2A
  458. 0 beshort&0xFFFE 0xFFF6 MPEG ADTS, layer I, v2
  459. # rate
  460. >2 byte&0xF0 0x10 \b, 32 kbps
  461. >2 byte&0xF0 0x20 \b, 48 kbps
  462. >2 byte&0xF0 0x30 \b, 56 kbps
  463. >2 byte&0xF0 0x40 \b, 64 kbps
  464. >2 byte&0xF0 0x50 \b, 80 kbps
  465. >2 byte&0xF0 0x60 \b, 96 kbps
  466. >2 byte&0xF0 0x70 \b, 112 kbps
  467. >2 byte&0xF0 0x80 \b, 128 kbps
  468. >2 byte&0xF0 0x90 \b, 144 kbps
  469. >2 byte&0xF0 0xA0 \b, 160 kbps
  470. >2 byte&0xF0 0xB0 \b, 176 kbps
  471. >2 byte&0xF0 0xC0 \b, 192 kbps
  472. >2 byte&0xF0 0xD0 \b, 224 kbps
  473. >2 byte&0xF0 0xE0 \b, 256 kbps
  474. # timing
  475. >2 byte&0x0C 0x00 \b, 22.05 kHz
  476. >2 byte&0x0C 0x04 \b, 24 kHz
  477. >2 byte&0x0C 0x08 \b, 16 kHz
  478. # channels/options
  479. >3 byte&0xC0 0x00 \b, Stereo
  480. >3 byte&0xC0 0x40 \b, JntStereo
  481. >3 byte&0xC0 0x80 \b, 2x Monaural
  482. >3 byte&0xC0 0xC0 \b, Monaural
  483. #>1 byte ^0x01 \b, Data Verify
  484. #>2 byte &0x02 \b, Packet Pad
  485. #>2 byte &0x01 \b, Custom Flag
  486. #>3 byte &0x08 \b, Copyrighted
  487. #>3 byte &0x04 \b, Original Source
  488. #>3 byte&0x03 1 \b, NR: 50/15 ms
  489. #>3 byte&0x03 3 \b, NR: CCIT J.17
  490. # MP3, M25A
  491. 0 beshort&0xFFFE 0xFFE2 MPEG ADTS, layer III, v2.5
  492. # rate
  493. >2 byte&0xF0 0x10 \b, 8 kbps
  494. >2 byte&0xF0 0x20 \b, 16 kbps
  495. >2 byte&0xF0 0x30 \b, 24 kbps
  496. >2 byte&0xF0 0x40 \b, 32 kbps
  497. >2 byte&0xF0 0x50 \b, 40 kbps
  498. >2 byte&0xF0 0x60 \b, 48 kbps
  499. >2 byte&0xF0 0x70 \b, 56 kbps
  500. >2 byte&0xF0 0x80 \b, 64 kbps
  501. >2 byte&0xF0 0x90 \b, 80 kbps
  502. >2 byte&0xF0 0xA0 \b, 96 kbps
  503. >2 byte&0xF0 0xB0 \b, 112 kbps
  504. >2 byte&0xF0 0xC0 \b, 128 kbps
  505. >2 byte&0xF0 0xD0 \b, 144 kbps
  506. >2 byte&0xF0 0xE0 \b, 160 kbps
  507. # timing
  508. >2 byte&0x0C 0x00 \b, 11.025 kHz
  509. >2 byte&0x0C 0x04 \b, 12 kHz
  510. >2 byte&0x0C 0x08 \b, 8 kHz
  511. # channels/options
  512. >3 byte&0xC0 0x00 \b, Stereo
  513. >3 byte&0xC0 0x40 \b, JntStereo
  514. >3 byte&0xC0 0x80 \b, 2x Monaural
  515. >3 byte&0xC0 0xC0 \b, Monaural
  516. #>1 byte ^0x01 \b, Data Verify
  517. #>2 byte &0x02 \b, Packet Pad
  518. #>2 byte &0x01 \b, Custom Flag
  519. #>3 byte &0x08 \b, Copyrighted
  520. #>3 byte &0x04 \b, Original Source
  521. #>3 byte&0x03 1 \b, NR: 50/15 ms
  522. #>3 byte&0x03 3 \b, NR: CCIT J.17
  523. # AAC (aka MPEG-2 NBC audio) and MPEG-4 audio
  524. # Stored AAC streams (instead of the MP4 format)
  525. 0 string ADIF MPEG ADIF, AAC
  526. !:mime audio/x-hx-aac-adif
  527. >4 byte &0x80
  528. >>13 byte &0x10 \b, VBR
  529. >>13 byte ^0x10 \b, CBR
  530. >>16 byte&0x1E 0x02 \b, single stream
  531. >>16 byte&0x1E 0x04 \b, 2 streams
  532. >>16 byte&0x1E 0x06 \b, 3 streams
  533. >>16 byte &0x08 \b, 4 or more streams
  534. >>16 byte &0x10 \b, 8 or more streams
  535. >>4 byte &0x80 \b, Copyrighted
  536. >>13 byte &0x40 \b, Original Source
  537. >>13 byte &0x20 \b, Home Flag
  538. >4 byte ^0x80
  539. >>4 byte &0x10 \b, VBR
  540. >>4 byte ^0x10 \b, CBR
  541. >>7 byte&0x1E 0x02 \b, single stream
  542. >>7 byte&0x1E 0x04 \b, 2 streams
  543. >>7 byte&0x1E 0x06 \b, 3 streams
  544. >>7 byte &0x08 \b, 4 or more streams
  545. >>7 byte &0x10 \b, 8 or more streams
  546. >>4 byte &0x40 \b, Original Stream(s)
  547. >>4 byte &0x20 \b, Home Source
  548. # Live or stored single AAC stream (used with MPEG-2 systems)
  549. 0 beshort&0xFFF6 0xFFF0 MPEG ADTS, AAC
  550. !:mime audio/x-hx-aac-adts
  551. >1 byte &0x08 \b, v2
  552. >1 byte ^0x08 \b, v4
  553. # profile
  554. >>2 byte &0xC0 \b LTP
  555. >2 byte&0xc0 0x00 \b Main
  556. >2 byte&0xc0 0x40 \b LC
  557. >2 byte&0xc0 0x80 \b SSR
  558. # timing
  559. >2 byte&0x3c 0x00 \b, 96 kHz
  560. >2 byte&0x3c 0x04 \b, 88.2 kHz
  561. >2 byte&0x3c 0x08 \b, 64 kHz
  562. >2 byte&0x3c 0x0c \b, 48 kHz
  563. >2 byte&0x3c 0x10 \b, 44.1 kHz
  564. >2 byte&0x3c 0x14 \b, 32 kHz
  565. >2 byte&0x3c 0x18 \b, 24 kHz
  566. >2 byte&0x3c 0x1c \b, 22.05 kHz
  567. >2 byte&0x3c 0x20 \b, 16 kHz
  568. >2 byte&0x3c 0x24 \b, 12 kHz
  569. >2 byte&0x3c 0x28 \b, 11.025 kHz
  570. >2 byte&0x3c 0x2c \b, 8 kHz
  571. # channels
  572. >2 beshort&0x01c0 0x0040 \b, monaural
  573. >2 beshort&0x01c0 0x0080 \b, stereo
  574. >2 beshort&0x01c0 0x00c0 \b, stereo + center
  575. >2 beshort&0x01c0 0x0100 \b, stereo+center+LFE
  576. >2 beshort&0x01c0 0x0140 \b, surround
  577. >2 beshort&0x01c0 0x0180 \b, surround + LFE
  578. >2 beshort &0x01C0 \b, surround + side
  579. #>1 byte ^0x01 \b, Data Verify
  580. #>2 byte &0x02 \b, Custom Flag
  581. #>3 byte &0x20 \b, Original Stream
  582. #>3 byte &0x10 \b, Home Source
  583. #>3 byte &0x08 \b, Copyrighted
  584. # Live MPEG-4 audio streams (instead of RTP FlexMux)
  585. 0 beshort&0xFFE0 0x56E0 MPEG-4 LOAS
  586. !:mime audio/x-mp4a-latm
  587. #>1 beshort&0x1FFF x \b, %u byte packet
  588. >3 byte&0xE0 0x40
  589. >>4 byte&0x3C 0x04 \b, single stream
  590. >>4 byte&0x3C 0x08 \b, 2 streams
  591. >>4 byte&0x3C 0x0C \b, 3 streams
  592. >>4 byte &0x08 \b, 4 or more streams
  593. >>4 byte &0x20 \b, 8 or more streams
  594. >3 byte&0xC0 0
  595. >>4 byte&0x78 0x08 \b, single stream
  596. >>4 byte&0x78 0x10 \b, 2 streams
  597. >>4 byte&0x78 0x18 \b, 3 streams
  598. >>4 byte &0x20 \b, 4 or more streams
  599. >>4 byte &0x40 \b, 8 or more streams
  600. # This magic isn't strong enough (matches plausible ISO-8859-1 text)
  601. #0 beshort 0x4DE1 MPEG-4 LO-EP audio stream
  602. #!:mime audio/x-mp4a-latm
  603. # FLI animation format
  604. 4 leshort 0xAF11 FLI file
  605. !:mime video/x-fli
  606. >6 leshort x - %d frames,
  607. >8 leshort x width=%d pixels,
  608. >10 leshort x height=%d pixels,
  609. >12 leshort x depth=%d,
  610. >16 leshort x ticks/frame=%d
  611. # FLC animation format
  612. 4 leshort 0xAF12 FLC file
  613. !:mime video/x-flc
  614. >6 leshort x - %d frames
  615. >8 leshort x width=%d pixels,
  616. >10 leshort x height=%d pixels,
  617. >12 leshort x depth=%d,
  618. >16 leshort x ticks/frame=%d
  619. # DL animation format
  620. # XXX - collision with most `mips' magic
  621. #
  622. # I couldn't find a real magic number for these, however, this
  623. # -appears- to work. Note that it might catch other files, too, so be
  624. # careful!
  625. #
  626. # Note that title and author appear in the two 20-byte chunks
  627. # at decimal offsets 2 and 22, respectively, but they are XOR'ed with
  628. # 255 (hex FF)! The DL format is really bad.
  629. #
  630. #0 byte 1 DL version 1, medium format (160x100, 4 images/screen)
  631. #!:mime video/x-unknown
  632. #>42 byte x - %d screens,
  633. #>43 byte x %d commands
  634. #0 byte 2 DL version 2
  635. #!:mime video/x-unknown
  636. #>1 byte 1 - large format (320x200,1 image/screen),
  637. #>1 byte 2 - medium format (160x100,4 images/screen),
  638. #>1 byte >2 - unknown format,
  639. #>42 byte x %d screens,
  640. #>43 byte x %d commands
  641. # Based on empirical evidence, DL version 3 have several nulls following the
  642. # \003. Most of them start with non-null values at hex offset 0x34 or so.
  643. #0 string \3\0\0\0\0\0\0\0\0\0\0\0 DL version 3
  644. # iso 13818 transport stream
  645. #
  646. # from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
  647. # (the following is a little bit restrictive and works fine for a stream
  648. # that starts with PAT properly. it won't work for stream data, that is
  649. # cut from an input device data right in the middle, but this shouldn't
  650. # disturb)
  651. # syncbyte 8 bit 0x47
  652. # error_ind 1 bit -
  653. # payload_start 1 bit 1
  654. # priority 1 bit -
  655. # PID 13 bit 0x0000
  656. # scrambling 2 bit -
  657. # adaptfld_ctrl 2 bit 1 or 3
  658. # conti_count 4 bit 0
  659. 0 belong&0xFF5FFF1F 0x47400010 MPEG transport stream data
  660. >188 byte !0x47 CORRUPTED
  661. # DIF digital video file format <mpruett@sgi.com>
  662. 0 belong&0xffffff00 0x1f070000 DIF
  663. >4 byte &0x01 (DVCPRO) movie file
  664. >4 byte ^0x01 (DV) movie file
  665. >3 byte &0x80 (PAL)
  666. >3 byte ^0x80 (NTSC)
  667. # Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
  668. 0 belong 0x3026b275 Microsoft ASF
  669. # MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
  670. 0 string \x8aMNG MNG video data,
  671. !:mime video/x-mng
  672. >4 belong !0x0d0a1a0a CORRUPTED,
  673. >4 belong 0x0d0a1a0a
  674. >>16 belong x %ld x
  675. >>20 belong x %ld
  676. # JNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
  677. 0 string \x8bJNG JNG video data,
  678. !:mime video/x-jng
  679. >4 belong !0x0d0a1a0a CORRUPTED,
  680. >4 belong 0x0d0a1a0a
  681. >>16 belong x %ld x
  682. >>20 belong x %ld
  683. # Vivo video (Wolfram Kleff)
  684. 3 string \x0D\x0AVersion:Vivo Vivo video data
  685. # VRML (Virtual Reality Modelling Language)
  686. 0 string/b #VRML\ V1.0\ ascii VRML 1 file
  687. !:mime model/vrml
  688. 0 string/b #VRML\ V2.0\ utf8 ISO/IEC 14772 VRML 97 file
  689. !:mime model/vrml
  690. #---------------------------------------------------------------------------
  691. # HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
  692. # From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
  693. #
  694. 0 string HVQM4 %s
  695. >6 string >\0 v%s
  696. >0 byte x GameCube movie,
  697. >0x34 ubeshort x %d x
  698. >0x36 ubeshort x %d,
  699. >0x26 ubeshort x %dµs,
  700. >0x42 ubeshort 0 no audio
  701. >0x42 ubeshort >0 %dHz audio
  702. # From: "Stefan A. Haubenthal" <polluks@web.de>
  703. 0 string DVDVIDEO-VTS Video title set,
  704. >0x21 byte x v%x
  705. 0 string DVDVIDEO-VMG Video manager,
  706. >0x21 byte x v%x
  707. # From: Behan Webster <behanw@websterwood.com>
  708. # NuppelVideo used by Mythtv (*.nuv)
  709. # Note: there are two identical stanzas here differing only in the
  710. # initial string matched. It used to be done with a regex, but we're
  711. # trying to get rid of those.
  712. 0 string NuppelVideo MythTV NuppelVideo
  713. >12 string x v%s
  714. >20 lelong x (%d
  715. >24 lelong x \bx%d),
  716. >36 string P \bprogressive,
  717. >36 string I \binterlaced,
  718. >40 ledouble x \baspect:%.2f,
  719. >48 ledouble x \bfps:%.2f
  720. 0 string MythTV MythTV NuppelVideo
  721. >12 string x v%s
  722. >20 lelong x (%d
  723. >24 lelong x \bx%d),
  724. >36 string P \bprogressive,
  725. >36 string I \binterlaced,
  726. >40 ledouble x \baspect:%.2f,
  727. >48 ledouble x \bfps:%.2f
  728. # MPEG file
  729. # MPEG sequences
  730. # FIXME: This section is from the old magic.mime file and needs integrating with the rest
  731. 0 belong 0x000001BA
  732. >4 byte &0x40
  733. !:mime video/mp2p
  734. >4 byte ^0x40
  735. !:mime video/mpeg
  736. 0 belong 0x000001BB
  737. !:mime video/mpeg
  738. 0 belong 0x000001B0
  739. !:mime video/mp4v-es
  740. 0 belong 0x000001B5
  741. !:mime video/mp4v-es
  742. 0 belong 0x000001B3
  743. !:mime video/mpv
  744. 0 belong&0xFF5FFF1F 0x47400010
  745. !:mime video/mp2t
  746. 0 belong 0x00000001
  747. >4 byte&0x1F 0x07
  748. !:mime video/h264