Form2 RIFF File Navigation Pointers Form2 Text1 Text1 ReturnCtl &Close! Form_Load Text8 Text17 ReturnCtl_Click Form2g Form_ResizeL Height[ ScaleHeight Width ScaleWidthm obtain more/ technicalb information about files download still writing title decided ascend descend video Form_Load Introduction --------------------- The key to understanding RIFF files is two-fold: knowing how the file is put together, and knowing the C structures that are used to organize the data stored in the file. An overview of the layout of a RIFF file is included below. Instructions --------------------- To get started, you can try the following sequence; it hits the high points. DS = DS + "* Descend three times, to move through the 'RIFF', 'LIST', and 'avih' chunks. This will display the AVI header info. Among other things, note if the file has both video and audio streams, or just video." + Chr(13) + Chr(10) + Chr(13) + Chr(10) * Ascend once, to move to the end of the first LIST chunk, then descend twice (second LIST chunk, then to 'strh' chunk -- that's the video stream header chunk. You'll see info about the video stream. * Then ascend/descend to get to the video format chunk. You'll see video format information displayed. * If there is an audio stream, you can ascend/descend to the 'LIST' chunk for the stream, then descend to the audio stream header info ('strh' Chunk ID). * Then ascend/descend to the audio format chunk, where you will see info about the audio stream, such as sample frequency. You're on your own from there; I haven't worked out additional stuff yet, but feel free to experiment. The file is only open for reading the entire time. Oh yeah -- the mmio functions don't automatically close a file, so I've tried to put a mmioClose call anywhere you might try to leave the program, but it won't hurt to Close on your way out! Tech info --------------------- (The following technical information is from Microsoft:) AVI files use the AVI RIFF form. The AVI RIFF form is identified by the four-character code 'AVI '. All AVI files include two mandatory LIST chunks. These chunks define the format of the streams and stream data. AVI files might also include an index chunk. This optional chunk specifies the location of data chunks within the file. An AVI file with these components has the following form: RIFF ('AVI ' LIST ('hdrl' . . . ) LIST ('movi' . . . ) ['idx1'] ) The LIST chunks and the index chunk are subchunks of the RIFF 'AVI ' chunk. The 'AVI ' chunk identifies the file as an AVI RIFF file. The LIST 'hdrl' chunk defines the format of the data and is the first required list chunk. The LIST 'movi' chunk contains the data for the AVI sequence and is the second required list chunk. The 'idx1' chunk is the optional index chunk. AVI files must keep these three components in the proper sequence. The LIST 'hdrl' and LIST 'movi' chunks use subchunks for their data. The following example shows the AVI RIFF form expanded with the chunks needed to complete the LIST 'hdrl' and LIST 'movi' chunks: RIFF ('AVI ' LIST ('hdrl' 'avih'(
) LIST ('strl' 'strh'() 'strf'() 'strd'(additional header data) . . . ) . . . LIST ('movi' {SubChunk | LIST('rec ' SubChunk1 SubChunk2 . . . ) . . . } . . . ['idx1'] To obtain more technical information about AVI RIFF files, download the file VFW.ZIP from the Compuserve forum WINEXT, in library 2. There is also a file of samples in another ZIP file, VFWX.ZIP. These samples are for C, but they contain lots of useful information about the structures inside the RIFF file. The source code showing how I used VB user-defined types to access the various C structures are declared in chunk.bas, along with the various multimedia DLL function declrations. The logic for determining what chunk is what is in the procedure 'CheckData' on the form Chunk1. This is just a first draft, so don't take the actual code too seriously. I don't code that much in Visual Basic, and I'm a little rusty. Advertising --------------------- If you would like more information along the same lines, I'd like to recommend some books I have written on this and related topics. The first is 'Multimedia Madness,' from Sams Publishing. It covers just about every hardware and software aspect of multimedia, including things like animation, video capture, high-res video, CD-ROM disks, image creation and editing, file types, digital sound, MIDI hardware and software, sequencers -- etc., etc., etc. The second is one I am still writing, and the title is still not decided. Titles under discussion include 'Video Visions' and 'Video Madness.' The book will cover a range of topics centered around digital video -- evaluations of capture boards, inside info on compression, programming tips (including Toolbook, Visual Basic, and multimedia authoring), desktop production, high-end video post-production techniques, and integrating digital video in existing applications. Form_Resize ReturnCtl_Click