animation 37 KB

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