AVI Mixer

The AVI Mixer allows you to combine 2 AVIs with transparency.

Background

This program was initially developed in July 2001 because the Russian AVI Edit did not work as expected. This was completely rewritten as a Windows application in August 2002 using new code.

Controls

This example is a 15 second BBC 2 ident mixed with a rotating top layer AVI. This example took 5 seconds to process on a Celeron 370 (1.5GHz, 400 MHz FSB, 1Mb L2 Cache, 512Mb RAM, Windows XP Home).

File menu options

AVI Mixer file menu options:

Open main AVI - displays a file selector to load the lower animation,
Open top layer - displays a file selector to load the top animation,
Mix - displays the output file selector and AVI compression codec dialog then starts mixing,
Alpha - displays the output file selector and AVI compression codec dialog then starts mixing with optional transparency,
Stop - stops mixing.
When it is selected the output AVI is closed and should be able to be viewed upto the last frame that was being processed,
Exit - exits the program.

If AVI Mixer is closed during mixing it will ask the user if they really want to exit. The output AVI will be closed cleanly to include the last frame being processed.

Normal use

The transparency colour can be selected by pressing the left mouse button over the displayed frames. If you know the colour you can enter the values in the red, green and blue edit boxes.

In the program the top layer is represented by a moving green rectangle. The top and left position of the overlay can be positioned using the mouse over the top layer. When the left mouse button is pressed the positioner is locked, to unlock it press the right mouse button.

When mixing is in progress each frame is made from the 2 input frames and then output to a valid AVI.
Please ensure there is plenty hard disk space for the output file!

Version history

v3.1: 1st December 2006
1. Fast audio stream copy function added,
2. Window size correction added.

v3.0: 30th November 2006
1. Visual Studio 2003 rebuild,
2. Audio processing frame counter added,
3. Time taken summary shown at end for both video and audio.

v2.4: 28th November 2006
1. Remove slow frame buffer processing and use faster technique from PNGAVIMixer.

v2.3
1. Audio stream copy function added in alpha blend mode,
2. Loop Top Layer Option Added (Default: off),
3. Set Alpha to 128 by default,
4. Do not lock output file if no input files specified and user immediately selects mix function,
5. Date change to 2006.

v2.2
Potential GDI Handle Leak Fixes identified by Boundschecker 7.2 Evaluation Edition.


SelectObject(hdc2,b);
// do work...
DeleteDC(hdc2);
DeleteObject(b);

changed to:

HGDIOBJ hOld = SelectObject(hdc2,b);
// do work...
SelectObject(hdc2,hOld);
DeleteDC(hdc2);
DeleteObject(b);

Might only affect Windows 95\98\ME because of 64k per process GDI handle limit?
See here.

v2.1: 2nd October 2006
1. Very basic audio stream copy function added to mix function.

v2.0: 27th October 2006
1. Alpha blending added
0=fully visible, 255=fully transparent.
2. Optional use of the transparent colour during Alpha blending,
3. Menus introduced rather than buttons,
4. Mixer is now on a worker thread.
This keeps the user interface responsive and allows the introduction of a frame counter to indicate progress.
5. Stop feature added
The partially written output AVI will be closed cleanly, this is good for previewing alpha blending.
6. Positioner can be locked using the left mouse button and released using the right mouse button.
7. Message box when finished removed
Time taken is displayed on a label now
8. Bug fixed where the AVI codec dialog could appear behind other windows.
I now use the main window handle as its parent and not the desktop Window.
9. UK resources set,
10. Tab order fixed.

Old v1.0 intermediate builds
0.8 - Version block updated,
0.7 - Clipping and hyperlink added on about dialog,
0.6 - AVI Mixer (Compression Codecs) added, Quick AVI reader class, colour corrections, memory leak fixes,
0.5 - More validation added,
0.4 - Window tracker performance enhancements,
0.3 - Window tracker added,
0.2 - Transparency selection correction,
0.1 - Basic WTL framework,
0.0 - Command line version. Really horrible.

Known limitations

1. AVIs running at different frame rates will not be synced properly. Frame rate compensation is not implemented yet,
2. Only the first AVI video stream is accessible,
3. The program may crash if the top layer is outside the main area. Clipping should be done properly in the next release.

These are enhancements that we will add when we have the time. We have additional features planned!

Notes

1. AVIs of different lengths are supported,
2. Clipping is partially supported where the top layer is positioned with some edges outside the bottom layer.

Acknowledgements

Michael Lynn. Analysis, design, C++ implementation and minor optimisation.
Mark McMillan for design, suggestions, testing and patience.
Avery Lee for the Open Source VirtualDub. That helped with some AVI issues.
Donald Graft for the source code to his Logo Generator VirtualDub plug-in. We use a similar alpha blending function.

If any commercial companies are interested in this project then please contact me via the email address on the download page.

Download

The program is available for download from the download page.

Back to index.