John McGowan"s AVI Overview: Programming and Other Technical Topics
John McGowan"s AVI Overview: Programming and Other Technical Topics John McGowan's AVI Overview: Programming and Other Technical Topics
Windows Multimedia System
In Win16 and Win32, Microsoft created a partially unified system
for handling multimedia. This system consists of the high level
Media Control Interface or MCI Application Programming Interface (API)
and associated MCI drivers. Playback of AVI files can be controlled
through the high level MCI API and the MCIAVI.DRV MCI driver.
The Windows Multimedia System also provides a number of low level
API's such as the WAVE API for waveform audio and associated
device drivers such as the WAVE device drivers for sound cards.
Under Windows NT 4.0, the MCI and low level API's are stored in
the file WINMM.DLL
The API's are:
MCI (high level API - useful for AVI playback)
joy (joystick devices)
midi (MIDI devices)
mixer (MIXER devices)
wave (waveform audio input and output devices)
mmio (low level functions to parse RIFF files)
time (timers etc.)
aux (auxiliary sound device)
When a program loads the MCIAVI driver, the Multimedia
System has the intelligence to locate and invoke the
appropriate MCI driver (MCIAVI.DRV in 16-bit
Windows or MCIAVI32.DLL in 32 bit windows) and pass the MCI
commands such as MCI_PLAY to the MCI driver.
The MCIAVI driver then calls Video for Windows to decompress
the video, GDI (or another graphics API) to display the
decoded frames, and WAVE to output the decoded audio samples.
A dump of the functions exported by winmm.dll under NT 4.0
generated with the Microsoft DUMPBIN.EXE utility follows:
Microsoft (R) COFF Binary File Dumper Version 5.00.7022
Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
Dump of file winmm.dll
File Type: DLL
Section contains the following Exports for WINMM.dll
0 characteristics
31EC70B4 time date stamp Tue Jul 16 21:48:52 1996
0.00 version
2 ordinal base
197 number of functions
197 number of names
ordinal hint name
3 0 CloseDriver (000026CE)
4 1 DefDriverProc (00005AF4)
5 2 DriverCallback (0000254E)
6 3 DrvGetModuleHandle (00001D37)
7 4 GetDriverModuleHandle (00001D37)
8 5 MigrateAllDrivers (00013E79)
9 6 MigrateMidiUser (00013E60)
10 7 MigrateSoundEvents (00011A3C)
11 8 NotifyCallbackData (0000B2C2)
12 9 OpenDriver (00002036)
13 A PlaySound (00008ACB)
2 B PlaySoundA (00008ACB)
14 C PlaySoundW (00009AE1)
15 D SendDriverMessage (00001000)
16 E WOW32DriverCallback (0000C448)
17 F WOW32ResolveMultiMediaHandle (0000CC3C)
18 10 WOWAppExit (00009D3F)
19 11 aux32Message (0000C507)
20 12 auxGetDevCapsA (0000A3FD)
21 13 auxGetDevCapsW (00008C77)
22 14 auxGetNumDevs (00006AE4)
23 15 auxGetVolume (0000A4A1)
24 16 auxOutMessage (00008BFF)
25 17 auxSetVolume (0000A4C9)
26 18 joy32Message (0000C768)
27 19 joyConfigChanged (0000AE40)
28 1A joyGetDevCapsA (0000A99A)
29 1B joyGetDevCapsW (0000AB40)
30 1C joyGetNumDevs (0000AB96)
31 1D joyGetPos (0000ABAA)
32 1E joyGetPosEx (0000ABFD)
33 1F joyGetThreshold (0000AC5C)
34 20 joyReleaseCapture (0000ACA8)
35 21 joySetCapture (0000ACFC)
36 22 joySetThreshold (0000AE06)
37 23 mci32Message (00007566)
38 24 mciDriverNotify (00007006)
39 25 mciDriverYield (00008727)
40 26 mciExecute (0000D92C)
41 27 mciFreeCommandResource (000035CE)
42 28 mciGetCreatorTask (0000DCD5)
43 29 mciGetDeviceIDA (0000DCA3)
44 2A mciGetDeviceIDFromElementIDA (0000DBC6)
45 2B mciGetDeviceIDFromElementIDW (0000DBF5)
46 2C mciGetDeviceIDW (00005372)
47 2D mciGetDriverData (0000158B)
48 2E mciGetErrorStringA (0000DA46)
49 2F mciGetErrorStringW (0000352F)
50 30 mciGetYieldProc (0000E1F3)
51 31 mciLoadCommandResource (00002A75)
52 32 mciSendCommandA (000015D4)
53 33 mciSendCommandW (000014A1)
54 34 mciSendStringA (00004927)
55 35 mciSendStringW (00004A24)
56 36 mciSetDriverData (000058BD)
57 37 mciSetYieldProc (000034C9)
58 38 mid32Message (0000BDFD)
59 39 midiConnect (0001019E)
60 3A midiDisconnect (0001018C)
61 3B midiInAddBuffer (0001004A)
62 3C midiInClose (0000FF42)
63 3D midiInGetDevCapsA (0000FCCC)
64 3E midiInGetDevCapsW (0000FC71)
65 3F midiInGetErrorTextA (0000FDEB)
66 40 midiInGetErrorTextW (0000FDB2)
SetInfo (0000EBF4)
140 8A mmioStringToFOURCCA (0000ED9A)
(00008BC5)
Under Windows 3.x and Windows 95, the DLL MMSYSTEM.DLL (short for
MultiMedia System) contains the multimedia API's.
Return to Top
Video for Windows
Video for Windows is an entire system for handling video
in Microsoft Windows. It was part of MS Windows 3.1 The
original Video for Windows is a collection of 16 bit
windows utilities, dynamic link libraries, and other
components.
The AVI file and file format is a central part of Video
for Windows.
Microsoft Visual C++ 5.0 has a Video for Windows
include file Vfw.h which contains the various API's that
make up Video for Windows:
* COMPMAN - Installable Compression Manager.
* DRAWDIB - Routines for drawing to the display.
* VIDEO - Video Capture Driver Interface
*
* AVIFMT - AVI File Format structure definitions.
* MMREG - FOURCC and other things
*
* AVIFile - Interface for reading AVI Files and AVI Streams
* MCIWND - MCI/AVI window class
* AVICAP - AVI Capture Window class
*
* MSACM - Audio compression manager.
Microsoft released a Video for Windows 1.0 for
Windows 3.1 in November 1992, followed by Video for Windows 1.1. There
have been several versions of Video for Windows 1.1
identified by a trailing alphabetical character such as
1.1e The last and most recent version of Video for
Windows 1.1 for Windows 3.x is Video for Windows 1.1e
This is available by ftp from Microsoft.
Microsoft has provided a 32-bit version of Video for Windows
for Windows 95, while threatening to replace Video for Windows with
ActiveMovie. This version has 32 bit versions of the Video
for Windows codecs such as Cinepak. Other DLL's in the
Video for Windows 95 are also 32-bit How much of the Video for
Windows in Windows 95 is 32 bit code is not clear; many of the
codecs are clearly 32 bit codecs. Nor is it clear how much has been
changed or modified besides the convesion to 32-bit code.
Windows NT 3.5, 3.51 and Windows NT 4.0 include a Video for Windows for
NT. Presumably this is strictly 32-bit. It is not clear how
much code is shared between the NT Video for Windows and the
Windows 95 Video for Windows. Note that hardware device
drivers are different between Windows 95 and NT 3.5/3.51/4.0.
ActiveMovie 1.0 and DirectShow (formerly ActiveMovie 2.0) are
32-bit successors to Video for Windows for both Windows 95
and Windows NT. These support AVI files. ActiveMovie started
out life under the code name Quartz; early Beta releases of
ActiveMovie were known as Quartz.
ActiveMovie 1.0 is bundled with Windows 95b (OEM Service Release 2.x)
and Internet Explorer 3.x/4.x for Windows 95. It can also be downloaded
and installed in Windows 95 separately. Note that ActiveMovie 1.0
does NOT completely replace Video for Windows. For example, ActiveMovie
1.0 does not provide a video capture mechanism. Video capture still
uses Video for Windows capture drivers.
ActiveMovie 1.0 is a 32 bit software component that can run in NT's
user mode. It runs under Windows NT 4.0 as well as Windows 95.
DirectShow (ActiveMovie 2.0) will supposedly add a number of new
features including video capture support, kernel mode streaming, and
miscellaneous other features.
VIDEO FOR WINDOWS under WINDOWS NT 4.0
Under NT 4.0, Video for Windows is implemented as a collection of
32-bit DLL's in the Microsoft 32-bit Common Object File Format or COFF
format. These are usually located in the \WINNT\SYSTEM32 directory
where Windows NT stores most of the system DLL's, drivers, and so
forth.
MSVFW32.DLL ( Microsoft Video for Windows DLL - NT 4.0 )
AVIFIL32.DLL ( AVIFILE API for Reading and Writing AVI Files and Streams )
AVICAP32.DLL ( AVI Capture Window Class )
MCIAVI32.DLL ( Video for Windows MCI Driver )
MSACM32.DRV ( Microsoft Audio Compression Manager )
MSACM32.DLL ( more Microsoft Audio Compression Manager )
MSRLE32.DLL ( Microsoft RLE Video Codec )
IR32_32.DLL ( Intel Indeo 3.2 Video Codec )
MSVIDC32.DLL ( Microsoft Video 1 Codec )
ICCVID.DLL ( Cinepak for Windows 32 - Radius )
What is in MSVFW32.DLL?
MSVFW32.DLL includes the DRAWDIB, Installable Compression
Manager or ICM, and MCI Windows components of Video for
Windows. Other components are stored in other DLL's.
This is a dump of the functions exported by MSVFW32.DLL
Version 4.00
Microsoft (R) COFF Binary File Dumper Version 5.00.7022
Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
Dump of file msvfw32.dll
File Type: DLL
Section contains the following Exports for MSVFW32.dll
0 characteristics
31EC70E9 time date stamp Tue Jul 16 21:49:45 1996
0.00 version
2 ordinal base
47 number of functions
47 number of names
ordinal hint name
3 0 DrawDibBegin (00001E14)
4 1 DrawDibChangePalette (00008C30)
5 2 DrawDibClose (0000888A)
6 3 DrawDibDraw (000010A6)
7 4 DrawDibEnd (00008BEC)
8 5 DrawDibGetBuffer (00008EFC)
9 6 DrawDibGetPalette (00002F97)
10 7 DrawDibOpen (00003E0A)
11 8 DrawDibProfileDisplay (00003EBA)
12 9 DrawDibRealize (00001D49)
13 A DrawDibSetPalette (00001C0D)
14 B DrawDibStart (00002EEB)
15 C DrawDibStop (00002F42)
16 D DrawDibTime (00008C2B)
17 E GetOpenFileNamePreview (0000C7DC)
18 F GetOpenFileNamePreviewA (0000C7DC)
19 10 GetOpenFileNamePreviewW (0000C6A5)
20 11 GetSaveFileNamePreviewA (0000C7EC)
21 12 GetSaveFileNamePreviewW (0000C7CC)
22 13 ICClose (000035E0)
23 14 ICCompress (00004CE5)
24 15 ICCompressorChoose (00005F61)
25 16 ICCompressorFree (00005615)
26 17 ICDecompress (00004D4B)
27 18 ICDraw (0000106A)
28 19 ICDrawBegin (00001B95)
29 1A ICGetDisplayFormat (00004D8E)
30 1B ICGetInfo (00004C60)
31 1C ICImageCompress (00005A96)
32 1D ICImageDecompress (00005D2A)
33 1E ICInfo (00002FEB)
34 1F ICInstall (00004574)
35 20 ICLocate (0000372E)
36 21 ICMThunk32 (0000841C)
37 22 ICOpen (0000337C)
38 23 ICOpenFunction (00003B53)
39 24 ICRemove (0000488B)
40 25 ICSendMessage (00001000)
41 26 ICSeqCompressFrame (000059A7)
42 27 ICSeqCompressFrameEnd (00005907)
43 28 ICSeqCompressFrameStart (000056E4)
44 29 MCIWndCreate (0000C988)
45 2A MCIWndCreateA (0000C988)
46 2B MCIWndCreateW (0000C8CC)
47 2C MCIWndRegisterClass (0000C83F)
48 2D StretchDIB (00009D13)
2 2E VideoForWindowsVersion (000041D1)
Summary
8000 .data
3000 .rdata
2000 .reloc
3000 .rsrc
11000 .text
VIDEO FOR WINDOWS FOR WINDOWS 95
Microsoft distributed a new Video for Windows for Windows 95
while emphasizing Quartz/ActiveMovie/DirectShow in its
marketing.
Video for Windows 95 Files
MSRLE32.DLL (32-bit Microsoft RLE Video Codec)
IR32_32.DLL (32-bit Indeo 3.2 Video Codec)
ICCVID.DLL (32-bit Radius Cinepak Video Codec)
MSVIDC32.DLL (32-bit Microsoft Video 1 Video Codec )
MSVIDEO.DLL (16-bit Video for Windows DLL)
MCIAVI.DRV (16-bit AVI Video MCI Driver)
AVIFILE.DLL (16-bit AVIFILE)
AVICAP.DLL (16-bit AVICAP)
AVICAP32.DLL (32-bit AVICAP)
MSVFW32.DLL (32-bit Video for Windows DLL - with VfW API)
AVIFIL32.DLL (32-bit AVIFILE)
SUMMARY
Video for Windows 1.0 (Windows 3.x)
Video for Windows 1.1 (a-e) (Windows 3.x)
Video for Windows (Windows 95 - has 32-bit codecs and other 32-bit DLL's)
Video for Windows (Windows NT 3.5, 3.51, and 4.0)
Quartz (Betas of ActiveMovie) (Windows 95)
ActiveMovie 1.0 (Windows 95 and NT 4.0)
ActiveMovie 2.0 (DirectShow) (probably Windows 97/98/Memphis and NT 5.0)
Return to Top
WAVE
The Microsoft Windows audio (sound) input/output system, commonly
referred to as Wave or WAVE, predates Video for Windows, which is
wrapped around WAVE in various ways. The audio tracks in AVI files
are simply waveform audio (or WAV) data used by the wave system.
Video for Windows parses the AVI files, extracts the WAV data, and
pipes the WAV data to the WAVE system. Video for Windows handles the
video track if present.
Traditionally, audio input and output devices such as Sound Blaster
Cards have a WAVE audio input/output driver to play WAV (waveform
audio) files.
The simplest waveform audio files consists of a header followed by
Pulse Coded Modulation (PCM) sound data, usually uncompressed 8 or 16
bit sound samples. WAVE also provides a mechanism for audio codecs.
See elsewhere in the AVI Overview for further information on audio
codecs and audio compression.
WAVE is present in Windows 3.1 and Windows 95. A different WAVE
system is present in Windows NT 3.5, 3.51, and 4.0 At least the
hardware device drivers for sound cards must be different in NT.
ActiveMovie appears to be replacing WAVE.
Return to Top
What is the AVI File Format?
AVI Files are a special case of RIFF files. RIFF is
the Resource Interchange File Format. This is a general
purpose format for exchanging multimedia data types
that was defined by Microsoft and IBM during their
long forgotten alliance.
Kevin McKinnon writes:
In fact, RIFF is a clone of the IFF format invented by Electronic Arts in
1984. They invented the format for Deluxe Paint on the Amiga, and IFF
quickly became the standard for interchange on that platform,
maintained eventually by Commodore right up 'til it's demise. EA also
ported Deluxe Paint to the PC platform and brought IFF with it.
IFF even used the 4-character headers (FourCC), though at the time it was
simply called a LONGWORD that some clever people decided to pair into
four charcter because they looked good in #define's. ;)
RIFF is so close to IFF that the good IFF parser routines will (mostly)
correctly parse RIFF files.
----End of Kevin----
Further information on the IFF format is available at:
http://www.ipahome.com/gff/textonly/summary/iff.htm
RIFF Files
RIFF files are built from
(1) RIFF Form Header
'RIFF' (4 byte file size) 'xxxx' (data)
where 'xxxx' identifies the specialization (or form)
of RIFF. 'AVI ' for AVI files.
where the data is the rest of the file. The
data is comprised of chunks and lists. Chunks
and lists are defined immediately below.
(2) A Chunk
(4 byte identifier) (4 byte chunk size) (data)
The 4 byte identifier is a human readable sequence
of four characters such as 'JUNK' or 'idx1'
(3) A List
'LIST' (4 byte list size) (4 byte list identifier) (data)
where the 4 byte identifier is a human readable
sequence of four characters such as 'rec ' or
'movi'
where the data is comprised of LISTS or CHUNKS.
AVI File Format
AVI is a specialization or "form" of RIFF, described below:
'RIFF' (4 byte file length) 'AVI ' // file header (a RIFF form)
'LIST' (4 byte list length) 'hdrl' // list of headers for AVI file
The 'hdrl' list contains:
'avih' (4 byte chunk size) (data) // the AVI header (a chunk)
'strl' lists of stream headers for each stream (audio, video, etc.) in
the AVI file. An AVI file can contain zero or one video stream and
zero, one, or many audio streams. For an AVI file with one video and
one audio stream:
'LIST' (4 byte list length) 'strl' // video stream list (a list)
The video 'strl' list contains:
'strh' (4 byte chunk size) (data) // video stream header (a chunk)
'strf' (4 byte chunk size) (data) // video stream format (a chunk)
'LIST' (4 byte list length) 'strl' // audio stream list (a list)
The audio 'strl' list contains:
'strh' (4 byte chunk size) (data) // audio stream header (a chunk)
'strf' (4 byte chunk size) (data) // audio stream format (a chunk)
'JUNK' (4 byte chunk size) (data - usually all zeros) // an OPTIONAL junk chunk to align on 2K byte boundary
'LIST' (4 byte list length) 'movi' // list of movie data (a list)
The 'movi' list contains the actual audio and video data.
This 'movi' list contains one or more ...
'LIST' (4 byte list length) 'rec ' // list of movie records (a list)
'##wb' (4 byte chunk size) (data) // sound data (a chunk)
'##dc' (4 byte chunk size) (data) // video data (a chunk)
'##db' (4 byte chunk size) (data) // video data (a chunk)
A 'rec ' list (a record) contains the audio and video data for a single frame.
'##wb' (4 byte chunk size) (data) // sound data (a chunk)
'##dc' (4 byte chunk size) (data) // video data (a chunk)
'##db' (4 byte chunk size) (data) // video data (a chunk)
The 'rec ' list may not be used for AVI files with only audio or only
video data. I have seen video only uncompressed AVI files that did
not use the 'rec ' list, only '00db' chunks. The 'rec ' list is used
for AVI files with interleaved audio and video streams. The 'rec '
list may be used for AVI file with only video.
## in '##dc' refers to the stream number. For example, video data chunks
belonging to stream 0 would use the identifier '00dc'. A chunk of
video data contains a single video frame.
Alexander Grigoriev writes ...
John,
##dc chunk was intended to keep compressed data, whereas ##db chunk
nad(sic) to be used for uncompressed DIBs (device independent bitmap),
but actually they both can contain compressed data. For example,
Microsoft VidCap (more precisely, video capture window class) writes
MJPEG compressed data in ##db chunks, whereas Adobe Premiere writes
frames compressed with the same MJPEG codec as ##dc chunks.
----End of Alexander
The ##wb chunks contain the audio data.
The audio and video chunks in an AVI file do not contain
time stamps or frame counts. The data is ordered in time sequentially as
it appears in the AVI file. A player application should display the
video frames at the frame rate indicated in the headers. The
application should play the audio at the audio sample rate indicated
in the headers. Usually, the streams are all assumed to start at
time zero since there are no explicit time stamps in the AVI file.
The lack of time stamps is a weakness of the original AVI file
format. The OpenDML AVI Extensions add new chunks with time
stamps. Microsoft's ASF (Advanced or Active Streaming Format), which
Microsoft claims will replace AVI, has time stamp "objects".
In principle, a video chunk contains a single frame of video. By
design, the video chunk should be interleaved with an audio chunk
containing the audio associated with that video frame. The data
consists of pairs of video and audio chunks. These pairs may be
encapsulated in a 'REC ' list. Not all AVI files obey this simple
scheme. There are even AVI files with all the video followed by all
of the audio; this is not the way an AVI file should be made.
The 'movi' list may be followed by:
'idx1' (4 byte chunk size) (index data) // an optional index into movie (a chunk)
The optional index contains a table of memory offsets to each
chunk within the 'movi' list. The 'idx1' index supports rapid
seeking to frames within the video file.
The 'avih' (AVI Header) chunk contains the following information:
Total Frames (for example, 1500 frames in an AVI)
Streams (for example, 2 for audio and video together)
InitialFrames
MaxBytes
BufferSize
Microseconds Per Frame
Frames Per Second (for example, 15 fps)
Size (for example 320x240 pixels)
Flags
The 'strh' (Stream Header) chunk contains the following information:
Stream Type (for example, 'vids' for video 'auds' for audio)
Stream Handler (for example, 'cvid' for Cinepak)
Samples Per Second (for example 15 frames per second for video)
Priority
InitialFrames
Start
Length (for example, 1500 frames for video)
Length (sec) (for example 100 seconds for video)
Flags
BufferSize
Quality
SampleSize
For video, the 'strf' (Stream Format) chunk contains the following
information:
Size (for example 320x240 pixels)
Bit Depth (for example 24 bit color)
Colors Used (for example 236 for palettized color)
Compression (for example 'cvid' for Cinepak)
For audio, the 'strf' (Stream Format) chunk contains the following
information:
wFormatTag (for example, WAVE_FORMAT_PCM)
Number of Channels (for example 2 for stereo sound)
Samples Per Second (for example 11025)
Average Bytes Per Second (for example 11025 for 8 bit sound)
nBlockAlign
Bits Per Sample (for example 8 or 16 bits)
Each 'rec ' list contains the sound data and video data for a single
frame in the sound data chunk and the video data chunk.
Other chunks are allowed within the AVI file. For example, I have
seen info lists such as
'LIST' (4 byte list size) 'INFO' (chunks with information on video)
These chunks that are not part of the AVI standard are simply
ignored by the AVI parser. AVI can be and has been extended by adding
lists and chunks not in the standard. The 'INFO' list is a registered
global form type (across all RIFF files) to store information that
helps identify the contents of a chunk.
The sound data is typically 8 or 16 bit PCM, stereo or mono,
sampled at 11, 22, or 44.1 KHz. Traditionally, the sound has
typically been uncompressed Windows PCM. With the advent of
the WorldWide Web and the severe bandwidth limitations of the
Internet, there has been increasing use of audio codecs. The
wFormatTag field in the audio 'strf' (Stream Format) chunk
identifies the audio format and codec.
OpenDML AVI File Format Extensions
The Open Digital Media (OpenDML) Consortium has defined an OpenDML
AVI File Format Extensions which extend AVI to support a variety of
features required for professional video production. These include
support for fields (not just frames), file sizes larger than 1 GB,
timecodes, and many other features. Microsoft has reportedly
incorporated OpenDML AVI support in DirectShow 5.1 (ActiveMovie 5.1).
It is also used by various professional video applications for the PC,
in particular Matrox's DigiSuite software.
The Open Digital Media Consortium AVI File Format Extensions
add new lists and chunks to the AVI file which contain extra
data such as timecodes not incorporated in the original AVI
standard.
OpenDML appears to have been spearheaded by Matrox to improve AVI
for professional video authoring and editing. Matrox makes a variety
of PC video products such as DigiSuite for professional and broadcast
video authoring and editing. The OpenDML AVI File Format Extensions
are primarily for the Motion JPEG AVI files used for professional
video authoring and editing. The OpenDML effort seems to have been
pushed to one side with the advent of ActiveMovie, NetShow, Advanced
(formerly Active) Streaming Format (ASF) Files, and other Microsoft
initiatives.
On Oct. 2, 1997, the OpenDML AVI File Format Extensions Version 1.02
specification document (dated February 28, 1996) was available at
the Matrox Electronic Systems, Ltd. Web site at:
http://www.matrox.com/videoweb/odmlff2.htm
The specification is in Adobe Portable Document Format (PDF). Since
Matrox seems to rearrange their site from time to time and one can't
always find the specification, I've included a link to a copy of the PDF
version of the specification on my Web site.
PDF OpenDML AVI File Format Extensions Specification Document
Get Adobe Acrobat Reader (PDF Viewer)
Where to get the exact AVI specification?
Microsoft Visual C++ 5.0 has a Video for Windows include
file Vfw.h which gives the exact AVI data structures such as
the various headers used in AVI files. The file also has
comments explaining the structure of the AVI file.
Video for Windows refers to the AVI Format by the mnemonic
AVIFMT. At one time, the format information was apparently
stored in an AVIFMT.H header file. The format
information now appears consolidated in Vfw.h
In addition to the Video for Windows header files, Chapter Four of the
Video for Windows Programmer's Guide, "AVI Files", gives a detailed
specification of the AVI file format.
Return to Top
AVI and Windows Bitmaps (DDB, DIB, ...)
Microsoft Windows represents bitmapped images internally and in files
as Device Dependent Bitmaps (DDB), Device Independent Bitmaps (DIB), and
DIB Sections. Uncompressed 'DIB ' AVI files represent video frames as
DIB's. Various multimedia API's that work with AVI use Windows
bitmapped images.
Prior to Windows 3.0, Windows relied on Device Dependent Bitmaps for
bitmapped images. A DDB is stored in a format understood by the
device driver for a particular video card. As the name suggests, DDB's
are not generally portable.
The structure of a DDB is:
typedef struct tagBITMAP { // bm
LONG bmType; /* always zero */
LONG bmWidth; /* width in pixels */
LONG bmHeight; /* height in pixels */
LONG bmWidthBytes; /* bytes per line of data */
WORD bmPlanes; /* number of color planes */
WORD bmBitsPixel; /* bits per pixel */
LPVOID bmBits; /* pointer to the bitmap pixel data */
} BITMAP;
Usually the pixel data immediately follows the BITMAP header.
(BITMAP header)(Pixel Data)
The HBITMAP handles used by GDI are handles to Device Dependent Bitmaps.
The GDI function BitBlt and StretchBlt are actually using Device
Dependent Bitmaps.
With Windows 3.0, Microsoft introduced the Device Independent Bitmap or
DIB, the reigning workhorse of bitmapped images under Windows. The DIB
provided a device independent way to represent bitmapped images, both
monochrome and color.
Windows retains DDB's despite the introduction of the DIB. For
example, to use a DIB, you might call:
hBitmap = CreateDIBitmap(...)
CreateDIBitmap creats a DDB from a DIB, returning the GDI HBITMAP
handle of the DDB for further GDI calls. At a low level, Windows
and GDI are still using DDB's.
The DIB files have a standard header that identifies the format, size,
color palette (if applicable) of the bitmapped image. The header
is a BITMAPINFO structure.
typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
The BITMAPINFOHEADER is a structure of the form:
typedef struct tagBITMAPINFOHEADER{ // bmih
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount
DWORD biCompression; /* a DIB can be compressed using run length encoding */
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
bmiColors[1] is the first entry in an optional color palette or color
table of RGBQUAD data structures. True color (24 bit RGB) images
do not need a color table. 4 and 8 bit color images use a color table.
typedef struct tagRGBQUAD { // rgbq
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved; /* always zero */
} RGBQUAD;
A DIB consists of
(BITMAPINFOHEADER)(optional color table of RGBQUAD's)(data for the
bitmapped image)
A Windows .BMP file is a DIB stored in a disk file. .BMP files prepend
a BITMAPFILEHEADER to the DIB data structure.
typedef struct tagBITMAPFILEHEADER { // bmfh
WORD bfType; /* always 'BM' */
DWORD bfSize; /* size of bitmap file in bytes */
WORD bfReserved1; /* always 0 */
WORD bfReserved2; /* always 0 */
DWORD bfOffBits; /* offset to data for bitmap */
} BITMAPFILEHEADER;
Structure of Data in a .BMP File
(BITMAPFILEHEADER)(BITMAPINFOHEADER)(RGBQUAD color table)(Pixel Data)
The Win32 API documentation from Microsoft provides extensive
information on the data structures in a DIB.
In Windows 95 and Windows NT, Microsoft added the DIBSection to
provide a more efficient way to use DIB's in programs. The DIBSection
was originally introduced in Windows NT to reduce the number of
memory copies during blitting (display) of a DIB.
Return to Top
ActiveMovie
Active Movie is a new multimedia architecture for Windows 95 and
Windows NT (4.0 and after). ActiveMovie includes support for
playing AVI, QuickTime (.MOV), and MPEG files. ActiveMovie is
apparently intended to supersede Video for Windows.
ActiveMovie 1.0 ships with the OEM Service Release 2 (OSR2) of Windows 95.
It did not ship with prior releases of Windows 95 but was available
separately through the ActiveMovie SDK.
ActiveMovie 1.0 is also bundled with Microsoft's Internet Explorer for
Windows 95 and NT 4.0 Internet Explorer can be downloaded from the
Microsoft Web site at:
http://www.microsoft.com/ie/
Active Movie 1.0 can be downloaded by itself from the Microsoft Internet
Explorer site. (6/6/97)
ActiveMovie 1.0 appears to be a 32 bit software component that runs
under both Windows 95 and Windows NT 4.0 user mode.
ActiveMovie provides at least three different programming
interfaces:
- The ActiveMovie ActiveX Control
- ActiveMovie Component Object Model (COM) interfaces
- The OM-1 MPEG MCI (Media Control Interface) command set
Amongst other things, the ActiveMovie ActiveX Control can be embedded
in HTML Web pages and programmed via VBScript or JavaScript. It can also
be programmed using Visual C++ or Visual Basic as part of applications.
The ActiveMovie COM interaces can be accessed through Visual C++ or
Visual Basic.
ActiveMovie supports a subset of the Media Control Interface (MCI)
commands familiar to Video for Windows programmers. These commands can
be accessed through the mciSendCommand(...) and mciSendString(...)
functions in C/C++.
ActiveMovie 1.0 does NOT provide video capture. Windows 95 with
ActiveMovie 1.0 continues to use the Video for Windows video capture system
and drivers.
ActiveMovie 2.0 (renamed DirectShow in 1997) will provide a new,
alternative mechanism for video capture. According to information
distributed by Microsoft at the WDM Device Driver Conference in April,
1997, ActiveMovie 2.0 will use the WDM Stream Class under Memphis
(formerly Windows 97) and Windows NT 5.0 to implement video capture.
This is subject to possible change since neither Memphis nor NT 5.0
has been released (7/27/97).
Extensive information on ActiveX and ActiveMovie is available at the
Microsoft Web site.
ActiveMovie 1.0 SDK Documentation at (6/28/97):
http://www.microsoft.com/devonly/tech/amo
v1doc/
Return to Top
GUID's and AVI
GUID stands for Global Unique IDentifier.
In Microsoft's Component Object Model (COM) morass, an object oriented
programming model that incorporates MFC (Microsoft Foundation
Classes), OLE (Object Linking Embedding), ActiveX, ActiveMovie and
everything else Microsoft is hawking lately, a GUID is a 16 byte or
128 bit number used to uniquely identify objects, data formats,
everything.
Within ActiveMovie, there are GUID's for video formats, corresponding
to the FOURCC's or Four Character Codes used in Video for Windows.
These are specified in the file uuids.h in the Active Movie Software
Developer Kit (SDK). ActiveMovie needs to pass around GUID's that
correspond to the FOURCC for the video in an AVI file.
With proper programming, this should be hidden from end users but
ActiveMovie programmers need to know about GUID's.
Return to Top
What are the GUIDs for the Video for Windows Codecs?
Video for Windows codecs are identified by a thirty-two bit Four
Character Code (FOURCC). A Four Character Code is a thirty-two bit
value formed from the ASCII codes for four characters. Typically, the
four characters are a memnonic for the item identified. For example,
the popular Cinepak video codec is 'CVID'.
Microsoft has introduced 128-bit (16 byte) Globally Unique
Identifiers (GUIDs) for identifying everything in the
Microsoft Universe. Microsoft has established a mapping
procedure from the human readable Four Character Codes to
GUIDs for video codecs. Replace the "x"'s in the GUID
below with the 32-bit value built from the Four Character
Code. The Four Character Code is in 7-bit ASCII.
xxxxxxxx-0000-0010-8000-00AA00389B71
For example, the GUID for Radius Cinepak is:
44495643-0000-0010-8000-00AA00389B71
44 is the hexadecimal (base 16) ASCII code for 'D'
49 is the hexadecimal (base 16) ASCII code for 'I'
56 is the hexadecimal (base 16) ASCII code for 'V'
43 is the hexadecimal (base 16) ASCII code for 'C'
Note that the order of the characters is reversed from
naive expectation.
Return to Top
DirectShow
DirectShow is Microsoft's new name for ActiveMovie 2.0 Microsoft
has shifted to marketing ActiveMovie as an integral part of
DirectX.
Apparently DirectShow (ActiveMovie 2.0) will be released to the general
public as part of Direct X 5.0.
Return to Top
DirectDraw
DirectDraw, one of the components of DirectX, is a new Applications
Programming Interface (API) that is part of Windows 95 and Windows NT
4.0. DirectDraw allows programs to directly access video memory and
other hardware features in video display cards. Direct Draw also
defines new device drivers for graphic/video display adapters to
supersede the GDI display drivers. DirectDraw needs the new
device drivers.
DirectDraw consists of a new API and new hardware drivers known as
the Direct Draw Hardware Abstraction Layer (HAL).
In the Windows 3.1 Graphic Device Interface (GDI), an application
program never writes directly to the memory in a display card. It
writes to a buffer in main memory within Windows. GDI invokes a GDI
video device driver and copies the image from main memory to the video
memory of the video card. This multiple copying of the image
inevitably slows down the display.
The DirectDraw API provides a mechanism allowing appliation programs
to write directly into the video card's memory. It also provides a
mechanism to access various special features in video cards such as
color space conversion, hardware scaling, z-buffering, alpha blending,
and so forth.
Video card manufacturers must provide a DirectDraw driver for DirectDraw
to work with their card.
Microsoft's ActiveMovie uses DirectDraw to achieve faster playback of
AVI, QuickTime, and MPEG files.
There is extensive information on the DirectDraw and DirectX API's at the
Microsoft Web site.
The DirectX 3 SDK can be downloaded from the Microsoft Developer
Online Web site (6/28/97):
http://www.microsoft.com/msdn/
Select Microsoft SDKs from the Technical Information section, or point
your browser at:
http://www.microsoft.com/msdn/sdk/
Versions of DirectX
- DirectX 1
- DirectX 2
- DirectX 3
- DirectX 3A (latest as of 2/18/97)
- DirectX 5.0 (in development?)
- DirectX 6.0 (mentioned occasionally by Microsoft)
Return to Top
What is a driver?
Most often, driver refers to a software component that handles
control and communication with hardware in a computer. Most
but not all hardware device drivers run in a privileged mode
such as the Ring Zero mode of the Intel 80x86 processors.
Microsoft Windows uses the term driver to refer to several different
software components.
- Hardware Device Drivers
- Windows 3.x or 95 Virtual Device Drivers (VxD's)
- not all VxD's access hardware
- Microsoft Windows Installable Drivers
such as
- Media Control Interface or MCI Drivers
- Video for Windows Codecs (Compressor/Decompressors)
- Audio Codecs (Compressor/Decompressors)
Hardware Device Drivers include MS-DOS device drivers, DOS Terminate
and Stay Resident Programs that access hardware, Windows 3.x and 95
VxD's (Virtual Device Drivers) that access hardware, Windows DLL's
that access hardware but do not run in Ring Zero, Windows NT
kernel-mode device drivers, and the new Win32 Driver Model (WDM) drivers
for Memphis/Windows 98 and NT 5.0
Microsoft Windows Installable Drivers are Ring Three (Windows 95) or
user-mode (Windows NT) Dynamic Link Libraries (DLL's) with a single
entry point DriverProc(). MCI drivers, Video for Windows Codecs,
Microsoft Audio Compression Manager Codecs, and a variety of other
software components are Installable Drivers. Some installable
drivers are hardware drivers.
Return to Top
GDI Device Drivers
In Windows 3.1, and to a lesser extent Windows 95, the Graphic Device
Interface or GDI is the system that handles graphic display, including
putting bitmaps on the display monitor. Amongst other things, GDI
defines a set of GDI functions that application programs call such as
BitBlt(...) to display graphics on the screen. GDI also controls
printers and other graphic output devices.
Windows NT also provides a GDI system, but the underlying hardware
device drivers are different. Windows 3.1 GDI drivers won't work
under NT. Application programs written using the GDI API will usually
work under NT.
GDI is device independent. To achieve this, GDI uses GDI device
drivers loaded dynamically as needed.
The most commonly used GDI device driver is the DISPLAY device (for
display monitors). In Windows 3.1, this is specified by lines such
as:
display.drv=SUPERVGA.DRV
in the SYSTEM.INI file. SUPERVGA.DRV is a generic super vga graphic
display adapter driver shipped with Windows 3.1 SUPERVGA.DRV is a GDI
Device Driver
The printer driver is another common GDI device driver.
In Windows 3.1 or Windows 95 without DirectDraw, GDI handles display
of video frames on the display monitor.
GDI defines a set of standard functions exported by GDI Device
Drivers. A GDI Device Driver can also report that it does not support
a particular function.
Standard Functions for GDI Device Driver
Entry Name Description
01 BitBlt Transfer bits from src (source) to dest (destination) rect (rectangle)
02 ColorInfo Converts between logical and physical colors.
.
.
.
30 BitmapBits Sets, retrieves, copies bitmap data.
Video card manufacturers write and provide GDI Device Drivers for video cards.
When Video for Windows plays an AVI file, Video for Windows usually
uses the Media Control Interface (MCI) driver for AVI files
(MCIAVI.DRV). The MCI driver will call GDI to display each decoded
frame of video and WAVE to output the decoded audio to the sound card.
In Windows 95 or NT 4.0, ActiveMovie 1.0 has "renderers" which can
invoke GDI or DirectDraw depending on the situation to display the
decoded video frames. There are also audio renderers to output the
decoded audio from an AVI, QuickTime, or MPEG file.
Return to Top
Direct Draw Hardware Abstraction Layer
DirectDraw is a replacement for GDI for Windows 95 and
Windows NT 4.0. See elsewhere in this overview for sections on
GDI and DirectDraw.
The Direct Draw Hardware Abstraction Layer (HAL) defines
Direct Draw device drivers for graphics/video display
adapters. Graphics and video card manufacturers
provide DirectDraw device drivers. For Direct Draw
to work it must have these device drivers.
DirectDraw also defines a DirectDraw Applications Programming
Interface (API), a standard set of function calls invoked by
applications. The DirectDraw API in turn calls the Direct
Draw HAL to access the graphics/video display adapter.
ActiveMovie can invoke DirectDraw for video output under
Windows 95 and Windows NT 4.0.
Return to Top
Virtual Device Drivers
In Windows 3.x and Windows 95, Virtual Device Drivers or VXD's are
usually the hardware device drivers. They run in a privileged mode of
the Intel 80x86 processor known as Ring Zero. Video display adapters
and video capture cards usually have an associated VXD written by the
card or chip manufacturer.
Note that some Windows device drivers are implemented as Dynamic Link
Libraries (DLL's) that do not run in the privileged, Ring Zero, mode
of the 80x86 processor or as MS-DOS programs that access hardware.
These device drivers are not VXD's. There are some things that only
VXD's can do. Most PC hardware, especially with high bandwidth
requirements, use VXD's.
Device drivers for video display adapters are rarely a single VXD.
Often the Device Driver Interface (DDI) is implemented as a Dynamic
Link Library which does not run at Ring Zero. Only parts of the
device driver that need to run at Ring Zero are in the VXD.
A full video display device driver is often built of several
files, frequently including one or more VXDs.
VXD's are usually found in the \WINDOWS\SYSTEM directory.
VXD's will not work for hardware under Windows NT 3.51 or NT 4.0
Windows NT has its own Windows NT Driver Model for device drivers.
In "Memphis", formerly Windows 97, and NT 5.0, Microsoft is attempting
to provide a common driver model known as WDM or Win32 Driver Model so
that the same drivers can be used in both Memphis and NT.
Return to Top
Windows NT Driver Model
Windows NT (3.51, 4.0) has its own system of hardware device
drivers. While NT can often run Windows 3.x and Windows 95
applications, NT cannot use Windows 3.x or Windows 95
device drivers (the Virtual Device Drivers or VxD's).
For most people working with AVI, or video in general, the main
point to remember is that different drivers are needed for
NT than Windows 95 (or Windows 3.x). Most hardware manufacturers
provide both Windows 3.x, 95, and NT drivers.
TOOLS
Programmers will need the Windows NT DDK (Device Driver Kit)
to develop Windows NT drivers. This is available in a
subscription to Microsoft Developer Network (Professional).
http://www.microsoft.com/msdn/
Return to Top
Win32 Driver Model (WDM)
The Win32 Driver Model (WDM) is a new device driver system for
Memphis (formerly Windows 97) and Windows NT 5.0 The notion is that
the same device drivers will work under both Memphis and NT 5.0
WDM is largely the Windows NT Driver Model used in NT 3.51 and 4.0
It is still under development. Video display card and video capture
card companies will presumably be providing WDM drivers for
Memphis and NT 5.0 in the future.
Memphis is supposed to be backward compatible so that
Windows 95 Device Drivers will still work under Memphis.
Similarly, NT 4.0 Device Drivers will still work under
NT 5.0 A WDM Device Driver will work under both Memphis and
NT 5.0.
Return to Top
MMX
MMX or Multimedia Extensions to the Pentium instruction set are
57 new instructions that accelerate some graphics, imaging, and
multimedia operations. Multimedia often involves small data types
such as 8 bit or 16 bit pixels that can be processed in parallel.
For example, in principle, a 32 bit instruction could operate of
four 8 bit pixels in parallel.
A simple example would be adding four 8 bit pixels in parallel.
The MMX instructions add clipping for underflow and overflow
situations.
255 0 0 255 Normal addition of four 8 bit pixels backed in 32 bits
+ 0 0 0 255
-------------
255 0 1 0
255 0 0 255 MMX style clipping of overflow
+ 0 0 0 255
--------------
255 0 0 255
Intel developed the MMX instructions and added them to recent
versions of the Pentium chip known as the P55C or Pentium with MMX.
The MMX instructions were also added to the Pentium Pro. The Pentium
Pro with MMX was code named Klamath, but called the Pentium II when
actually shipped in 1997.
MMX can accelerate various graphics and multimedia operations. It can
accelerate video codecs. In particular, the block Discrete Cosine
Transform used in JPEG, Motion JPEG, H.261, H.263, H.263+, MPEG-4,
MPEG-1, and MPEG-2 can be accelerated using MMX instructions.
Initially compilers have not supported generation of MMX instructions, so
critical portions of the multimedia algorithms must be hand-coded in
Pentium assembler using the MMX instructions.
An MMX version of a codec may be able to encode and decode an AVI
file (for example) faster on a PC with MMX.
DOCUMENTATION ON MMX
Further information on MMX is available at the Intel Web site for
developers:
http://developer.intel.com/sites/developer
Click on the Literature Center link, then select "Pentium Processor
with MMX" from the pull down list of products.
This information is dated August 1, 1997. The Intel Web site changes
from time to time.
In addition to various on-line documentation at the Web site, Intel
has some manuals on MMX:
Intel Architecture MMX Technology Developers Manual (Order No. 243013)
Intel Architecture MMX Technology Programmer's Reference Manual
(Order No. 243007)
TOOLS FOR WORKING WITH MMX
Intel provides an MMX Technology Macro Package for use with
the Microsoft Macro Assembler (MASM). This can be downloaded from:
http://developer.intel.com/design/perftool/mmx1mac/
Intel markets an Intel C/C++ compiler plug-in for Microsoft
Visual C/C++ 4.x/5.0. This plug-in includes "special
compiler intrinsics" to support MMX. These allow a programmer
to use the call syntax of C functions instead of manually
coding in assembly language.
Example of an "intrinsic"
__m64 _m_pmaddwd(__m64 m1, __m64 m2)
http://developer.intel.com/design/perftool/icl24/
The Intel C/C++ compiler plug-in is available on the VTune
CD-ROM. VTune is discussed below.
Intel markets a product called the VTune (TM) Performance Analyzer for
profiling programs on the Intel architecture at the machine
instruction level. VTune includes support for the MMX instructions
and has been used to profile and optimize MMX code. The VTune CD-ROM
includes a number of other Intel freebies and products such as the
Intel C/C++ compiler plug-in that may be useful developing MMX
software.
http://developer.intel.com/design/perftool/vtune/
Return to Top
ActiveX
NOTE: ActiveX is NOT ActiveMovie. There is an ActiveMovie ActiveX
control, but ActiveX is far more than this.
ActiveX is a stripped down version of OLE (Object Linking and
Embedding) targetted for the World Wide Web. An ActiveX component or
control is a software component written in Visual Basic, Visual C++, or
Java that conforms to the ActiveX API. This API is a variant of
OLE, designed to create small objects that can be dowloaded over the
Internet.
An ActiveX object or control may reside on a Web page to be downloaded
and run when Microsoft's Internet Explorer views the page. An ActiveX
control can be the ActiveMovie ActiveX control which plays AVI and other
video formats supported by ActiveMovie. An ActiveX control can be an
entertaining animation, a game like tic tac toe, anything. In this
sense, ActiveX objects are similar to Java applets.
Unlike Java applets, once an ActiveX control has been downloaded once
it remains on the downloading machine and can be used again without
being dowloaded again.
Also unlike Java, ActiveX controls are tied to a particular
architecture, Windows 95 or Windows NT. It is not clear how much
support Microsoft will give for ActiveX on non-Windows platforms.
Java applets are compiled to a Java bytecode that will run on any
platform with a Java virtual machine implemented. Java applets will
run on Windows 3.1, Windows 95, Windows NT, PowerMacintosh, Linux,
Sun, and various other Unix platforms.
There is extensive information on ActiveX at the Microsoft Web site.
The ActiveX SDKs can be downloaded from the Microsoft Developer Online
Web Site (6/28/97):
http://www.microsoft.com/msdn/
Select Microsoft SDKs from the Technical Information section or point your
browser at:
http://www.microsoft.com/msdn/sdk/
Netscape Fans:
ScriptActive is a Netscape Plug-In that adds support for ActiveX to
Netscape.
ScriptActive Web Site
Return to Top
Playing an AVI File within a Windows Application
Programmers can play an AVI File within a Windows application by
several means. The simplest traditional way is to use the
Media Control Interface (MCI). Video for Windows includes an
MCI driver mciavi.drv for AVI files.
Within the Windows API, programmers can use two C language API
functions, mciSendString(...) and mciSendCommand(...), to communicate with
the MCI driver. mciSendString(...) sends MCI command strings such as
"play from 0 to 100" to the MCI driver. mciSendCommand(...) sends MCI
command messages, a straight C type interface, to the MCI driver.
The syntax for mciSendString is:
MCIERROR mciSendString(LPCTSTR lpszCommand, LPTSTR lpszReturnString,
UINT cchReturn, HANDLE hwndCallback);
The pointer lpszCommand points to the MCI command string such as
"play from 0 to 100". Consult the Microsoft SDK documentation for
more details.
The syntax for mciSendCommand is:
MCIERROR mciSendCommand(MCIDEVICEID IDDevice, UINT uMsg,
DWORD fdwCommand, DWORD dwParam);
where uMsg is an MCI command message such as MCI_PLAY defined in an
include file. Consult the Microsoft SDK documentation for more
details on MCI command messages.
mciSendString(...) and mciSendCommand(...) are essentially equivalent.
The MCI driver should convert the MCI command string to an MCI command
message internally. The MCI command strings provide a more English like
interface to MCI.
For C++ programmers, Microsoft provides a window class MCIWnd to wrap
the MCI operations. Quoting the Microsoft SDK documentation:
Microsoft sayeth....
MCIWnd is a window class for controlling multimedia devices. A library
of functions, messages, and macros associated with MCIWnd provides a
simple method to add multimedia playback or recording capabilities to
your applications.
Using a single function, your application can create a control that
plays devices such as video, CD audio, waveform audio, MIDI (Musical
Instrument Digital Interface), or any device that uses the Media
Control Interface (MCI). Automating playback is also quick and
easy. Using a function and two macros, an application can create an
MCIWnd window with the appropriate media device, play the device, and
close both the device and the window when the content has finished
playing.
... end Microsoft sayeth.
Consult the Microsoft documentation for more details on MCIWnd.
ActiveMovie appears intended to supersede MCI. ActiveMovie includes
a restricted subset of MCI for (partial) backward compatibility.
However, Microsoft appears to want developers to switch over to
new API's such as ActiveX and ActiveMovie, built on top of Microsoft's
Component Object Model (COM) object oriented framework.
Return to Top
Reading and Writing an AVI file within a Windows Application
The Microsoft Windows Win32 SDK (Windows NT and Windows 95) includes a
set of functions and macros known as AVIFile for reading, writing, and
manipulating RIFF files including AVI files within a Windows program.
These functions are contained within a Dynamic Link Library
avifile.dll.
The AVIFile functions include:
AVIFileInit(...)
AVIFileOpen(...)
AVIFileReadData(...)
AVIFileWriteData(...)
AVIFileExit(...)
and many many others. Consult Microsoft documentation for details.
Return to Top
Where to get C Source Code for AVI Player Including Many Codecs
Marc Podlipec's Xanim is a free AVI Player for X Windows and Unix.
Most of Xanim is available in source code format. The Xanim home
page is:
http://xanim.va.pubnix.com/
Unfortunately, Xanim's Cinepak and Indeo support is only available in
object module (binary format).
Return to Top
Where to get Detailed Information on Graphics File Formats
Programmers often need to know the details of the many
graphics file formats, both still image and moving.
There are a number of Web sites, books, and other resources
that provide detailed information on the many still image and
video/animation graphics file formats.
Wotsit's File Format Collection
http://wotsit.simsware.com/
and
http://www.ipahome.com/gff/textonly/summary/
Return to Top
Where to get Detailed Information on Audio File Formats
On the Internet, Guido Van Rossum distributes an Audio Formats FAQ (in
two parts) to the alt.binaries.sounds.misc,
alt.binaries.sounds.d, and comp.dsp USENET newsgroups.
On the Web:
http://www.cs.ruu.nl/wais/html/na-dir/audio-fmts/.html
Return to Top
Where to get C Source Code for a JPEG Encoder or Decoder?
Maybe you want to write your own Motion JPEG codec for AVI. It
happens.
The Independent JPEG Group, also known as IJG, distributes the source
code for a JPEG encoder and decoder. The IJG code is incorporated in
many JPEG viewers, is optimized, is free. This is available by
anonymous ftp from the UUNET FTP archive.
ftp://ftp.uu.net/graphics/jpeg/
Return to Top
Where to get C Source Code for an H.263 Video Encoder or Decoder?
Telenor Research distributed a free H.263 video encoder and decoder.
The code is not optimized. Note that H.263 is subject to a variety
of patents and Telenor includes a disclaimer with the code. Telenor
appears to have ceased distributing the code, although it is still
undoubtedly available somewhere on the Web.
http://www.fou.telenor.no/brukere/DVC/h263_software/
For a time, the Signal Processing and Multimedia Group at the
University of British Columbia distributed a free H.263+ video encoder
and decoder. They also appear to have ceased distribution. Their
code appears to be available for a licensing fee.
http://spmg.ece.ubc.ca
See also, their article (available in Adobe PDF format at their web site):
"H.263+: Video Coding at Low Bit Rates", Guy Cote, Berna Erol,
Michael Gallant, and Faouzi Kossentini, IEEE Transactions on
Circuits and Systems for Video Technology, Vol. 8, No. 7, November
1998, p. 849-866
Return to Top
Where to get C Source Code for an MPEG Video Encoder or Decoder?
The MPEG Software Simulation Group or MSSG distributes the C source code
for MPEG-1 and MPEG-2 video encoders and decoders. This code is not
optimized. Go to the MPEG site below and look for MSSG.
http://www.mpeg.org/
Return to Top
Where to get C/C++ Source Code for Wavelet Image Compression?
Geoff Davis distributes a C/C++ source code for wavelet still image
compression of grayscale images, the Wavelet Image Construction Kit.
This code is made available for research purposes.
http://www.cs.dartmouth.edu/~gdavis/
Also see the SPIHT demonstration programs,
http://ipl.rpi.edu/SPIHT/
Return to Top
Where to get an Explanation of Color, Color Spaces, Gamma, and All That
Charles Poynton maintains an FAQ on Color and an FAQ on Gamma. This is
posted in USENET newsgroups regularly and is available on the Web.
http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html
Return to Top
Setup Information or INF Files
When a video codec or hardware device driver is installed under
Windows 3.x, Windows 95, or Windows NT, Windows uses a special
file known as a Setup Information file. This is also known as
a Device Information file in the case of device drivers. These
files have the extension .INF and are also known as INF files.
When a user installs a codec or device driver through the Control
Panel, the user points the Windows system to a directory containing
an INF file and the various files, such as VxD's or DLLs, to be
installed.
A Setup Information, Device Information, or INF file contains
directives that tell Windows how to install the new software or
hardware. These include changes to the Windows Registry, names and
locations of files to install, and other things.
If you are providing a hardware or software product, you may need to
create an INF file to install your product, driver, etc.
End users are often unaware of the INF file. Indeed, its purpose is to
hide the complexity of installing hardware or software. But it is
good to be aware that these files exist and Windows needs them to
properly install many drivers, codecs, and so forth.
Where AVI is concerned, there are frequently INF files for video
codecs, video display adapters, and video capture cards.