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