xref: /freebsd/contrib/file/magic/Magdir/riff (revision 994297b01b98816bea1abf45ae4bac1bc69ee7a0)
1
2#------------------------------------------------------------------------------
3# $File: riff,v 1.43 2021/04/26 15:56:00 christos Exp $
4# riff:  file(1) magic for RIFF format
5# See
6#
7#	https://www.seanet.com/users/matts/riffmci/riffmci.htm
8#	http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf
9#	https://www.iana.org/assignments/wave-avi-codec-registry/wave-avi-codec-registry.xml
10#
11
12# audio format tag. Assume limits: max 1024 bit, 128 channels, 1 MHz
130   name    riff-wave
14>0	leshort		0x01		\b, Microsoft PCM
15>>14	leshort		>0
16>>>14	leshort		<1024	\b, %d bit
17>0	leshort		0x02		\b, Microsoft ADPCM
18>0	leshort		0x03		\b, IEEE Float
19>0	leshort		0x04		\b, Compaq VSELP
20>0	leshort		0x05		\b, IBM CVSD
21>0	leshort		0x06		\b, ITU G.711 A-law
22>0	leshort		0x07		\b, ITU G.711 mu-law
23>0	leshort		0x08		\b, Microsoft DTS
24>0	leshort		0x10		\b, OKI ADPCM
25>0	leshort		0x11		\b, IMA ADPCM
26>0	leshort		0x12		\b, MediaSpace ADPCM
27>0	leshort		0x13		\b, Sierra ADPCM
28>0	leshort		0x14		\b, ITU G.723 ADPCM (Yamaha)
29>0	leshort		0x15		\b, DSP Solutions DIGISTD
30>0	leshort		0x16		\b, DSP Solutions DIGIFIX
31>0	leshort		0x17		\b, Dialogic OKI ADPCM
32>0	leshort		0x18		\b, MediaVision ADPCM
33>0	leshort		0x19		\b, HP CU
34>0	leshort		0x20		\b, Yamaha ADPCM
35>0	leshort		0x21		\b, Speech Compression SONARC
36>0	leshort		0x22		\b, DSP Group True Speech
37>0	leshort		0x23		\b, Echo Speech EchoSC1
38>0	leshort		0x24		\b, AudioFile AF36
39>0	leshort		0x25		\b, APTX
40>0	leshort		0x26		\b, AudioFile AF10
41>0	leshort		0x27		\b, Prosody 1612
42>0	leshort		0x28		\b, LRC
43>0	leshort		0x30		\b, Dolby AC2
44>0	leshort		0x31		\b, GSM 6.10
45>0	leshort		0x32		\b, MSN Audio
46>0	leshort		0x33		\b, Antex ADPCME
47>0	leshort		0x34		\b, Control Res VQLPC
48>0	leshort		0x35		\b, Digireal
49>0	leshort		0x36		\b, DigiADPCM
50>0	leshort		0x37		\b, Control Res CR10
51>0	leshort		0x38		\b, NMS VBXADPCM
52>0	leshort		0x39		\b, Roland RDAC
53>0	leshort		0x3A		\b, Echo Speech EchoSC3
54>0	leshort		0x3B		\b, Rockwell ADPCM
55>0	leshort		0x3C		\b, Rockwell Digitalk
56>0	leshort		0x3D		\b, Xebec
57>0	leshort		0x40		\b, ITU G.721 ADPCM
58>0	leshort		0x41		\b, ITU G.728 CELP
59>0	leshort		0x42		\b, MSG723
60>0	leshort		0x50		\b, MPEG
61>0	leshort		0x52		\b, RT24
62>0	leshort		0x53		\b, PAC
63>0	leshort		0x55		\b, MPEG Layer 3
64>0	leshort		0x59		\b, Lucent G.723
65>0	leshort		0x60		\b, Cirrus
66>0	leshort		0x61		\b, ESPCM
67>0	leshort		0x62		\b, Voxware
68>0	leshort		0x63		\b, Canopus Atrac
69>0	leshort		0x64		\b, ITU G.726 ADPCM
70>0	leshort		0x65		\b, ITU G.722 ADPCM
71>0	leshort		0x66		\b, DSAT
72>0	leshort		0x67		\b, DSAT Display
73>0	leshort		0x69		\b, Voxware Byte Aligned
74>0	leshort		0x70		\b, Voxware AC8
75>0	leshort		0x71		\b, Voxware AC10
76>0	leshort		0x72		\b, Voxware AC16
77>0	leshort		0x73		\b, Voxware AC20
78>0	leshort		0x74		\b, Voxware MetaVoice
79>0	leshort		0x75		\b, Voxware MetaSound
80>0	leshort		0x76		\b, Voxware RT29HW
81>0	leshort		0x77		\b, Voxware VR12
82>0	leshort		0x78		\b, Voxware VR18
83>0	leshort		0x79		\b, Voxware TQ40
84>0	leshort		0x80		\b, Softsound
85>0	leshort		0x81		\b, Voxware TQ60
86>0	leshort		0x82		\b, MSRT24
87>0	leshort		0x83		\b, ITU G.729A
88>0	leshort		0x84		\b, MVI MV12
89>0	leshort		0x85		\b, DF G.726
90>0	leshort		0x86		\b, DF GSM610
91>0	leshort		0x88		\b, ISIAudio
92>0	leshort		0x89		\b, Onlive
93>0	leshort		0x91		\b, SBC24
94>0	leshort		0x92		\b, Dolby AC3 S/PDIF
95>0	leshort		0x97		\b, ZyXEL ADPCM
96>0	leshort		0x98		\b, Philips LPCBB
97>0	leshort		0x99		\b, Packed
98>0	leshort		0x100		\b, Rhetorex ADPCM
99>0	leshort		0x101		\b, BeCubed Software IRAT
100>0	leshort		0x111		\b, Vivo G.723
101>0	leshort		0x112		\b, Vivo Siren
102>0	leshort		0x123		\b, Digital G.723
103>0	leshort		0x200		\b, Creative ADPCM
104>0	leshort		0x202		\b, Creative FastSpeech8
105>0	leshort		0x203		\b, Creative FastSpeech10
106>0	leshort		0x220		\b, Quarterdeck
107>0	leshort		0x300		\b, FM Towns Snd
108>0	leshort		0x400		\b, BTV Digital
109>0	leshort		0x680		\b, VME VMPCM
110>0	leshort		0x1000		\b, OLIGSM
111>0	leshort		0x1001		\b, OLIADPCM
112>0	leshort		0x1002		\b, OLICELP
113>0	leshort		0x1003		\b, OLISBC
114>0	leshort		0x1004		\b, OLIOPR
115>0	leshort		0x1100		\b, LH Codec
116>0	leshort		0x1400		\b, Norris
117>0	leshort		0x1401		\b, ISIAudio
118>0	leshort		0x1500		\b, Soundspace Music Compression
119>0	leshort		0x2000		\b, AC3 DVM
120>0	leshort		0x2001		\b, DTS
121>2	leshort		=1		\b, mono
122>2	leshort		=2		\b, stereo
123>2	leshort		>2
124>>2	leshort		<128	\b, %d channels
125>4	lelong		>0
126>>4	lelong		<1000000	%d Hz
127
128# try to find "fmt "
1290   name    riff-walk
130>0  string  fmt\x20
131>>4 lelong  >15
132>>>8 use    riff-wave
133>0  string  LIST
134>>&(4.l+4)  use riff-walk
135>0  string  DISP
136>>&(4.l+4)  use riff-walk
137>0  string  bext
138>>&(4.l+4)  use riff-walk
139>0  string  Fake
140>>&(4.l+4)  use riff-walk
141>0  string  fact
142>>&(4.l+4)  use riff-walk
143>0  string  VP8
144>>11		byte		0x9d
145>>>12		byte		0x01
146>>>>13		byte		0x2a	\b, VP8 encoding
147>>>>>14		leshort&0x3fff	x	\b, %d
148>>>>>16		leshort&0x3fff	x	\bx%d, Scaling:
149>>>>>14		leshort&0xc000	0x0000	\b [none]
150>>>>>14		leshort&0xc000	0x1000	\b [5/4]
151>>>>>14		leshort&0xc000	0x2000	\b [5/3]
152>>>>>14		leshort&0xc000	0x3000	\b [2]
153>>>>>14		leshort&0xc000	0x0000	\bx[none]
154>>>>>14		leshort&0xc000	0x1000	\bx[5/4]
155>>>>>14		leshort&0xc000	0x2000	\bx[5/3]
156>>>>>14		leshort&0xc000	0x3000	\bx[2]
157>>>>>15		byte&0x80	=0x00	\b, YUV color
158>>>>>15		byte&0x80	=0x80	\b, bad color specification
159>>>>>15		byte&0x40	=0x40	\b, no clamping required
160>>>>>15		byte&0x40	=0x00	\b, decoders should clamp
161#>0  string  x		we got %s
162#>>&(4.l+4)  use riff-walk
163
164# AVI section extended by Patrik Radman <patrik+file-magic@iki.fi>
165#
1660	string		RIFF		RIFF (little-endian) data
167# RIFF Palette format
168# Update: Joerg Jenderek
169# URL: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
170# Reference: https://worms2d.info/Palette_file
171# WAVE/AVI codec registry: https://www.iana.org/assignments/wave-avi-codec-registry/wave-avi-codec-registry.xml
172>8	string		PAL\ 		\b, palette
173!:mime	application/x-riff
174# color palette by Microsoft Corporation
175!:ext	pal
176# file size =  chunk size + 8 in most cases
177>>4	ulelong+8	x		\b, %u bytes
178# Extended PAL Format
179>>12	string		plth		\b, extended
180# Simple PAL Format
181>>12	string		data
182# data chunk size = color entries * 4 + 4 + sometimes extra (4) appended bytes
183>>>16	ulelong		x		\b, data size %u
184# palVersion is always 0x0300
185#>>>20	leshort		x		\b, version %#4.4x
186# palNumEntries specifies the number of palette color entries
187>>>22	uleshort	x		\b, %u entries
188# after palPalEntry sized (number of color entries * 4 ) vector
189>>>(22.s*4)	ubequad	x
190# jump relative 22 ( 8 + 16) bytes forward points after end of file or to
191# appended extra bytes like in http://safecolours.rigdenage.com/set(ms).zip/Protan(MS).pal
192>>>>&16		ubelong	x		\b, extra bytes
193>>>>>&-4	ubelong	>0		%#8.8x
194# RIFF Device Independent Bitmap format
195# URL: http://fileformats.archiveteam.org/wiki/RDIB
196>8	string		RDIB		\b, device-independent bitmap
197!:ext	rdi/dib
198>>16	string		BM
199>>>30	leshort		12		\b, OS/2 1.x format
200>>>>34	leshort		x		\b, %d x
201>>>>36	leshort		x		%d
202>>>30	leshort		64		\b, OS/2 2.x format
203>>>>34	leshort		x		\b, %d x
204>>>>36	leshort		x		%d
205>>>30	leshort		40		\b, Windows 3.x format
206>>>>34	lelong		x		\b, %d x
207>>>>38	lelong		x		%d x
208>>>>44	leshort		x		%d
209# RIFF MIDI format
210# URL:	http://fileformats.archiveteam.org/wiki/RIFF_MIDI
211>8	string		RMID		\b, MIDI
212# http://extension.nirsoft.net/rmi
213!:mime	audio/mid
214#!:mime	audio/x-rmid
215!:ext	rmi
216# RIFF Multimedia Movie File format
217# URL:	http://fileformats.archiveteam.org/wiki/RIFF_Multimedia_Movie
218>8	string		RMMP		\b, multimedia movie
219!:mime	video/x-mmm
220!:ext	mmm
221# RIFF wrapper for MP3
222>8	string		RMP3		\b, MPEG Layer 3 audio
223#!:mime	audio/x-rmp3
224# Microsoft WAVE format (*.wav)
225# URL:		http://fileformats.archiveteam.org/wiki/WAV
226>8	string		WAVE		\b, WAVE audio
227#!:mime	audio/vnd.wave
228!:mime	audio/x-wav
229# https://www.macdisk.com/macsigen.php
230#!:apple	????WAVE
231!:ext	wav/wave
232>>12    string  >\0
233>>>12   use     riff-walk
234# Update:	Joerg Jenderek
235# lower case for Corel Draw version 8 Bidi
236>8	string/c	cdr
237# skip Corel CCX Clipart
238>>8	string		!CDRXcont
239# Corel Draw Picture
240>>>0	use     corel-draw
241# URL:		http://fileformats.archiveteam.org/wiki/CCX_(Corel)
242# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/ccx-corel.trid.xml
243>>8	string		=CDRXcont	\b, Corel Clipart
244!:mime	application/x-corel-ccx
245!:ext	ccx
246# 3rd chunk data {Corel\040Binary\040Meta\040File}
247#>>>20	string		x		\b, 3rd '%-s'
248>>>4	ulelong+8	x		\b, %u bytes
249# From:		Joerg Jenderek
250# URL:		https://en.wikipedia.org/wiki/CorelDRAW
251# Reference:	http://fileformats.archiveteam.org/wiki/CorelDRAW
252# Picture templates created by newer software start with RIFF type CDT
253>8	string		CDT
254>>0	use		corel-draw
255# Picture templates with version 4.4
256>8	string		CDST
257>>0	use		corel-draw
258# pattern created by newer software start with RIFF type PAT
259>8	string		PAT
260>>0	use		corel-draw
261# From:		Joerg Jenderek
262# URL:		https://en.wikipedia.org/wiki/Corel_Designer
263# Reference:	http://fileformats.archiveteam.org/wiki/Corel_Designer
264>8	string		DES
265>>8	string		!DESC
266>>>0	use		corel-des
267# Corel Draw templates with version 12.5 or Corel Designer illustration 12
268>>8	string		=DESC
269# MORE TESTS NEEDED HERE!
270#>>>0	use		corel-des
271#>>>0	use		corel-draw
272>8	string		NUNDROOT	\b, Steinberg CuBase
273# AVI == Audio Video Interleave
274# Reference:	http://fileformats.archiveteam.org/wiki/AVI
275>8	string		AVI\040		\b, AVI
276# https://reposcope.com/mimetype/video/x-msvideo
277!:mime	video/x-msvideo
278# https://www.iana.org/assignments/wave-avi-codec-registry/wave-avi-codec-registry.xml
279#!:mime	video/vnd.avi
280!:ext	avi/divx
281>>12    string          LIST
282>>>20   string          hdrlavih
283>>>>&36 lelong          x               \b, %u x
284>>>>&40 lelong          x               %u,
285>>>>&4  lelong          >1000000        <1 fps,
286>>>>&4  lelong          1000000         1.00 fps,
287>>>>&4  lelong          500000          2.00 fps,
288>>>>&4  lelong          333333          3.00 fps,
289>>>>&4  lelong          250000          4.00 fps,
290>>>>&4  lelong          200000          5.00 fps,
291>>>>&4  lelong          166667          6.00 fps,
292>>>>&4  lelong          142857          7.00 fps,
293>>>>&4  lelong          125000          8.00 fps,
294>>>>&4  lelong          111111          9.00 fps,
295>>>>&4  lelong          100000          10.00 fps,
296# ]9.9,10.1[
297>>>>&4  lelong          <101010
298>>>>>&-4        lelong  >99010
299>>>>>>&-4       lelong  !100000         ~10 fps,
300>>>>&4  lelong          83333           12.00 fps,
301# ]11.9,12.1[
302>>>>&4  lelong          <84034
303>>>>>&-4        lelong  >82645
304>>>>>>&-4       lelong  !83333          ~12 fps,
305>>>>&4  lelong          66667           15.00 fps,
306# ]14.9,15.1[
307>>>>&4  lelong          <67114
308>>>>>&-4        lelong  >66225
309>>>>>>&-4       lelong  !66667          ~15 fps,
310>>>>&4  lelong          50000           20.00 fps,
311>>>>&4  lelong          41708           23.98 fps,
312>>>>&4  lelong          41667           24.00 fps,
313# ]23.9,24.1[
314>>>>&4  lelong          <41841
315>>>>>&-4        lelong  >41494
316>>>>>>&-4       lelong  !41708
317>>>>>>>&-4      lelong  !41667          ~24 fps,
318>>>>&4  lelong          40000           25.00 fps,
319# ]24.9,25.1[
320>>>>&4  lelong          <40161
321>>>>>&-4        lelong  >39841
322>>>>>>&-4       lelong  !40000          ~25 fps,
323>>>>&4  lelong          33367           29.97 fps,
324>>>>&4  lelong          33333           30.00 fps,
325# ]29.9,30.1[
326>>>>&4  lelong          <33445
327>>>>>&-4        lelong  >33223
328>>>>>>&-4       lelong  !33367
329>>>>>>>&-4      lelong  !33333          ~30 fps,
330>>>>&4  lelong          <32224          >30 fps,
331##>>>>&4  lelong          x               (%lu)
332##>>>>&20 lelong          x               %lu frames,
333# Note: The tests below assume that the AVI has 1 or 2 streams,
334#       "vids" optionally followed by "auds".
335#       (Should cover 99.9% of all AVIs.)
336# assuming avih length = 56
337>>>88   string  LIST
338>>>>96  string  strlstrh
339>>>>>108        string  vids    video:
340>>>>>>&0        lelong  0               uncompressed
341# skip past vids strh
342>>>>>>(104.l+108)       string  strf
343>>>>>>>(104.l+132)      lelong          1       RLE 8bpp
344>>>>>>>(104.l+132)      string/c        anim    Intel RDX
345>>>>>>>(104.l+132)      string/c        aur2    AuraVision Aura 2
346>>>>>>>(104.l+132)      string/c        aura    AuraVision Aura
347>>>>>>>(104.l+132)      string/c        bt20    Brooktree MediaStream
348>>>>>>>(104.l+132)      string/c        btcv    Brooktree Composite Video
349>>>>>>>(104.l+132)      string/c        cc12    Intel YUV12
350>>>>>>>(104.l+132)      string/c        cdvc    Canopus DV
351>>>>>>>(104.l+132)      string/c        cham    Winnov Caviara Cham
352>>>>>>>(104.l+132)      string/c        cljr    Proprietary YUV 4 pixels
353>>>>>>>(104.l+132)      string/c        cmyk    Common Data Format in Printing
354>>>>>>>(104.l+132)      string/c        cpla    Weitek 4:2:0 YUV Planar
355>>>>>>>(104.l+132)      string/c        cvid    Cinepak
356>>>>>>>(104.l+132)      string/c        cwlt    Microsoft Color WLT DIB
357>>>>>>>(104.l+132)      string/c        cyuv    Creative Labs YUV
358>>>>>>>(104.l+132)      string/c        d261    H.261
359>>>>>>>(104.l+132)      string/c        d263    H.263
360>>>>>>>(104.l+132)      string/c        duck    TrueMotion 1.0
361>>>>>>>(104.l+132)      string/c        dve2    DVE-2 Videoconferencing
362>>>>>>>(104.l+132)      string/c        fljp    Field Encoded Motion JPEG
363>>>>>>>(104.l+132)      string/c        fvf1    Fractal Video Frame
364>>>>>>>(104.l+132)      string/c        gwlt    Microsoft Greyscale WLT DIB
365>>>>>>>(104.l+132)      string/c        h260    H.260
366>>>>>>>(104.l+132)      string/c        h261    H.261
367>>>>>>>(104.l+132)      string/c        h262    H.262
368>>>>>>>(104.l+132)      string/c        h263    H.263
369>>>>>>>(104.l+132)      string/c        h264    H.264
370>>>>>>>(104.l+132)      string/c        h265    H.265
371>>>>>>>(104.l+132)      string/c        h266    H.266
372>>>>>>>(104.l+132)      string/c        h267    H.267
373>>>>>>>(104.l+132)      string/c        h268    H.268
374>>>>>>>(104.l+132)      string/c        h269    H.269
375>>>>>>>(104.l+132)      string/c        i263    Intel I.263
376>>>>>>>(104.l+132)      string/c        i420    Intel Indeo 4
377>>>>>>>(104.l+132)      string/c        ian     Intel RDX
378>>>>>>>(104.l+132)      string/c        iclb    CellB Videoconferencing Codec
379>>>>>>>(104.l+132)      string/c        ilvc    Intel Layered Video
380>>>>>>>(104.l+132)      string/c        ilvr    ITU-T H.263+
381>>>>>>>(104.l+132)      string/c        iraw    Intel YUV Uncompressed
382>>>>>>>(104.l+132)      string/c        iv30    Intel Indeo 3
383>>>>>>>(104.l+132)      string/c        iv31    Intel Indeo 3.1
384>>>>>>>(104.l+132)      string/c        iv32    Intel Indeo 3.2
385>>>>>>>(104.l+132)      string/c        iv33    Intel Indeo 3.3
386>>>>>>>(104.l+132)      string/c        iv34    Intel Indeo 3.4
387>>>>>>>(104.l+132)      string/c        iv35    Intel Indeo 3.5
388>>>>>>>(104.l+132)      string/c        iv36    Intel Indeo 3.6
389>>>>>>>(104.l+132)      string/c        iv37    Intel Indeo 3.7
390>>>>>>>(104.l+132)      string/c        iv38    Intel Indeo 3.8
391>>>>>>>(104.l+132)      string/c        iv39    Intel Indeo 3.9
392>>>>>>>(104.l+132)      string/c        iv40    Intel Indeo 4.0
393>>>>>>>(104.l+132)      string/c        iv41    Intel Indeo 4.1
394>>>>>>>(104.l+132)      string/c        iv42    Intel Indeo 4.2
395>>>>>>>(104.l+132)      string/c        iv43    Intel Indeo 4.3
396>>>>>>>(104.l+132)      string/c        iv44    Intel Indeo 4.4
397>>>>>>>(104.l+132)      string/c        iv45    Intel Indeo 4.5
398>>>>>>>(104.l+132)      string/c        iv46    Intel Indeo 4.6
399>>>>>>>(104.l+132)      string/c        iv47    Intel Indeo 4.7
400>>>>>>>(104.l+132)      string/c        iv48    Intel Indeo 4.8
401>>>>>>>(104.l+132)      string/c        iv49    Intel Indeo 4.9
402>>>>>>>(104.l+132)      string/c        iv50    Intel Indeo 5.0
403>>>>>>>(104.l+132)      string/c        mpeg    MPEG 1 Video Frame
404>>>>>>>(104.l+132)      string/c        mjpg    Motion JPEG
405>>>>>>>(104.l+132)      string/c        mp42    Microsoft MPEG-4 v2
406>>>>>>>(104.l+132)      string/c        mp43    Microsoft MPEG-4 v3
407>>>>>>>(104.l+132)      string/c        mrca    MR Codec
408>>>>>>>(104.l+132)      string/c        mrle    Run Length Encoding
409>>>>>>>(104.l+132)      string/c        msvc    Microsoft Video 1
410>>>>>>>(104.l+132)      string/c        phmo    Photomotion
411>>>>>>>(104.l+132)      string/c        qpeq    QPEG 1.1 Format Video
412>>>>>>>(104.l+132)      string/c        rgbt    RGBT
413>>>>>>>(104.l+132)      string/c        rle4    Run Length Encoded 4
414>>>>>>>(104.l+132)      string/c        rle8    Run Length Encoded 8
415>>>>>>>(104.l+132)      string/c        rt21    Intel Indeo 2.1
416>>>>>>>(104.l+132)      string/c        rvx     Intel RDX
417>>>>>>>(104.l+132)      string/c        sdcc    Sun Digital Camera Codec
418>>>>>>>(104.l+132)      string/c        sfmc    Crystal Net SFM Codec
419>>>>>>>(104.l+132)      string/c        smsc    SMSC
420>>>>>>>(104.l+132)      string/c        smsd    SMSD
421>>>>>>>(104.l+132)      string/c        splc    Splash Studios ACM Audio Codec
422>>>>>>>(104.l+132)      string/c        sqz2    Microsoft VXtreme Video Codec
423>>>>>>>(104.l+132)      string/c        sv10    Sorenson Video R1
424>>>>>>>(104.l+132)      string/c        tlms    TeraLogic Motion Intraframe Codec A
425>>>>>>>(104.l+132)      string/c        tlst    TeraLogic Motion Intraframe Codec B
426>>>>>>>(104.l+132)      string/c        tm20    TrueMotion 2.0
427>>>>>>>(104.l+132)      string/c        tmic    TeraLogic Motion Intraframe Codec 2
428>>>>>>>(104.l+132)      string/c        tmot    TrueMotion Video Compression
429>>>>>>>(104.l+132)      string/c        tr20    TrueMotion RT 2.0
430>>>>>>>(104.l+132)      string/c        ulti    Ultimotion
431>>>>>>>(104.l+132)      string/c        uyvy    UYVY 4:2:2 byte ordering
432>>>>>>>(104.l+132)      string/c        v422    24-bit YUV 4:2:2 format
433>>>>>>>(104.l+132)      string/c        v655    16-bit YUV 4:2:2 format
434>>>>>>>(104.l+132)      string/c        vcr1    ATI VCR 1.0
435>>>>>>>(104.l+132)      string/c        vcr2    ATI VCR 2.0
436>>>>>>>(104.l+132)      string/c        vcr3    ATI VCR 3.0
437>>>>>>>(104.l+132)      string/c        vcr4    ATI VCR 4.0
438>>>>>>>(104.l+132)      string/c        vcr5    ATI VCR 5.0
439>>>>>>>(104.l+132)      string/c        vcr6    ATI VCR 6.0
440>>>>>>>(104.l+132)      string/c        vcr7    ATI VCR 7.0
441>>>>>>>(104.l+132)      string/c        vcr8    ATI VCR 8.0
442>>>>>>>(104.l+132)      string/c        vcr9    ATI VCR 9.0
443>>>>>>>(104.l+132)      string/c        vdct    Video Maker Pro DIB
444>>>>>>>(104.l+132)      string/c        vids    YUV 4:2:2 CCIR 601 for V422
445>>>>>>>(104.l+132)      string/c        vivo    Vivo H.263
446>>>>>>>(104.l+132)      string/c        vixl    VIXL
447>>>>>>>(104.l+132)      string/c        vlv1    VLCAP.DRV
448>>>>>>>(104.l+132)      string/c        wbvc    W9960
449>>>>>>>(104.l+132)      string/c        x263    mmioFOURCC('X','2','6','3')
450>>>>>>>(104.l+132)      string/c        xlv0    XL Video Decoder
451>>>>>>>(104.l+132)      string/c        y211    YUV 2:1:1 Packed
452>>>>>>>(104.l+132)      string/c        y411    YUV 4:1:1 Packed
453>>>>>>>(104.l+132)      string/c        y41b    YUV 4:1:1 Planar
454>>>>>>>(104.l+132)      string/c        y41p    PC1 4:1:1
455>>>>>>>(104.l+132)      string/c        y41t    PC1 4:1:1 with transparency
456>>>>>>>(104.l+132)      string/c        y42b    YUV 4:2:2 Planar
457>>>>>>>(104.l+132)      string/c        y42t    PC1 4:2:2 with transparency
458>>>>>>>(104.l+132)      string/c        yc12    Intel YUV12 Codec
459>>>>>>>(104.l+132)      string/c        yuv8    Winnov Caviar YUV8
460>>>>>>>(104.l+132)      string/c        yuv9    YUV9
461>>>>>>>(104.l+132)      string/c        yuy2    YUY2 4:2:2 byte ordering packed
462>>>>>>>(104.l+132)      string/c        yuyv    BI_YUYV, Canopus
463>>>>>>>(104.l+132)      string/c        fmp4    FFMpeg MPEG-4
464>>>>>>>(104.l+132)      string/c        div3    DivX 3
465>>>>>>>>112             string/c        div3    Low-Motion
466>>>>>>>>112             string/c        div4    Fast-Motion
467>>>>>>>(104.l+132)      string/c        divx    DivX 4
468>>>>>>>(104.l+132)      string/c        dx50    DivX 5
469>>>>>>>(104.l+132)      string/c        xvid    XviD
470>>>>>>>(104.l+132)	string/c	h264	H.264
471>>>>>>>(104.l+132)      string/c        wmv3    Windows Media Video 9
472>>>>>>>(104.l+132)      string/c        h264    X.264 or H.264
473>>>>>>>(104.l+132)      lelong  0
474##>>>>>>>(104.l+132)      string  x       (%.4s)
475# skip past first (video) LIST
476>>>>(92.l+96)   string  LIST
477>>>>>(92.l+104) string  strlstrh
478>>>>>>(92.l+116)        string          auds    \b, audio:
479# auds strh length = 56:
480>>>>>>>(92.l+172)       string          strf
481>>>>>>>>(92.l+180)      leshort 0x0001  uncompressed PCM
482>>>>>>>>(92.l+180)      leshort 0x0002  ADPCM
483>>>>>>>>(92.l+180)      leshort 0x0006  aLaw
484>>>>>>>>(92.l+180)      leshort 0x0007  uLaw
485>>>>>>>>(92.l+180)      leshort 0x0050  MPEG-1 Layer 1 or 2
486>>>>>>>>(92.l+180)      leshort 0x0055  MPEG-1 Layer 3
487>>>>>>>>(92.l+180)      leshort 0x2000  Dolby AC3
488>>>>>>>>(92.l+180)      leshort 0x0161  DivX
489##>>>>>>>>(92.l+180)      leshort x       (%#.4x)
490>>>>>>>>(92.l+182)      leshort 1       (mono,
491>>>>>>>>(92.l+182)      leshort 2       (stereo,
492>>>>>>>>(92.l+182)      leshort >2      (%d channels,
493>>>>>>>>(92.l+184)      lelong  x       %d Hz)
494# auds strh length = 64:
495>>>>>>>(92.l+180)       string          strf
496>>>>>>>>(92.l+188)      leshort 0x0001  uncompressed PCM
497>>>>>>>>(92.l+188)      leshort 0x0002  ADPCM
498>>>>>>>>(92.l+188)      leshort 0x0055  MPEG-1 Layer 3
499>>>>>>>>(92.l+188)      leshort 0x2000  Dolby AC3
500>>>>>>>>(92.l+188)      leshort 0x0161  DivX
501##>>>>>>>>(92.l+188)      leshort x       (%#.4x)
502>>>>>>>>(92.l+190)      leshort 1       (mono,
503>>>>>>>>(92.l+190)      leshort 2       (stereo,
504>>>>>>>>(92.l+190)      leshort >2      (%d channels,
505>>>>>>>>(92.l+192)      lelong  x       %d Hz)
506# From:		Joerg Jenderek
507# URL:		http://fileformats.archiveteam.org/wiki/VDR_(VirtualDub)
508# Reference:	http://sourceforge.net/projects/virtualdub/files/virtualdub-win/
509#		1.10.4.35491/VirtualDub-1.10.4-src.7z/src/vdremote/Main.cpp
510# VirtualDub link handler
511>8	string		VDRM		\b, VirtualDub link
512!:mime	video/x-vdr
513!:ext	vdr
514>>12	string		PATH		\b, PATH
515# remote-path to video file
516>>16	pstring/l	x		%s
517# Animated Cursor format
518# Update:	Joerg Jenderek
519# URL:		http://fileformats.archiveteam.org/wiki/Windows_Animated_Cursor
520# Reference:	https://www.gdgsoft.com/anituner/help/aniformat.htm
521>8	string		ACON		\b, animated cursor
522!:mime	application/x-navi-animation
523# http://extension.nirsoft.net/ani
524#!:mime	image/ani
525!:ext	ani
526# INAM tag followed by length of title
527>>24	string		INAM
528>>>28	pstring/l	x		"%s"
529# IART tag followed by length of author
530>>>(28.l+32)	ubelong	0x49415254
531>>>>&0	pstring/l	x		%s
532# SoundFont 2 <mpruett@sgi.com>
533# URL:	http://fileformats.archiveteam.org/wiki/SoundFont_2.0
534>8	string		sfbk		\b, SoundFont/Bank
535!:mime	audio/x-sfbk
536!:ext	sf2
537# MPEG-1 wrapped in a RIFF, apparently
538# URL:	http://file.fyicenter.com/17_Video_.DAT_File_Extension_for_VCD_Files.html
539>8      string          CDXA            \b, wrapped MPEG-1 (CDXA)
540!:mime	video/x-cdxa
541!:ext	mpg/dat
542# URL:	http://fileformats.archiveteam.org/wiki/4X_IMA_ADPCM
543>8	string		4XMV		\b, 4X Movie file
544!:mime	video/x-4xmv
545!:ext	4xm/4xa
546# AMV-type AVI file: https://wiki.multimedia.cx/index.php?title=AMV
547>8	string		AMV\040		\b, AMV
548# http://fileformats.archiveteam.org/wiki/MTV_Video_(.AMV)
549!:mime	video/x-amv
550!:ext	amv
551#!:ext	amv/mtv
552# URL:	http://fileformats.archiveteam.org/wiki/WebP
553>8      string          WEBP            \b, Web/P image
554!:mime	image/webp
555!:ext	webp
556>>12	use		riff-walk
557# From:		Joerg Jenderek
558# URL:		http://fileformats.archiveteam.org/wiki/RIFF_MIDS
559>8      string          MIDS            \b, MIDI Stream
560!:mime	audio/x-mids
561!:ext	mds
562# From:		Joerg Jenderek
563# URL:		http://mark0.net/soft-trid-e.html
564# Reference:	http://fileformats.archiveteam.org/wiki/Trd_(TRID)
565>8      string          TRID            \b, TrID defs package
566!:mime	application/x-trid-trd
567!:ext	trd
568# From:		Joerg Jenderek
569# URL:		https://en.wikipedia.org/wiki/CorelDRAW
570# Reference:	http://fileformats.archiveteam.org/wiki/CorelDRAW
571# Note:		Since version 3 CorelDraw Pictures are RIFF based
572# but data chunks remain proprietary.
573# Since version 14 til 15 packed as "content/riffData.cdr" and
574# since 16 "content/root.dat" in ZIP container
575# TODO:		distinguish templates with version 12.5 from Designer illustration 12
576#	display information of RIFF based Corel Draw pictures, templates and patterns
5770	name   	corel-draw
578# display second chunk for debugging
579#>8	string		x		\b, [8]=%.8s
580>0	string		x		\b, Corel Draw
581#!:mime	image/x-coreldraw
582!:mime	application/vnd.corel-draw
583# used by newer pictures templates
584>>8	string		CDT
585# used by templates with newer versions since 16
586>>>12	string		=fver		Picture template (root.dat)
587!:ext	dat
588# used by templates with older versions with vrsn tag
589>>>12	string		!fver
590# used by templates with older versions 14-15
591>>>>11	string		>E		Picture template (riffData.cdr)
592!:ext	cdr
593# used by templates with older versions 11-13
594>>>>11	string		<F		Picture template
595!:ext	cdt/cdrt
596# used by older templates with version 4.4
597>>8	string		CDST		Picture template
598!:ext	cdt
599# used by templates with version 12.5
600>>8	string		DESC		Picture template
601!:ext	cdt
602# used by newer patterns with version 22
603>>8	string		PAT		Pattern
604!:ext	dat
605# remaining older templates, patterns, drawings
606>>8	default		x
607# pattern with old version 4.y
608>>>26	ulelong		=0x0000206C	Pattern
609!:ext	pat
610# pattern with newer versions
611>>>26	ulelong		=0x00000D2C	Pattern
612!:ext	pat
613# remaining older templates or pictures
614>>>26	default		x
615# used by older versions 5 - 15
616>>>>12	string		=vrsn
617# 4th chunk size unequal 282Ch only found for CDR
618>>>>>26	ulelong		!0x0000282c	Picture
619!:ext	cdr
620>>>>>26	default		x		Picture or template
621!:ext	cdr/cdt
622# used by newer versions since 16
623>>>>12	string		=fver		Picture (root.dat)
624!:ext	dat
625# version marked by 1 ASCII char: space~3, ... , F~15,  ... , N~22, ... R~22 template
626>11	string		x		\b, version
627>11	string		>\040		'%-.1s'
628>0	use		corel-version
629>4	ulelong+8	x		\b, %u bytes
630#
631#	display numeric version of RIFF based Corel after 3rd RIFF tag
6320	name   	corel-version
633# for debugging purpose; vrsn for short content; fver for 16 byte size
634#>12	string		x		\b, TAG "%-4.4s"
635# 1st data chunk length 2 implies short content version
636>16	ulelong		2
637# vrsn chunk short content interpreted by MajorVersion * 100 + MinorVersion
638>>20	uleshort/100	x		%u
639>>20	uleshort%100	>0		\b.%u
640# for debugging purpose display next chunk like: DISP LIST
641#>>22	string		x		\b, 4th "%-4.4s"
642#>>26	ulelong		x		\b, 4th SIZE %#x
643# for debugging purpose display 5th chunk like: LIST DISP ccmm osfp
644#>>(26.l+30)	string	x		\b, 5th "%-4.4s"
645# 1st data chunk length 10h implies 16 byte content with version info
646>16	ulelong		0x10
647>>34	ubyte		x		%u
648>>>33	ubyte		>0		\b.%u
649#	display information of RIFF based Corel Design formats
6500	name   	corel-des
651# display second chunk for debugging
652#>8	string		x		\b, [8]=%.8s
653>12	string		x		\b, Corel DESIGNER
654!:mime	image/x-corel-des
655#!:mime	application/x-vnd.corel.designer.document
656# used by Corel Designer with newer versions since 16
657>12	string		=fver		graphics (root.dat)
658!:ext	dat
659# used by Corel Designer templates with older versions with vrsn tag
660>12	string		!fver
661# used by Corel Designer with versions 14-15
662>>11	string		>D		graphics (riffData.cdr)
663!:ext	cdr
664# used by Corel Designer with versions 10-12
665>>11	string		<E		graphics
666!:ext	des
667# version indicated by last ASCII char of second chunk tag
668>11	string		x		\b, version '%-.1s'
669# but vrsn short content is not always version indicator
670# exceptions: 'A'~11.4 'B'~12 'C'~12.5
671>11	string		>D
672>>0	use		corel-version
673# for debugging purpose display next chunk like: DISP LIST
674#>>22	string		x		\b, 4th "%-4.4s"
675#>>26	ulelong		x		\b, 4th SIZE %#x
676# for debugging purpose display 5th chunk like: LIST osfp
677#>>(26.l+30)	string	x		\b, 5th "%-4.4s"
678>4	ulelong+8	x		\b, %u bytes
679#
680# XXX - some of the below may only appear in little-endian form.
681#
682# Also "MV93" appears to be for one form of Macromedia Director
683# files, and "GDMF" appears to be another multimedia format.
684#
6850	string		RIFX		RIFF (big-endian) data
686# RIFF Palette format
687>8	string		PAL		\b, palette
688>>16	beshort		x		\b, version %d
689>>18	beshort		x		\b, %d entries
690# RIFF Device Independent Bitmap format
691>8	string		RDIB		\b, device-independent bitmap
692>>16	string		BM
693>>>30	beshort		12		\b, OS/2 1.x format
694>>>>34	beshort		x		\b, %d x
695>>>>36	beshort		x		%d
696>>>30	beshort		64		\b, OS/2 2.x format
697>>>>34	beshort		x		\b, %d x
698>>>>36	beshort		x		%d
699>>>30	beshort		40		\b, Windows 3.x format
700>>>>34	belong		x		\b, %d x
701>>>>38	belong		x		%d x
702>>>>44	beshort		x		%d
703# RIFF MIDI format
704>8	string		RMID		\b, MIDI
705# RIFF Multimedia Movie File format
706>8	string		RMMP		\b, multimedia movie
707# Microsoft WAVE format (*.wav)
708>8	string		WAVE		\b, WAVE audio
709>>20	leshort		1		\b, Microsoft PCM
710>>>34	leshort		>0		\b, %d bit
711>>22	beshort		=1		\b, mono
712>>22	beshort		=2		\b, stereo
713>>22	beshort		>2		\b, %d channels
714>>24	belong		>0		%d Hz
715# Corel Draw Picture big endian not tested by real examples
716#>8	string		CDRA		\b, Corel Draw Picture
717#>8	string		CDR6		\b, Corel Draw Picture, version 6
718>8	string		CDR
719>>0	use     \^corel-draw
720
721# AVI == Audio Video Interleave
722>8	string		AVI\040		\b, AVI
723# Animated Cursor format
724>8	string		ACON		\b, animated cursor
725# Notation Interchange File Format (big-endian only)
726>8	string		NIFF		\b, Notation Interchange File Format
727# SoundFont 2 <mpruett@sgi.com>
728>8	string		sfbk		SoundFont/Bank
729
730#------------------------------------------------------------------------------
731# Sony Wave64
732# see http://www.vcs.de/fileadmin/user_upload/MBS/PDF/Whitepaper/Informations_about_Sony_Wave64.pdf
733# 128 bit RIFF-GUID { 66666972-912E-11CF-A5D6-28DB04C10000 } in little-endian
7340	string	riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00		Sony Wave64 RIFF data
735# 128 bit + total file size (64 bits) so 24 bytes
736# then WAVE-GUID { 65766177-ACF3-11D3-8CD1-00C04F8EDB8A }
737>24	string		wave\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b, WAVE 64 audio
738!:mime	audio/x-w64
739# FMT-GUID { 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A }
740>>40	search/256	fmt\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A		\b
741>>>&10	leshort		=1		\b, mono
742>>>&10	leshort		=2		\b, stereo
743>>>&10	leshort		>2		\b, %d channels
744>>>&12	lelong		>0		%d Hz
745
746#------------------------------------------------------------------------------
747# MBWF/RF64
748# see EBU TECH 3306 https://tech.ebu.ch/docs/tech/tech3306-2009.pdf
7490	string	RF64\xff\xff\xff\xffWAVEds64		MBWF/RF64 audio
750!:mime	audio/x-wav
751>40	search/256	fmt\x20		\b
752>>&6	leshort		=1		\b, mono
753>>&6	leshort		=2		\b, stereo
754>>&6	leshort		>2		\b, %d channels
755>>&8	lelong		>0		%d Hz
756