1# $OpenBSD: riff,v 1.2 2008/05/14 20:45:35 chl Exp $ 2 3#------------------------------------------------------------------------------ 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>>20 leshort 1 \b, Microsoft PCM 38>>>34 leshort >0 \b, %d bit 39>>20 leshort 2 \b, Microsoft ADPCM 40>>20 leshort 6 \b, ITU G.711 A-law 41>>20 leshort 7 \b, ITU G.711 mu-law 42>>20 leshort 17 \b, IMA ADPCM 43>>20 leshort 20 \b, ITU G.723 ADPCM (Yamaha) 44>>20 leshort 49 \b, GSM 6.10 45>>20 leshort 64 \b, ITU G.721 ADPCM 46>>20 leshort 80 \b, MPEG 47>>20 leshort 85 \b, MPEG Layer 3 48>>22 leshort =1 \b, mono 49>>22 leshort =2 \b, stereo 50>>22 leshort >2 \b, %d channels 51>>24 lelong >0 %d Hz 52# Corel Draw Picture 53>8 string CDRA \b, Corel Draw Picture 54# AVI == Audio Video Interleave 55>8 string AVI\040 \b, AVI 56>>12 string LIST 57>>>20 string hdrlavih 58>>>>&36 lelong x \b, %lu x 59>>>>&40 lelong x %lu, 60>>>>&4 lelong >1000000 <1 fps, 61>>>>&4 lelong 1000000 1.00 fps, 62>>>>&4 lelong 500000 2.00 fps, 63>>>>&4 lelong 333333 3.00 fps, 64>>>>&4 lelong 250000 4.00 fps, 65>>>>&4 lelong 200000 5.00 fps, 66>>>>&4 lelong 166667 6.00 fps, 67>>>>&4 lelong 142857 7.00 fps, 68>>>>&4 lelong 125000 8.00 fps, 69>>>>&4 lelong 111111 9.00 fps, 70>>>>&4 lelong 100000 10.00 fps, 71# ]9.9,10.1[ 72>>>>&4 lelong <101010 73>>>>>&-4 lelong >99010 74>>>>>>&-4 lelong !100000 ~10 fps, 75>>>>&4 lelong 83333 12.00 fps, 76# ]11.9,12.1[ 77>>>>&4 lelong <84034 78>>>>>&-4 lelong >82645 79>>>>>>&-4 lelong !83333 ~12 fps, 80>>>>&4 lelong 66667 15.00 fps, 81# ]14.9,15.1[ 82>>>>&4 lelong <67114 83>>>>>&-4 lelong >66225 84>>>>>>&-4 lelong !66667 ~15 fps, 85>>>>&4 lelong 50000 20.00 fps, 86>>>>&4 lelong 41708 23.98 fps, 87>>>>&4 lelong 41667 24.00 fps, 88# ]23.9,24.1[ 89>>>>&4 lelong <41841 90>>>>>&-4 lelong >41494 91>>>>>>&-4 lelong !41708 92>>>>>>>&-4 lelong !41667 ~24 fps, 93>>>>&4 lelong 40000 25.00 fps, 94# ]24.9,25.1[ 95>>>>&4 lelong <40161 96>>>>>&-4 lelong >39841 97>>>>>>&-4 lelong !40000 ~25 fps, 98>>>>&4 lelong 33367 29.97 fps, 99>>>>&4 lelong 33333 30.00 fps, 100# ]29.9,30.1[ 101>>>>&4 lelong <33445 102>>>>>&-4 lelong >33223 103>>>>>>&-4 lelong !33367 104>>>>>>>&-4 lelong !33333 ~30 fps, 105>>>>&4 lelong <32224 >30 fps, 106##>>>>&4 lelong x (%lu) 107##>>>>&20 lelong x %lu frames, 108# Note: The tests below assume that the AVI has 1 or 2 streams, 109# "vids" optionally followed by "auds". 110# (Should cover 99.9% of all AVIs.) 111# assuming avih length = 56 112>>>88 string LIST 113>>>>96 string strlstrh 114>>>>>108 string vids video: 115>>>>>>&0 lelong 0 uncompressed 116# skip past vids strh 117>>>>>>(104.l+108) string strf 118>>>>>>>(104.l+132) lelong 1 RLE 8bpp 119>>>>>>>(104.l+132) string/c cvid Cinepak 120>>>>>>>(104.l+132) string/c i263 Intel I.263 121>>>>>>>(104.l+132) string/c iv32 Indeo 3.2 122>>>>>>>(104.l+132) string/c iv41 Indeo 4.1 123>>>>>>>(104.l+132) string/c iv50 Indeo 5.0 124>>>>>>>(104.l+132) string/c mp42 Microsoft MPEG-4 v2 125>>>>>>>(104.l+132) string/c mp43 Microsoft MPEG-4 v3 126>>>>>>>(104.l+132) string/c fmp4 FFMpeg MPEG-4 127>>>>>>>(104.l+132) string/c mjpg Motion JPEG 128>>>>>>>(104.l+132) string/c div3 DivX 3 129>>>>>>>>112 string/c div3 Low-Motion 130>>>>>>>>112 string/c div4 Fast-Motion 131>>>>>>>(104.l+132) string/c divx DivX 4 132>>>>>>>(104.l+132) string/c dx50 DivX 5 133>>>>>>>(104.l+132) string/c xvid XviD 134>>>>>>>(104.l+132) string/c wmv3 Windows Media Video 9 135>>>>>>>(104.l+132) string/c h264 X.264 136>>>>>>>(104.l+132) lelong 0 137##>>>>>>>(104.l+132) string x (%.4s) 138# skip past first (video) LIST 139>>>>(92.l+96) string LIST 140>>>>>(92.l+104) string strlstrh 141>>>>>>(92.l+116) string auds \b, audio: 142# auds strh length = 56: 143>>>>>>>(92.l+172) string strf 144>>>>>>>>(92.l+180) leshort 0x0001 uncompressed PCM 145>>>>>>>>(92.l+180) leshort 0x0002 ADPCM 146>>>>>>>>(92.l+180) leshort 0x0006 aLaw 147>>>>>>>>(92.l+180) leshort 0x0007 uLaw 148>>>>>>>>(92.l+180) leshort 0x0050 MPEG-1 Layer 1 or 2 149>>>>>>>>(92.l+180) leshort 0x0055 MPEG-1 Layer 3 150>>>>>>>>(92.l+180) leshort 0x2000 Dolby AC3 151>>>>>>>>(92.l+180) leshort 0x0161 DivX 152##>>>>>>>>(92.l+180) leshort x (0x%.4x) 153>>>>>>>>(92.l+182) leshort 1 (mono, 154>>>>>>>>(92.l+182) leshort 2 (stereo, 155>>>>>>>>(92.l+182) leshort >2 (%d channels, 156>>>>>>>>(92.l+184) lelong x %d Hz) 157# auds strh length = 64: 158>>>>>>>(92.l+180) string strf 159>>>>>>>>(92.l+188) leshort 0x0001 uncompressed PCM 160>>>>>>>>(92.l+188) leshort 0x0002 ADPCM 161>>>>>>>>(92.l+188) leshort 0x0055 MPEG-1 Layer 3 162>>>>>>>>(92.l+188) leshort 0x2000 Dolby AC3 163>>>>>>>>(92.l+188) leshort 0x0161 DivX 164##>>>>>>>>(92.l+188) leshort x (0x%.4x) 165>>>>>>>>(92.l+190) leshort 1 (mono, 166>>>>>>>>(92.l+190) leshort 2 (stereo, 167>>>>>>>>(92.l+190) leshort >2 (%d channels, 168>>>>>>>>(92.l+192) lelong x %d Hz) 169# Animated Cursor format 170>8 string ACON \b, animated cursor 171# SoundFont 2 <mpruett@sgi.com> 172>8 string sfbk SoundFont/Bank 173# MPEG-1 wrapped in a RIFF, apparently 174>8 string CDXA \b, wrapped MPEG-1 (CDXA) 175>8 string 4XMV \b, 4X Movie file 176 177# 178# XXX - some of the below may only appear in little-endian form. 179# 180# Also "MV93" appears to be for one form of Macromedia Director 181# files, and "GDMF" appears to be another multimedia format. 182# 1830 string RIFX RIFF (big-endian) data 184# RIFF Palette format 185>8 string PAL \b, palette 186>>16 beshort x \b, version %d 187>>18 beshort x \b, %d entries 188# RIFF Device Independent Bitmap format 189>8 string RDIB \b, device-independent bitmap 190>>16 string BM 191>>>30 beshort 12 \b, OS/2 1.x format 192>>>>34 beshort x \b, %d x 193>>>>36 beshort x %d 194>>>30 beshort 64 \b, OS/2 2.x format 195>>>>34 beshort x \b, %d x 196>>>>36 beshort x %d 197>>>30 beshort 40 \b, Windows 3.x format 198>>>>34 belong x \b, %d x 199>>>>38 belong x %d x 200>>>>44 beshort x %d 201# RIFF MIDI format 202>8 string RMID \b, MIDI 203# RIFF Multimedia Movie File format 204>8 string RMMP \b, multimedia movie 205# Microsoft WAVE format (*.wav) 206>8 string WAVE \b, WAVE audio 207>>20 leshort 1 \b, Microsoft PCM 208>>>34 leshort >0 \b, %d bit 209>>22 beshort =1 \b, mono 210>>22 beshort =2 \b, stereo 211>>22 beshort >2 \b, %d channels 212>>24 belong >0 %d Hz 213# Corel Draw Picture 214>8 string CDRA \b, Corel Draw Picture 215# AVI == Audio Video Interleave 216>8 string AVI\040 \b, AVI 217# Animated Cursor format 218>8 string ACON \b, animated cursor 219# Notation Interchange File Format (big-endian only) 220>8 string NIFF \b, Notation Interchange File Format 221# SoundFont 2 <mpruett@sgi.com> 222>8 string sfbk SoundFont/Bank 223