xref: /dragonfly/contrib/file/magic/Magdir/animation (revision 4a65f651)
1
2#------------------------------------------------------------------------------
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
9# SGI and Apple formats
100	string		MOVI		Silicon Graphics movie file
11!:mime	video/x-sgi-movie
124       string          moov            Apple QuickTime
13!:mime	video/quicktime
14>12     string          mvhd            \b movie (fast start)
15>12     string          mdra            \b URL
16>12     string          cmov            \b movie (fast start, compressed header)
17>12     string          rmra            \b multiple URLs
184       string          mdat            Apple QuickTime movie (unoptimized)
19!:mime	video/quicktime
20#4       string          wide            Apple QuickTime movie (unoptimized)
21#!:mime	video/quicktime
22#4       string          skip            Apple QuickTime movie (modified)
23#!:mime	video/quicktime
24#4       string          free            Apple QuickTime movie (modified)
25#!:mime	video/quicktime
264       string          idsc            Apple QuickTime image (fast start)
27!:mime	image/x-quicktime
28#4       string          idat            Apple QuickTime image (unoptimized)
29#!:mime	image/x-quicktime
304       string          pckg            Apple QuickTime compressed archive
31!:mime	application/x-quicktime-player
324	string/B	jP		JPEG 2000 image
33!:mime	image/jp2
344	string		ftyp		ISO Media
35>8	string		isom		\b, MPEG v4 system, version 1
36!:mime	video/mp4
37>8	string		iso2		\b, MPEG v4 system, part 12 revision
38>8	string		mp41		\b, MPEG v4 system, version 1
39!:mime	video/mp4
40>8	string		mp42		\b, MPEG v4 system, version 2
41!:mime	video/mp4
42>8	string		mp7t		\b, MPEG v4 system, MPEG v7 XML
43>8	string		mp7b		\b, MPEG v4 system, MPEG v7 binary XML
44>8	string/B	jp2		\b, JPEG 2000
45!:mime	image/jp2
46>8	string		3gp		\b, MPEG v4 system, 3GPP
47!:mime	video/3gpp
48>>11	byte		4		\b v4 (H.263/AMR GSM 6.10)
49>>11	byte		5		\b v5 (H.263/AMR GSM 6.10)
50>>11	byte		6		\b v6 (ITU H.264/AMR GSM 6.10)
51>8	string		mmp4		\b, MPEG v4 system, 3GPP Mobile
52!:mime	video/mp4
53>8	string		avc1		\b, MPEG v4 system, 3GPP JVT AVC
54!:mime	video/3gpp
55>8	string/B	M4A		\b, MPEG v4 system, iTunes AAC-LC
56!:mime	audio/mp4
57>8	string/B	M4V		\b, MPEG v4 system, iTunes AVC-LC
58!:mime	video/mp4
59>8	string/B	M4P		\b, MPEG v4 system, iTunes AES encrypted
60>8	string/B	M4B		\b, MPEG v4 system, iTunes bookmarked
61>8	string/B	qt		\b, Apple QuickTime movie
62!:mime	video/quicktime
63
64# MPEG sequences
65# Scans for all common MPEG header start codes
660	 belong		    0x00000001
67>4	 byte&0x1F	    0x07	   JVT NAL sequence, H.264 video
68>>5      byte               66             \b, baseline
69>>5      byte               77             \b, main
70>>5      byte               88             \b, extended
71>>7      byte               x              \b @ L %u
720        belong&0xFFFFFF00  0x00000100
73>3       byte               0xBA           MPEG sequence
74>>4      byte               &0x40          \b, v2, program multiplex
75>>4      byte               ^0x40          \b, v1, system multiplex
76>3       byte               0xBB           MPEG sequence, v1/2, multiplex (missing pack header)
77>3       byte&0x1F          0x07           MPEG sequence, H.264 video
78>>4      byte               66             \b, baseline
79>>4      byte               77             \b, main
80>>4      byte               88             \b, extended
81>>6      byte               x              \b @ L %u
82>3       byte               0xB0           MPEG sequence, v4
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
271# MPEG ADTS Audio (*.mpx/mxa/aac)
272# from dreesen@math.fu-berlin.de
273# modified to fully support MPEG ADTS
274
275# MP3, M1A
276# modified by Joerg Jenderek
277# GRR the original test are too common for many DOS files
278# so don't accept as MP3 until we've tested the rate
2790       beshort&0xFFFE  0xFFFA
280# rates
281>2      byte&0xF0       0x10           MPEG ADTS, layer III, v1,  32 kbps
282!:mime	audio/mpeg
283>2      byte&0xF0       0x20           MPEG ADTS, layer III, v1,  40 kbps
284!:mime	audio/mpeg
285>2      byte&0xF0       0x30           MPEG ADTS, layer III, v1,  48 kbps
286!:mime	audio/mpeg
287>2      byte&0xF0       0x40           MPEG ADTS, layer III, v1,  56 kbps
288!:mime	audio/mpeg
289>2      byte&0xF0       0x50           MPEG ADTS, layer III, v1,  64 kbps
290!:mime	audio/mpeg
291>2      byte&0xF0       0x60           MPEG ADTS, layer III, v1,  80 kbps
292!:mime	audio/mpeg
293>2      byte&0xF0       0x70           MPEG ADTS, layer III, v1,  96 kbps
294!:mime	audio/mpeg
295>2      byte&0xF0       0x80           MPEG ADTS, layer III, v1, 112 kbps
296!:mime	audio/mpeg
297>2      byte&0xF0       0x90           MPEG ADTS, layer III, v1, 128 kbps
298!:mime	audio/mpeg
299>2      byte&0xF0       0xA0           MPEG ADTS, layer III, v1, 160 kbps
300!:mime	audio/mpeg
301>2      byte&0xF0       0xB0           MPEG ADTS, layer III, v1, 192 kbps
302!:mime	audio/mpeg
303>2      byte&0xF0       0xC0           MPEG ADTS, layer III, v1, 224 kbps
304!:mime	audio/mpeg
305>2      byte&0xF0       0xD0           MPEG ADTS, layer III, v1, 256 kbps
306!:mime	audio/mpeg
307>2      byte&0xF0       0xE0           MPEG ADTS, layer III, v1, 320 kbps
308!:mime	audio/mpeg
309# timing
310>2      byte&0x0C       0x00           \b, 44.1 kHz
311>2      byte&0x0C       0x04           \b, 48 kHz
312>2      byte&0x0C       0x08           \b, 32 kHz
313# channels/options
314>3      byte&0xC0       0x00           \b, Stereo
315>3      byte&0xC0       0x40           \b, JntStereo
316>3      byte&0xC0       0x80           \b, 2x Monaural
317>3      byte&0xC0       0xC0           \b, Monaural
318#>1     byte            ^0x01          \b, Data Verify
319#>2     byte            &0x02          \b, Packet Pad
320#>2     byte            &0x01          \b, Custom Flag
321#>3     byte            &0x08          \b, Copyrighted
322#>3     byte            &0x04          \b, Original Source
323#>3     byte&0x03       1              \b, NR: 50/15 ms
324#>3     byte&0x03       3              \b, NR: CCIT J.17
325
326# MP2, M1A
3270       beshort&0xFFFE  0xFFFC         MPEG ADTS, layer II, v1
328!:mime	audio/mpeg
329# rates
330>2      byte&0xF0       0x10           \b,  32 kbps
331>2      byte&0xF0       0x20           \b,  48 kbps
332>2      byte&0xF0       0x30           \b,  56 kbps
333>2      byte&0xF0       0x40           \b,  64 kbps
334>2      byte&0xF0       0x50           \b,  80 kbps
335>2      byte&0xF0       0x60           \b,  96 kbps
336>2      byte&0xF0       0x70           \b, 112 kbps
337>2      byte&0xF0       0x80           \b, 128 kbps
338>2      byte&0xF0       0x90           \b, 160 kbps
339>2      byte&0xF0       0xA0           \b, 192 kbps
340>2      byte&0xF0       0xB0           \b, 224 kbps
341>2      byte&0xF0       0xC0           \b, 256 kbps
342>2      byte&0xF0       0xD0           \b, 320 kbps
343>2      byte&0xF0       0xE0           \b, 384 kbps
344# timing
345>2      byte&0x0C       0x00           \b, 44.1 kHz
346>2      byte&0x0C       0x04           \b, 48 kHz
347>2      byte&0x0C       0x08           \b, 32 kHz
348# channels/options
349>3      byte&0xC0       0x00           \b, Stereo
350>3      byte&0xC0       0x40           \b, JntStereo
351>3      byte&0xC0       0x80           \b, 2x Monaural
352>3      byte&0xC0       0xC0           \b, Monaural
353#>1     byte            ^0x01          \b, Data Verify
354#>2     byte            &0x02          \b, Packet Pad
355#>2     byte            &0x01          \b, Custom Flag
356#>3     byte            &0x08          \b, Copyrighted
357#>3     byte            &0x04          \b, Original Source
358#>3     byte&0x03       1              \b, NR: 50/15 ms
359#>3     byte&0x03       3              \b, NR: CCIT J.17
360
361# MPA, M1A
362# updated by Joerg Jenderek
363# GRR the original test are too common for many DOS files, so test 32 <= kbits <= 448
364# GRR this test is still too general as it catches a BOM of UTF-16 files (0xFFFE)
365# FIXME: Almost all little endian UTF-16 text with BOM are clobbered by these entries
366#0	beshort&0xFFFE		0xFFFE
367#>2	ubyte&0xF0	>0x0F
368#>>2	ubyte&0xF0	<0xE1		MPEG ADTS, layer I, v1
369## rate
370#>>>2      byte&0xF0       0x10           \b,  32 kbps
371#>>>2      byte&0xF0       0x20           \b,  64 kbps
372#>>>2      byte&0xF0       0x30           \b,  96 kbps
373#>>>2      byte&0xF0       0x40           \b, 128 kbps
374#>>>2      byte&0xF0       0x50           \b, 160 kbps
375#>>>2      byte&0xF0       0x60           \b, 192 kbps
376#>>>2      byte&0xF0       0x70           \b, 224 kbps
377#>>>2      byte&0xF0       0x80           \b, 256 kbps
378#>>>2      byte&0xF0       0x90           \b, 288 kbps
379#>>>2      byte&0xF0       0xA0           \b, 320 kbps
380#>>>2      byte&0xF0       0xB0           \b, 352 kbps
381#>>>2      byte&0xF0       0xC0           \b, 384 kbps
382#>>>2      byte&0xF0       0xD0           \b, 416 kbps
383#>>>2      byte&0xF0       0xE0           \b, 448 kbps
384## timing
385#>>>2      byte&0x0C       0x00           \b, 44.1 kHz
386#>>>2      byte&0x0C       0x04           \b, 48 kHz
387#>>>2      byte&0x0C       0x08           \b, 32 kHz
388## channels/options
389#>>>3      byte&0xC0       0x00           \b, Stereo
390#>>>3      byte&0xC0       0x40           \b, JntStereo
391#>>>3      byte&0xC0       0x80           \b, 2x Monaural
392#>>>3      byte&0xC0       0xC0           \b, Monaural
393##>1     byte            ^0x01          \b, Data Verify
394##>2     byte            &0x02          \b, Packet Pad
395##>2     byte            &0x01          \b, Custom Flag
396##>3     byte            &0x08          \b, Copyrighted
397##>3     byte            &0x04          \b, Original Source
398##>3     byte&0x03       1              \b, NR: 50/15 ms
399##>3     byte&0x03       3              \b, NR: CCIT J.17
400
401# MP3, M2A
4020       beshort&0xFFFE  0xFFF2         MPEG ADTS, layer III, v2
403!:mime	audio/mpeg
404# rate
405>2      byte&0xF0       0x10           \b,   8 kbps
406>2      byte&0xF0       0x20           \b,  16 kbps
407>2      byte&0xF0       0x30           \b,  24 kbps
408>2      byte&0xF0       0x40           \b,  32 kbps
409>2      byte&0xF0       0x50           \b,  40 kbps
410>2      byte&0xF0       0x60           \b,  48 kbps
411>2      byte&0xF0       0x70           \b,  56 kbps
412>2      byte&0xF0       0x80           \b,  64 kbps
413>2      byte&0xF0       0x90           \b,  80 kbps
414>2      byte&0xF0       0xA0           \b,  96 kbps
415>2      byte&0xF0       0xB0           \b, 112 kbps
416>2      byte&0xF0       0xC0           \b, 128 kbps
417>2      byte&0xF0       0xD0           \b, 144 kbps
418>2      byte&0xF0       0xE0           \b, 160 kbps
419# timing
420>2      byte&0x0C       0x00           \b, 22.05 kHz
421>2      byte&0x0C       0x04           \b, 24 kHz
422>2      byte&0x0C       0x08           \b, 16 kHz
423# channels/options
424>3      byte&0xC0       0x00           \b, Stereo
425>3      byte&0xC0       0x40           \b, JntStereo
426>3      byte&0xC0       0x80           \b, 2x Monaural
427>3      byte&0xC0       0xC0           \b, Monaural
428#>1     byte            ^0x01          \b, Data Verify
429#>2     byte            &0x02          \b, Packet Pad
430#>2     byte            &0x01          \b, Custom Flag
431#>3     byte            &0x08          \b, Copyrighted
432#>3     byte            &0x04          \b, Original Source
433#>3     byte&0x03       1              \b, NR: 50/15 ms
434#>3     byte&0x03       3              \b, NR: CCIT J.17
435
436# MP2, M2A
4370       beshort&0xFFFE  0xFFF4         MPEG ADTS, layer II, v2
438# rate
439>2      byte&0xF0       0x10           \b,   8 kbps
440>2      byte&0xF0       0x20           \b,  16 kbps
441>2      byte&0xF0       0x30           \b,  24 kbps
442>2      byte&0xF0       0x40           \b,  32 kbps
443>2      byte&0xF0       0x50           \b,  40 kbps
444>2      byte&0xF0       0x60           \b,  48 kbps
445>2      byte&0xF0       0x70           \b,  56 kbps
446>2      byte&0xF0       0x80           \b,  64 kbps
447>2      byte&0xF0       0x90           \b,  80 kbps
448>2      byte&0xF0       0xA0           \b,  96 kbps
449>2      byte&0xF0       0xB0           \b, 112 kbps
450>2      byte&0xF0       0xC0           \b, 128 kbps
451>2      byte&0xF0       0xD0           \b, 144 kbps
452>2      byte&0xF0       0xE0           \b, 160 kbps
453# timing
454>2      byte&0x0C       0x00           \b, 22.05 kHz
455>2      byte&0x0C       0x04           \b, 24 kHz
456>2      byte&0x0C       0x08           \b, 16 kHz
457# channels/options
458>3      byte&0xC0       0x00           \b, Stereo
459>3      byte&0xC0       0x40           \b, JntStereo
460>3      byte&0xC0       0x80           \b, 2x Monaural
461>3      byte&0xC0       0xC0           \b, Monaural
462#>1     byte            ^0x01          \b, Data Verify
463#>2     byte            &0x02          \b, Packet Pad
464#>2     byte            &0x01          \b, Custom Flag
465#>3     byte            &0x08          \b, Copyrighted
466#>3     byte            &0x04          \b, Original Source
467#>3     byte&0x03       1              \b, NR: 50/15 ms
468#>3     byte&0x03       3              \b, NR: CCIT J.17
469
470# MPA, M2A
4710       beshort&0xFFFE  0xFFF6         MPEG ADTS, layer I, v2
472# rate
473>2      byte&0xF0       0x10           \b,  32 kbps
474>2      byte&0xF0       0x20           \b,  48 kbps
475>2      byte&0xF0       0x30           \b,  56 kbps
476>2      byte&0xF0       0x40           \b,  64 kbps
477>2      byte&0xF0       0x50           \b,  80 kbps
478>2      byte&0xF0       0x60           \b,  96 kbps
479>2      byte&0xF0       0x70           \b, 112 kbps
480>2      byte&0xF0       0x80           \b, 128 kbps
481>2      byte&0xF0       0x90           \b, 144 kbps
482>2      byte&0xF0       0xA0           \b, 160 kbps
483>2      byte&0xF0       0xB0           \b, 176 kbps
484>2      byte&0xF0       0xC0           \b, 192 kbps
485>2      byte&0xF0       0xD0           \b, 224 kbps
486>2      byte&0xF0       0xE0           \b, 256 kbps
487# timing
488>2      byte&0x0C       0x00           \b, 22.05 kHz
489>2      byte&0x0C       0x04           \b, 24 kHz
490>2      byte&0x0C       0x08           \b, 16 kHz
491# channels/options
492>3      byte&0xC0       0x00           \b, Stereo
493>3      byte&0xC0       0x40           \b, JntStereo
494>3      byte&0xC0       0x80           \b, 2x Monaural
495>3      byte&0xC0       0xC0           \b, Monaural
496#>1     byte            ^0x01          \b, Data Verify
497#>2     byte            &0x02          \b, Packet Pad
498#>2     byte            &0x01          \b, Custom Flag
499#>3     byte            &0x08          \b, Copyrighted
500#>3     byte            &0x04          \b, Original Source
501#>3     byte&0x03       1              \b, NR: 50/15 ms
502#>3     byte&0x03       3              \b, NR: CCIT J.17
503
504# MP3, M25A
5050       beshort&0xFFFE  0xFFE2         MPEG ADTS, layer III,  v2.5
506# rate
507>2      byte&0xF0       0x10           \b,   8 kbps
508>2      byte&0xF0       0x20           \b,  16 kbps
509>2      byte&0xF0       0x30           \b,  24 kbps
510>2      byte&0xF0       0x40           \b,  32 kbps
511>2      byte&0xF0       0x50           \b,  40 kbps
512>2      byte&0xF0       0x60           \b,  48 kbps
513>2      byte&0xF0       0x70           \b,  56 kbps
514>2      byte&0xF0       0x80           \b,  64 kbps
515>2      byte&0xF0       0x90           \b,  80 kbps
516>2      byte&0xF0       0xA0           \b,  96 kbps
517>2      byte&0xF0       0xB0           \b, 112 kbps
518>2      byte&0xF0       0xC0           \b, 128 kbps
519>2      byte&0xF0       0xD0           \b, 144 kbps
520>2      byte&0xF0       0xE0           \b, 160 kbps
521# timing
522>2      byte&0x0C       0x00           \b, 11.025 kHz
523>2      byte&0x0C       0x04           \b, 12 kHz
524>2      byte&0x0C       0x08           \b, 8 kHz
525# channels/options
526>3      byte&0xC0       0x00           \b, Stereo
527>3      byte&0xC0       0x40           \b, JntStereo
528>3      byte&0xC0       0x80           \b, 2x Monaural
529>3      byte&0xC0       0xC0           \b, Monaural
530#>1     byte            ^0x01          \b, Data Verify
531#>2     byte            &0x02          \b, Packet Pad
532#>2     byte            &0x01          \b, Custom Flag
533#>3     byte            &0x08          \b, Copyrighted
534#>3     byte            &0x04          \b, Original Source
535#>3     byte&0x03       1              \b, NR: 50/15 ms
536#>3     byte&0x03       3              \b, NR: CCIT J.17
537
538# AAC (aka MPEG-2 NBC audio) and MPEG-4 audio
539
540# Stored AAC streams (instead of the MP4 format)
5410       string          ADIF           MPEG ADIF, AAC
542!:mime	audio/x-hx-aac-adif
543>4      byte            &0x80
544>>13    byte            &0x10          \b, VBR
545>>13    byte            ^0x10          \b, CBR
546>>16    byte&0x1E       0x02           \b, single stream
547>>16    byte&0x1E       0x04           \b, 2 streams
548>>16    byte&0x1E       0x06           \b, 3 streams
549>>16    byte            &0x08          \b, 4 or more streams
550>>16    byte            &0x10          \b, 8 or more streams
551>>4    byte            &0x80          \b, Copyrighted
552>>13   byte            &0x40          \b, Original Source
553>>13   byte            &0x20          \b, Home Flag
554>4      byte            ^0x80
555>>4     byte            &0x10          \b, VBR
556>>4     byte            ^0x10          \b, CBR
557>>7     byte&0x1E       0x02           \b, single stream
558>>7     byte&0x1E       0x04           \b, 2 streams
559>>7     byte&0x1E       0x06           \b, 3 streams
560>>7     byte            &0x08          \b, 4 or more streams
561>>7     byte            &0x10          \b, 8 or more streams
562>>4    byte            &0x40          \b, Original Stream(s)
563>>4    byte            &0x20          \b, Home Source
564
565# Live or stored single AAC stream (used with MPEG-2 systems)
5660       beshort&0xFFF6  0xFFF0         MPEG ADTS, AAC
567!:mime	audio/x-hx-aac-adts
568>1      byte            &0x08          \b, v2
569>1      byte            ^0x08          \b, v4
570# profile
571>>2     byte            &0xC0          \b LTP
572>2      byte&0xc0       0x00           \b Main
573>2      byte&0xc0       0x40           \b LC
574>2      byte&0xc0       0x80           \b SSR
575# timing
576>2      byte&0x3c       0x00           \b, 96 kHz
577>2      byte&0x3c       0x04           \b, 88.2 kHz
578>2      byte&0x3c       0x08           \b, 64 kHz
579>2      byte&0x3c       0x0c           \b, 48 kHz
580>2      byte&0x3c       0x10           \b, 44.1 kHz
581>2      byte&0x3c       0x14           \b, 32 kHz
582>2      byte&0x3c       0x18           \b, 24 kHz
583>2      byte&0x3c       0x1c           \b, 22.05 kHz
584>2      byte&0x3c       0x20           \b, 16 kHz
585>2      byte&0x3c       0x24           \b, 12 kHz
586>2      byte&0x3c       0x28           \b, 11.025 kHz
587>2      byte&0x3c       0x2c           \b, 8 kHz
588# channels
589>2      beshort&0x01c0  0x0040         \b, monaural
590>2      beshort&0x01c0  0x0080         \b, stereo
591>2      beshort&0x01c0  0x00c0         \b, stereo + center
592>2      beshort&0x01c0  0x0100         \b, stereo+center+LFE
593>2      beshort&0x01c0  0x0140         \b, surround
594>2      beshort&0x01c0  0x0180         \b, surround + LFE
595>2      beshort         &0x01C0        \b, surround + side
596#>1     byte            ^0x01           \b, Data Verify
597#>2     byte            &0x02           \b, Custom Flag
598#>3     byte            &0x20           \b, Original Stream
599#>3     byte            &0x10           \b, Home Source
600#>3     byte            &0x08           \b, Copyrighted
601
602# Live MPEG-4 audio streams (instead of RTP FlexMux)
6030       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
622# Summary: FLI animation format
623# Created by: Daniel Quinlan <quinlan@yggdrasil.com>
624# Modified by (1): Abel Cheung <abelcheung@gmail.com> (avoid over-generic detection)
6254	leshort		0xAF11
626# standard FLI always has 320x200 resolution and 8 bit color
627>8	leshort		320
628>>10	leshort		200
629>>>12	leshort		8			FLI animation, 320x200x8
630!:mime	video/x-fli
631>>>>6	leshort		x			\b, %d frames
632# frame speed is multiple of 1/70s
633>>>>16	leshort		x			\b, %d/70s per frame
634
635# Summary: FLC animation format
636# Created by: Daniel Quinlan <quinlan@yggdrasil.com>
637# Modified by (1): Abel Cheung <abelcheung@gmail.com> (avoid over-generic detection)
6384	leshort		0xAF12
639# standard FLC always use 8 bit color
640>12	leshort		8			FLC animation
641!:mime	video/x-flc
642>>8	leshort		x			\b, %d
643>>10	leshort		x			\bx%dx8
644>>6	uleshort	x			\b, %d frames
645>>16	uleshort	x			\b, %dms per frame
646
647# DL animation format
648# XXX - collision with most `mips' magic
649#
650# I couldn't find a real magic number for these, however, this
651# -appears- to work.  Note that it might catch other files, too, so be
652# careful!
653#
654# Note that title and author appear in the two 20-byte chunks
655# at decimal offsets 2 and 22, respectively, but they are XOR'ed with
656# 255 (hex FF)!  The DL format is really bad.
657#
658#0	byte	1	DL version 1, medium format (160x100, 4 images/screen)
659#!:mime	video/x-unknown
660#>42	byte	x	- %d screens,
661#>43	byte	x	%d commands
662#0	byte	2	DL version 2
663#!:mime	video/x-unknown
664#>1	byte	1	- large format (320x200,1 image/screen),
665#>1	byte	2	- medium format (160x100,4 images/screen),
666#>1	byte	>2	- unknown format,
667#>42	byte	x	%d screens,
668#>43	byte	x	%d commands
669# Based on empirical evidence, DL version 3 have several nulls following the
670# \003.  Most of them start with non-null values at hex offset 0x34 or so.
671#0	string	\3\0\0\0\0\0\0\0\0\0\0\0	DL version 3
672
673# iso 13818 transport stream
674#
675# from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
676# (the following is a little bit restrictive and works fine for a stream
677#  that starts with PAT properly. it won't work for stream data, that is
678#  cut from an input device data right in the middle, but this shouldn't
679#  disturb)
680# syncbyte      8 bit	0x47
681# error_ind     1 bit	-
682# payload_start 1 bit	1
683# priority      1 bit	-
684# PID          13 bit	0x0000
685# scrambling    2 bit	-
686# adaptfld_ctrl 2 bit	1 or 3
687# conti_count   4 bit	0
6880	belong&0xFF5FFF1F	0x47400010	MPEG transport stream data
689>188	byte			!0x47		CORRUPTED
690
691# DIF digital video file format <mpruett@sgi.com>
6920	belong&0xffffff00	0x1f070000      DIF
693>4	byte			&0x01		(DVCPRO) movie file
694>4	byte			^0x01		(DV) movie file
695>3	byte			&0x80		(PAL)
696>3	byte			^0x80		(NTSC)
697
698# Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
6990	belong			0x3026b275	Microsoft ASF
700
701# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
7020	string			\x8aMNG		MNG video data,
703!:mime	video/x-mng
704>4	belong			!0x0d0a1a0a	CORRUPTED,
705>4	belong			0x0d0a1a0a
706>>16    belong	x				%ld x
707>>20    belong	x				%ld
708
709# JNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
7100	string			\x8bJNG		JNG video data,
711!:mime	video/x-jng
712>4	belong			!0x0d0a1a0a	CORRUPTED,
713>4	belong			0x0d0a1a0a
714>>16    belong	x				%ld x
715>>20    belong	x				%ld
716
717# Vivo video (Wolfram Kleff)
7183	string		\x0D\x0AVersion:Vivo	Vivo video data
719
720# VRML (Virtual Reality Modelling Language)
7210       string/b        #VRML\ V1.0\ ascii	VRML 1 file
722!:mime	model/vrml
7230	string/b	#VRML\ V2.0\ utf8	ISO/IEC 14772 VRML 97 file
724!:mime	model/vrml
725
726# X3D (Extensible 3D) [http://www.web3d.org/specifications/x3d-3.0.dtd]
727# From Michel Briand <michelbriand@free.fr>
7280	string		\<?xml\ version="
729!:strength +1
730>20	search/1000/cb  \<!DOCTYPE\ X3D		X3D (Extensible 3D) model xml text
731!:mime model/x3d
732
733#---------------------------------------------------------------------------
734# HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
735# From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
736#
7370	string		HVQM4		%s
738>6	string		>\0		v%s
739>0	byte		x		GameCube movie,
740>0x34	ubeshort	x		%d x
741>0x36	ubeshort	x		%d,
742>0x26	ubeshort	x		%dµs,
743>0x42	ubeshort	0		no audio
744>0x42	ubeshort	>0		%dHz audio
745
746# From: "Stefan A. Haubenthal" <polluks@web.de>
7470	string		DVDVIDEO-VTS	Video title set,
748>0x21	byte		x		v%x
7490	string		DVDVIDEO-VMG	Video manager,
750>0x21	byte		x		v%x
751
752# From: Behan Webster <behanw@websterwood.com>
753# NuppelVideo used by Mythtv (*.nuv)
754# Note: there are two identical stanzas here differing only in the
755# initial string matched. It used to be done with a regex, but we're
756# trying to get rid of those.
7570	string		NuppelVideo	MythTV NuppelVideo
758>12	string		x		v%s
759>20	lelong		x		(%d
760>24	lelong		x		\bx%d),
761>36	string		P		\bprogressive,
762>36	string		I		\binterlaced,
763>40	ledouble	x		\baspect:%.2f,
764>48	ledouble	x		\bfps:%.2f
7650	string		MythTV		MythTV NuppelVideo
766>12	string		x		v%s
767>20	lelong		x		(%d
768>24	lelong		x		\bx%d),
769>36	string		P		\bprogressive,
770>36	string		I		\binterlaced,
771>40	ledouble	x		\baspect:%.2f,
772>48	ledouble	x		\bfps:%.2f
773
774#						MPEG file
775# MPEG sequences
776# FIXME: This section is from the old magic.mime file and needs integrating with the rest
7770       belong             0x000001BA
778>4      byte               &0x40
779!:mime	video/mp2p
780>4      byte               ^0x40
781!:mime	video/mpeg
7820       belong             0x000001BB
783!:mime	video/mpeg
7840       belong             0x000001B0
785!:mime	video/mp4v-es
7860       belong             0x000001B5
787!:mime	video/mp4v-es
7880       belong             0x000001B3
789!:mime	video/mpv
7900       belong&0xFF5FFF1F  0x47400010
791!:mime	video/mp2t
7920       belong             0x00000001
793>4      byte&0x1F	   0x07
794!:mime	video/h264
795
796# Type: Bink Video
797# URL:  http://wiki.multimedia.cx/index.php?title=3DBink_Container
798# From: <hoehle@users.sourceforge.net>  2008-07-18
7990	string		BIK	Bink Video
800>3	regex		=[a-z]	rev.%s
801#>4	ulelong		x	size %d
802>20	ulelong		x	\b, %d
803>24	ulelong		x	\bx%d
804>8	ulelong		x	\b, %d frames
805>32	ulelong		x	at rate %d/
806>28	ulelong		>1	\b%d
807>40	ulelong		=0	\b, no audio
808>40	ulelong		!0	\b, %d audio track
809>>40	ulelong		!1	\bs
810# follow properties of the first audio track only
811>>48	uleshort	x	%dHz
812>>51	byte&0x20	0	mono
813>>51	byte&0x20	!0	stereo
814#>>51	byte&0x10	0	FFT
815#>>51	byte&0x10	!0	DCT
816