Page 5 of 5
With the class fully defined we can now use it to create a video. Add a button to the form and in its click event handler write:
BmpToAVI movie=new BmpToAVI(this.Handle);
for (int i = 2; i <= 10; i++)
@"c:\" + i.ToString() + ".bmp");
Prepare 10 bitmaps called 1.bmp, 2.bmp .. to 10.bmp containing the digits 0 to 9. These should be 24-bit uncompressed .BMP format files – you can use Paint to create them. Compressed .BMP files don’t work with VfW unless you explicitly uncompress them first. Palette 256 colour bitmaps also don’t seem to work but they don’t generate an error message.
The raw material
You also need to be aware that some graphics programs don’t write all of the fields in the bitmap headers and this can cause problems. None of the example code has any error checking included so that you can see more clearly how it all works. Using this and your first generated video you should be able to use the rest of the VfW API to do things like extract frames, recompress video data, add sound tracks and so on.
If you would like the code for this project then register and click on CodeBin.
The test video in action