xref: /netbsd-src/external/bsd/file/dist/magic/magdir/riff (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
1
2#------------------------------------------------------------------------------
3# $File: riff,v 1.24 2013/11/19 23:58:17 christos Exp $
4# riff:  file(1) magic for RIFF format
5# See
6#
7#	http://www.seanet.com/users/matts/riffmci/riffmci.htm
8#
9# AVI section extended by Patrik Radman <patrik+file-magic@iki.fi>
10#
110	string		RIFF		RIFF (little-endian) data
12# RIFF Palette format
13>8	string		PAL		\b, palette
14>>16	leshort		x		\b, version %d
15>>18	leshort		x		\b, %d entries
16# RIFF Device Independent Bitmap format
17>8	string		RDIB		\b, device-independent bitmap
18>>16	string		BM
19>>>30	leshort		12		\b, OS/2 1.x format
20>>>>34	leshort		x		\b, %d x
21>>>>36	leshort		x		%d
22>>>30	leshort		64		\b, OS/2 2.x format
23>>>>34	leshort		x		\b, %d x
24>>>>36	leshort		x		%d
25>>>30	leshort		40		\b, Windows 3.x format
26>>>>34	lelong		x		\b, %d x
27>>>>38	lelong		x		%d x
28>>>>44	leshort		x		%d
29# RIFF MIDI format
30>8	string		RMID		\b, MIDI
31# RIFF Multimedia Movie File format
32>8	string		RMMP		\b, multimedia movie
33# RIFF wrapper for MP3
34>8	string		RMP3		\b, MPEG Layer 3 audio
35# Microsoft WAVE format (*.wav)
36>8	string		WAVE		\b, WAVE audio
37!:mime	audio/x-wav
38>>20	leshort		1		\b, Microsoft PCM
39>>>34	leshort		>0		\b, %d bit
40>>20	leshort		2		\b, Microsoft ADPCM
41>>20	leshort		6		\b, ITU G.711 A-law
42>>20	leshort		7		\b, ITU G.711 mu-law
43>>20	leshort		8		\b, Microsoft DTS
44>>20	leshort		17		\b, IMA ADPCM
45>>20	leshort		20		\b, ITU G.723 ADPCM (Yamaha)
46>>20	leshort		49		\b, GSM 6.10
47>>20	leshort		64		\b, ITU G.721 ADPCM
48>>20	leshort		80		\b, MPEG
49>>20	leshort		85		\b, MPEG Layer 3
50>>20	leshort		0x2001		\b, DTS
51>>22	leshort		=1		\b, mono
52>>22	leshort		=2		\b, stereo
53>>22	leshort		>2		\b, %d channels
54>>24	lelong		>0		%d Hz
55# Corel Draw Picture
56>8	string		CDRA		\b, Corel Draw Picture
57!:mime	image/x-coreldraw
58>8	string		CDR6		\b, Corel Draw Picture, version 6
59!:mime	image/x-coreldraw
60# AVI == Audio Video Interleave
61>8	string		AVI\040		\b, AVI
62!:mime	video/x-msvideo
63>>12    string          LIST
64>>>20   string          hdrlavih
65>>>>&36 lelong          x               \b, %lu x
66>>>>&40 lelong          x               %lu,
67>>>>&4  lelong          >1000000        <1 fps,
68>>>>&4  lelong          1000000         1.00 fps,
69>>>>&4  lelong          500000          2.00 fps,
70>>>>&4  lelong          333333          3.00 fps,
71>>>>&4  lelong          250000          4.00 fps,
72>>>>&4  lelong          200000          5.00 fps,
73>>>>&4  lelong          166667          6.00 fps,
74>>>>&4  lelong          142857          7.00 fps,
75>>>>&4  lelong          125000          8.00 fps,
76>>>>&4  lelong          111111          9.00 fps,
77>>>>&4  lelong          100000          10.00 fps,
78# ]9.9,10.1[
79>>>>&4  lelong          <101010
80>>>>>&-4        lelong  >99010
81>>>>>>&-4       lelong  !100000         ~10 fps,
82>>>>&4  lelong          83333           12.00 fps,
83# ]11.9,12.1[
84>>>>&4  lelong          <84034
85>>>>>&-4        lelong  >82645
86>>>>>>&-4       lelong  !83333          ~12 fps,
87>>>>&4  lelong          66667           15.00 fps,
88# ]14.9,15.1[
89>>>>&4  lelong          <67114
90>>>>>&-4        lelong  >66225
91>>>>>>&-4       lelong  !66667          ~15 fps,
92>>>>&4  lelong          50000           20.00 fps,
93>>>>&4  lelong          41708           23.98 fps,
94>>>>&4  lelong          41667           24.00 fps,
95# ]23.9,24.1[
96>>>>&4  lelong          <41841
97>>>>>&-4        lelong  >41494
98>>>>>>&-4       lelong  !41708
99>>>>>>>&-4      lelong  !41667          ~24 fps,
100>>>>&4  lelong          40000           25.00 fps,
101# ]24.9,25.1[
102>>>>&4  lelong          <40161
103>>>>>&-4        lelong  >39841
104>>>>>>&-4       lelong  !40000          ~25 fps,
105>>>>&4  lelong          33367           29.97 fps,
106>>>>&4  lelong          33333           30.00 fps,
107# ]29.9,30.1[
108>>>>&4  lelong          <33445
109>>>>>&-4        lelong  >33223
110>>>>>>&-4       lelong  !33367
111>>>>>>>&-4      lelong  !33333          ~30 fps,
112>>>>&4  lelong          <32224          >30 fps,
113##>>>>&4  lelong          x               (%lu)
114##>>>>&20 lelong          x               %lu frames,
115# Note: The tests below assume that the AVI has 1 or 2 streams,
116#       "vids" optionally followed by "auds".
117#       (Should cover 99.9% of all AVIs.)
118# assuming avih length = 56
119>>>88   string  LIST
120>>>>96  string  strlstrh
121>>>>>108        string  vids    video:
122>>>>>>&0        lelong  0               uncompressed
123# skip past vids strh
124>>>>>>(104.l+108)       string  strf
125>>>>>>>(104.l+132)      lelong          1       RLE 8bpp
126>>>>>>>(104.l+132)      string/c        cvid    Cinepak
127>>>>>>>(104.l+132)      string/c        i263    Intel I.263
128>>>>>>>(104.l+132)      string/c        iv32    Indeo 3.2
129>>>>>>>(104.l+132)      string/c        iv41    Indeo 4.1
130>>>>>>>(104.l+132)      string/c        iv50    Indeo 5.0
131>>>>>>>(104.l+132)      string/c        mp42    Microsoft MPEG-4 v2
132>>>>>>>(104.l+132)      string/c        mp43    Microsoft MPEG-4 v3
133>>>>>>>(104.l+132)      string/c        fmp4    FFMpeg MPEG-4
134>>>>>>>(104.l+132)      string/c        mjpg    Motion JPEG
135>>>>>>>(104.l+132)      string/c        div3    DivX 3
136>>>>>>>>112             string/c        div3    Low-Motion
137>>>>>>>>112             string/c        div4    Fast-Motion
138>>>>>>>(104.l+132)      string/c        divx    DivX 4
139>>>>>>>(104.l+132)      string/c        dx50    DivX 5
140>>>>>>>(104.l+132)      string/c        xvid    XviD
141>>>>>>>(104.l+132)	string/c	h264	H.264
142>>>>>>>(104.l+132)      string/c        wmv3    Windows Media Video 9
143>>>>>>>(104.l+132)      string/c        h264    X.264 or H.264
144>>>>>>>(104.l+132)      lelong  0
145##>>>>>>>(104.l+132)      string  x       (%.4s)
146# skip past first (video) LIST
147>>>>(92.l+96)   string  LIST
148>>>>>(92.l+104) string  strlstrh
149>>>>>>(92.l+116)        string          auds    \b, audio:
150# auds strh length = 56:
151>>>>>>>(92.l+172)       string          strf
152>>>>>>>>(92.l+180)      leshort 0x0001  uncompressed PCM
153>>>>>>>>(92.l+180)      leshort 0x0002  ADPCM
154>>>>>>>>(92.l+180)      leshort 0x0006  aLaw
155>>>>>>>>(92.l+180)      leshort 0x0007  uLaw
156>>>>>>>>(92.l+180)      leshort 0x0050  MPEG-1 Layer 1 or 2
157>>>>>>>>(92.l+180)      leshort 0x0055  MPEG-1 Layer 3
158>>>>>>>>(92.l+180)      leshort 0x2000  Dolby AC3
159>>>>>>>>(92.l+180)      leshort 0x0161  DivX
160##>>>>>>>>(92.l+180)      leshort x       (0x%.4x)
161>>>>>>>>(92.l+182)      leshort 1       (mono,
162>>>>>>>>(92.l+182)      leshort 2       (stereo,
163>>>>>>>>(92.l+182)      leshort >2      (%d channels,
164>>>>>>>>(92.l+184)      lelong  x       %d Hz)
165# auds strh length = 64:
166>>>>>>>(92.l+180)       string          strf
167>>>>>>>>(92.l+188)      leshort 0x0001  uncompressed PCM
168>>>>>>>>(92.l+188)      leshort 0x0002  ADPCM
169>>>>>>>>(92.l+188)      leshort 0x0055  MPEG-1 Layer 3
170>>>>>>>>(92.l+188)      leshort 0x2000  Dolby AC3
171>>>>>>>>(92.l+188)      leshort 0x0161  DivX
172##>>>>>>>>(92.l+188)      leshort x       (0x%.4x)
173>>>>>>>>(92.l+190)      leshort 1       (mono,
174>>>>>>>>(92.l+190)      leshort 2       (stereo,
175>>>>>>>>(92.l+190)      leshort >2      (%d channels,
176>>>>>>>>(92.l+192)      lelong  x       %d Hz)
177# Animated Cursor format
178>8	string		ACON		\b, animated cursor
179# SoundFont 2 <mpruett@sgi.com>
180>8	string		sfbk		SoundFont/Bank
181# MPEG-1 wrapped in a RIFF, apparently
182>8      string          CDXA            \b, wrapped MPEG-1 (CDXA)
183>8	string		4XMV		\b, 4X Movie file
184# AMV-type AVI file: http://wiki.multimedia.cx/index.php?title=AMV
185>8	string		AMV\040		\b, AMV
186
187#
188# XXX - some of the below may only appear in little-endian form.
189#
190# Also "MV93" appears to be for one form of Macromedia Director
191# files, and "GDMF" appears to be another multimedia format.
192#
1930	string		RIFX		RIFF (big-endian) data
194# RIFF Palette format
195>8	string		PAL		\b, palette
196>>16	beshort		x		\b, version %d
197>>18	beshort		x		\b, %d entries
198# RIFF Device Independent Bitmap format
199>8	string		RDIB		\b, device-independent bitmap
200>>16	string		BM
201>>>30	beshort		12		\b, OS/2 1.x format
202>>>>34	beshort		x		\b, %d x
203>>>>36	beshort		x		%d
204>>>30	beshort		64		\b, OS/2 2.x format
205>>>>34	beshort		x		\b, %d x
206>>>>36	beshort		x		%d
207>>>30	beshort		40		\b, Windows 3.x format
208>>>>34	belong		x		\b, %d x
209>>>>38	belong		x		%d x
210>>>>44	beshort		x		%d
211# RIFF MIDI format
212>8	string		RMID		\b, MIDI
213# RIFF Multimedia Movie File format
214>8	string		RMMP		\b, multimedia movie
215# Microsoft WAVE format (*.wav)
216>8	string		WAVE		\b, WAVE audio
217>>20	leshort		1		\b, Microsoft PCM
218>>>34	leshort		>0		\b, %d bit
219>>22	beshort		=1		\b, mono
220>>22	beshort		=2		\b, stereo
221>>22	beshort		>2		\b, %d channels
222>>24	belong		>0		%d Hz
223# Corel Draw Picture
224>8	string		CDRA		\b, Corel Draw Picture
225>8	string		CDR6		\b, Corel Draw Picture, version 6
226# AVI == Audio Video Interleave
227>8	string		AVI\040		\b, AVI
228# Animated Cursor format
229>8	string		ACON		\b, animated cursor
230# Notation Interchange File Format (big-endian only)
231>8	string		NIFF		\b, Notation Interchange File Format
232# SoundFont 2 <mpruett@sgi.com>
233>8	string		sfbk		SoundFont/Bank
234
235#------------------------------------------------------------------------------
236# Sony Wave64
237# see http://www.vcs.de/fileadmin/user_upload/MBS/PDF/Whitepaper/Informations_about_Sony_Wave64.pdf
238# 128 bit RIFF-GUID { 66666972-912E-11CF-A5D6-28DB04C10000 } in little-endian
2390	string	riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00		Sony Wave64 RIFF data
240# 128 bit + total file size (64 bits) so 24 bytes
241# then WAVE-GUID { 65766177-ACF3-11D3-8CD1-00C04F8EDB8A }
242>24	string		wave\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b, WAVE 64 audio
243!:mime	audio/x-w64
244# FMT-GUID { 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A }
245>>40	search/256	fmt\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b
246>>>&10	leshort		=1		\b, mono
247>>>&10	leshort		=2		\b, stereo
248>>>&10	leshort		>2		\b, %d channels
249>>>&12	lelong		>0		%d Hz
250
251#------------------------------------------------------------------------------
252# MBWF/RF64
253# see EBU TECH 3306 http://tech.ebu.ch/docs/tech/tech3306-2009.pdf
2540	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
255!:mime	audio/x-wav
256>40	search/256	fmt\x20		\b
257>>&6	leshort		=1		\b, mono
258>>&6	leshort		=2		\b, stereo
259>>&6	leshort		>2		\b, %d channels
260>>&8	lelong		>0		%d Hz
261
262