1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
# $OpenBSD: animation,v 1.3 2004/06/03 03:14:19 tedu Exp $
#------------------------------------------------------------------------------
# animation: file(1) magic for animation/movie formats
#
# animation formats
# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
# MPEG animation format
0 belong 0x000001b3 MPEG video stream data
#>4 beshort&0xfff0 x (%d x
#>5 beshort&0x0fff x %d)
0 belong 0x000001ba MPEG system stream data
# MPEG Audio (*.mpx)
# from dreesen@math.fu-berlin.de
# MPEG 1.0 Layer 3
0 beshort&0xfffe =0xfffa \bMP3
>2 byte&0xf0 =0x10 \b, 32 kBits
>2 byte&0xf0 =0x20 \b, 40 kBits
>2 byte&0xf0 =0x30 \b, 48 kBits
>2 byte&0xf0 =0x40 \b, 56 kBits
>2 byte&0xf0 =0x50 \b, 64 kBits
>2 byte&0xf0 =0x60 \b, 80 kBits
>2 byte&0xf0 =0x70 \b, 96 kBits
>2 byte&0xf0 =0x80 \b, 112 kBits
>2 byte&0xf0 =0x90 \b, 128 kBits
>2 byte&0xf0 =0xA0 \b, 160 kBits
>2 byte&0xf0 =0xB0 \b, 192 kBits
>2 byte&0xf0 =0xC0 \b, 224 kBits
>2 byte&0xf0 =0xD0 \b, 256 kBits
>2 byte&0xf0 =0xE0 \b, 320 kBits
# freq
>2 byte&0x0C =0x00 \b, 44.1 kHz
>2 byte&0x0C =0x04 \b, 48 kHz
>2 byte&0x0C =0x08 \b, 32 kHz
# misc
>3 byte&0xC0 =0x00 \b, Stereo
>3 byte&0xC0 =0x40 \b, JStereo
>3 byte&0xC0 =0x80 \b, Dual-Ch
>3 byte&0xC0 =0xC0 \b, Mono
#>1 byte&0x01 =0x00 \b, Error Protection
#>2 byte&0x02 =0x02 \b, Padding
#>2 byte&0x01 =0x01 \b, Private
#>3 byte&0x08 =0x08 \b, Copyright
#>3 byte&0x04 =0x04 \b, Original
#>3 byte&0x03 1 \b, Emphasis 5
#>3 byte&0x03 3 \b, Emphasis c
# MPEG 1.0 Layer 2
0 beshort&0xfffe =0xfffc \bMP2
>2 byte&0xf0 =0x10 \b, 32 kBits
>2 byte&0xf0 =0x20 \b, 48 kBits
>2 byte&0xf0 =0x30 \b, 56 kBits
>2 byte&0xf0 =0x40 \b, 64 kBits
>2 byte&0xf0 =0x50 \b, 80 kBits
>2 byte&0xf0 =0x60 \b, 96 kBits
>2 byte&0xf0 =0x70 \b, 112 kBits
>2 byte&0xf0 =0x80 \b, 128 kBits
>2 byte&0xf0 =0x90 \b, 160 kBits
>2 byte&0xf0 =0xA0 \b, 192 kBits
>2 byte&0xf0 =0xB0 \b, 224 kBits
>2 byte&0xf0 =0xC0 \b, 256 kBits
>2 byte&0xf0 =0xD0 \b, 320 kBits
>2 byte&0xf0 =0xE0 \b, 384 kBits
# freq
>2 byte&0x0C =0x00 \b, 44.1 kHz
>2 byte&0x0C =0x04 \b, 48 kHz
>2 byte&0x0C =0x08 \b, 32 kHz
# misc
>3 byte&0xC0 =0x00 \b, Stereo
>3 byte&0xC0 =0x40 \b, JStereo
>3 byte&0xC0 =0x80 \b, Dual-Ch
>3 byte&0xC0 =0xC0 \b, Mono
#>1 byte&0x01 =0x00 \b, Error Protection
#>2 byte&0x02 =0x02 \b, Padding
#>2 byte&0x01 =0x01 \b, Private
#>3 byte&0x08 =0x08 \b, Copyright
#>3 byte&0x04 =0x04 \b, Original
#>3 byte&0x03 1 \b, Emphasis 5
#>3 byte&0x03 3 \b, Emphasis c
# MPEG 2.0
0 beshort&0xfff8 =0xfff0 MP
# Layer 3
>1 byte &0x02 \b3
# Layer 2
>1 byte &0x04 \b2
>2 byte&0xf0 =0x10 \b, 8 kBits
>2 byte&0xf0 =0x20 \b, 16 kBits
>2 byte&0xf0 =0x30 \b, 24 kBits
>2 byte&0xf0 =0x40 \b, 32 kBits
>2 byte&0xf0 =0x50 \b, 40 kBits
>2 byte&0xf0 =0x60 \b, 48 kBits
>2 byte&0xf0 =0x70 \b, 56 kBits
>2 byte&0xf0 =0x80 \b, 64 kBits
>2 byte&0xf0 =0x90 \b, 80 kBits
>2 byte&0xf0 =0xA0 \b, 96 kBits
>2 byte&0xf0 =0xB0 \b, 112 kBits
>2 byte&0xf0 =0xC0 \b, 128 kBits
>2 byte&0xf0 =0xD0 \b, 144 kBits
>2 byte&0xf0 =0xE0 \b, 160 kBits
# freq
>2 byte&0x0C =0x00 \b, 22.05 kHz
>2 byte&0x0C =0x04 \b, 24 kHz
>2 byte&0x0C =0x08 \b, 16 kHz
# misc
>3 byte&0xC0 =0x00 \b, Stereo
>3 byte&0xC0 =0x40 \b, JStereo
>3 byte&0xC0 =0x80 \b, Dual-Ch
>3 byte&0xC0 =0xC0 \b, Mono
#>1 byte&0x01 =0x00 \b, Error Protection
#>2 byte&0x02 =0x02 \b, Padding
#>2 byte&0x01 =0x01 \b, Private
#>3 byte&0x08 =0x08 \b, Copyright
#>3 byte&0x04 =0x04 \b, Original
#>3 byte&0x03 1 \b, Emphasis 5
#>3 byte&0x03 3 \b, Emphasis c
#From: Johan Gade <jgade@diku.dk>
# MPEG-4 Advanced Audio Coding (AAC) file (perhaps also MPEG-2 ACC?)
16 string M4A MPEG-4 Advanced Audio Coding file (AAC)
# FLI animation format
4 leshort 0xAF11 FLI file
>6 leshort x - %d frames,
>8 leshort x width=%d pixels,
>10 leshort x height=%d pixels,
>12 leshort x depth=%d,
>16 leshort x ticks/frame=%d
# FLC animation format
4 leshort 0xAF12 FLC file
>6 leshort x - %d frames
>8 leshort x width=%d pixels,
>10 leshort x height=%d pixels,
>12 leshort x depth=%d,
>16 leshort x ticks/frame=%d
# DL animation format
# XXX - collision with most `mips' magic
#
# I couldn't find a real magic number for these, however, this
# -appears- to work. Note that it might catch other files, too, so be
# careful!
#
# Note that title and author appear in the two 20-byte chunks
# at decimal offsets 2 and 22, respectively, but they are XOR'ed with
# 255 (hex FF)! The DL format is really bad.
#
#0 byte 1 DL version 1, medium format (160x100, 4 images/screen)
#>42 byte x - %d screens,
#>43 byte x %d commands
#0 byte 2 DL version 2
#>1 byte 1 - large format (320x200,1 image/screen),
#>1 byte 2 - medium format (160x100,4 images/screen),
#>1 byte >2 - unknown format,
#>42 byte x %d screens,
#>43 byte x %d commands
# Based on empirical evidence, DL version 3 have several nulls following the
# \003. Most of them start with non-null values at hex offset 0x34 or so.
#0 string \3\0\0\0\0\0\0\0\0\0\0\0 DL version 3
# SGI formats
0 string MOVI Silicon Graphics movie file
# Apple Quicktime: Scan for all known top-level QT atom markers
4 string moov Apple QuickTime movie file (moov)
4 string mdat Apple QuickTime movie file (mdat)
4 string ftyp Apple QuickTime movie file (ftyp)
4 string free Apple QuickTime movie file (free)
4 string junk Apple QuickTime movie file (junk)
4 string pnot Apple QuickTime movie file (pnot)
4 string skip Apple QuickTime movie file (skip)
4 string wide Apple QuickTime movie file (wide)
4 string pict Apple QuickTime movie file (pict)
# iso 13818 transport stream
#
# from Oskar Schirmer <schirmer@scara.com> Feb 3, 2001 (ISO 13818.1)
# (the following is a little bit restrictive and works fine for a stream
# that starts with PAT properly. it won't work for stream data, that is
# cut from an input device data right in the middle, but this shouldn't
# disturb)
# syncbyte 8 bit 0x47
# error_ind 1 bit -
# payload_start 1 bit 1
# priority 1 bit -
# PID 13 bit 0x0000
# scrambling 2 bit -
# adaptfld_ctrl 2 bit 1 or 3
# conti_count 4 bit 0
0 belong&0xFF5FFF1F 0x47400010 MPEG transport stream data
>188 byte !0x47 CORRUPTED
# DIF digital video file format <mpruett@sgi.com>
0 belong&0xffffff00 0x1f070000 DIF
>4 byte &0x01 (DVCPRO) movie file
>4 byte ^0x01 (DV) movie file
>3 byte &0x80 (PAL)
>3 byte ^0x80 (NTSC)
# Microsoft Advanced Streaming Format (ASF) <mpruett@sgi.com>
0 belong 0x3026b275 Microsoft ASF
# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
0 string \x8aMNG MNG video data,
>4 belong !0x0d0a1a0a CORRUPTED,
>4 belong 0x0d0a1a0a
>>16 belong x %ld x
>>20 belong x %ld
# JNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
0 string \x8bJNG JNG video data,
>4 belong !0x0d0a1a0a CORRUPTED,
>4 belong 0x0d0a1a0a
>>16 belong x %ld x
>>20 belong x %ld
# Vivo video (Wolfram Kleff)
3 string \x0D\x0AVersion:Vivo Vivo video data
# VRML (Virtual Reality Modelling Language)
0 string/b #VRML\ V1.0\ ascii VRML 1 file
0 string/b #VRML\ V2.0\ utf8 ISO/IEC 14772 VRML 97 file
#---------------------------------------------------------------------------
# HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
# From Mark Sheppard <msheppard@climax.co.uk>, 2002-10-03
#
0 string HVQM4 %s
>6 string >\0 v%s
>0 byte x GameCube movie,
>0x34 ubeshort x %d x
>0x36 ubeshort x %d,
>0x26 ubeshort x %dµs,
>0x42 ubeshort 0 no audio
>0x42 ubeshort >0 %dHz audio
|