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