AVIFile Tutorial
Video Capture Help ] [ AVIFile Tutorial ] Licensing and Distribution ] Resources ] Awards ] Latest News ] Source Code ] Free Controls ]

 

VB Programmer's AVIFile Function Help Pages

Windows contains a powerful set of video file functions called the AVIFile API ('Application Programming Interface').  The AVIFile API set of functions is part of an even larger API called the Video For Windows API.  It is possible to use the AVIFile functions from Visual Basic.  However, the lack of samples and documentation for VB programmers makes it a non-trivial and even daunting task.  I have been using the Video For Windows API with Visual Basic for a couple of years now and from C/C++ before that.  Most recently, I have been experimenting with the AVIFile functions for creating and editing AVI files.  I hope that sharing some of my discoveries here will allow others to get through the maze of quirks and pitfalls in these functions a little quicker than I did.

SPECIAL THANKS:
The following people deserve a special thanks for reporting bugs and/or making suggestions which made this tutorial even better:

Patrick Pasteels
Scott Rhodes

If you find a bug or wish to contribute code or suggestions, please see here for info on how to contact me.

 

AVIFile Tutorial Table of Contents
------------------------------

Introduction and Preparation
Read this first!

Step 1 - Getting a Handle on AVIs
Opening And Closing Existing AVI Files
Create a sample program that allows the user to choose an AVI file from the disk and get an interface pointer to it for use with the AVIFile functions.  This is the framework sample which is built on in all the other steps.  Be sure you understand it before going on.

Step 2 - Gently down the Streams
Working With Existing Streams
Create a sample program that gets a pointer to the existing video stream in an AVI file and returns information about the stream. 

Step 3 - AVI to BMPs
Working With Existing Frames
Create a utility that gets each frame from the video stream in an AVI file and saves it to a bitmap file.

Step 4 - Recompress your videos
Creating New AVI Files From Streams
Create a utility that copies the video stream from any AVI file, recompresses it using whatever codec the user chooses and saves it to a new AVI file.

Step 5 - BMPs to AVI
Creating New AVI Files From Bitmap Files
Create a utility that gets a list of bitmap files from the user and creates a new AVI file from them using a specified frame rate.

How to Contact Me
This concludes the Shrinkwrap Visual Basic AVIFile Tutorial.  If you have questions, please see this section for contact info.

Other sources of information:

The definitive source of documentation for these functions is available online at the Microsoft website.  The last time they scrambled their html, these functions ended up here -> ( Online WinSDK docs for AVIFile functions ).
If you find that you need to do something with an AVI file that cannot be done with the AVIFile API, you may want to look into MMIO in the Windows Platform SDK.  However, using those lower level functions is beyond the scope of this tutorial.
AVI files are actually a special type of RIFF file designed by Microsoft and IBM.  A general overview of the AVI format is available online here -> ( John McGowan's AVI Overview ).
 The technical file format can be downloaded in Word format online here -> ( AVI file format info on Wotsit.org ).
Also, my own mmInfo.exe sample may provide VB programmers with some insights into the various UDTs that are used by the AVIFile API.  

 

This Shrinkwrap Visual Basic AVIFile Tutorial is Copyright (C) 2000 by Ray Mercer
Redistribution of the tutorial text and/or samples is prohibited.  Please contact the author Ray Mercer <raymer@shrinkwrapvb.com> if you have a question about this policy.