BMP to AVI DirectShow source filter DLL

Some applications need to create an AVI file from a series of bitmaps, one frame at time. The VfW (Video for Windows) AviFile API provides a method for doing this, but it can't create files larger than 2 GB, which makes it useless for uncompressed video. The only way to avoid the 2 GB limit is by writing a DirectShow source filter, which is a royal pain, but the good news is, you don't have to do it! You can just download this FREE project instead.

Note that this project is derived from an earlier project (BmpToAvi), which is a library, rather than a DLL. The library still works fine, and if you prefer a library, use it instead; in fact BmpToAviDll wraps the original library. The advantage of the DLL is that you don't need to have the SDK installed! Finding the right version of the SDK and DirectShow source objects and getting them to compile correctly is a major hassle. With the DLL, you skip all of that. The only disadvantage of the DLL is that you'll need to ship BmpToAvi.dll with your application, but that's no problem.

If you want an application that converts a folder containing bitmaps to an AVI file, that's available here.

Download DLL project (MFC 6)

Download DLL project (NET 2008)

The project includes the following items:

Note that if you want 64-bit you must take the NET 2008 version, and you must also register the 64-bit filter, by using x64reg.bat instead of reg.bat. The 64-bit binaries are in the x64 subfolders.

You are free to use the BmpToAvi DLL binaries, the test application, and the test application sources in any way you like. If you need the filter source, e.g. to license it for non-exclusive commercial use, please contact the developer: Chris Korda.

To run BmpToAviTest, you must have previously registered the BmpToAvi filter, otherwise you will get the error, "Can't create BmpToAvi filter, Class not registered". Use the batch file reg.bat to register the filter, and use unreg.bat to unregister it. Note that your application's installer would typically handle registering and unregistering COM objects.

The test application displays a dialog which allows you to select a compressor and configure it. The compression dialog is backwardly compatible with the dialog displayed by AVISaveOptions in the legacy VfW interface, though it offers a superset of the VfW dialog's capabilities.

The application's main loop is the Test function, in BmpToAviTest.cpp. This function generates a test video with attributes as specified by the Parms structure (Width, Height, BitCount, and FrameRate), as well as FrameCount and Path. The function creates a bitmap, using CreateFrame, repeatedly writes a moving test pattern to it, using DrawFrame, and adds each frame to the output video by passing the bitmap handle to CAviToBmp::AddFrame.

Note that the example only creates a single bitmap and then reuses it. This is more efficient than creating and destroying a bitmap for each frame.

The video attributes can be changed by editing the input values in main. To test the application's ability to generate videos larger than 2 GB, increase the frame size and frame count, and select "Uncompressed" in the compression dialog.

Whorld home