animation 36 KB

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