Click here to Skip to main content
15,917,795 members
Articles / Desktop Programming / MFC
Article

A simple interface to the Video for Windows API for creating AVI movies from individual images

Rate me:
Please Sign up or sign in to vote.
3.54/5 (18 votes)
19 May 2003 215.4K   4.3K   68   38
A simple interface to the Video for Windows API for creating AVI movies from individual images.

Introduction

This article describes a simple interface to the Video for Windows API for creating AVI movies from individual images. The idea for this code comes from a Microsoft sample that was very unfriendly to use. With that in mind, I created this code to easily create an AVI from individual images.

The steps are:

  1. include "aviUtil.h".
  2. Call START_AVI("foo.avi"); // you must include the .avi extention.
  3. Call ADD_FRAME_FROM_DIB_TO_AVI(yourDIB, "DIB", 30); // the dib is passed in as a HANDLE which can be obtained by loading the image with a Image library. (I used CxImage which is available on this site). Put this call in a while or for loop to add all the images you want to the AVI.
  4. Call STOP_AVI(); //this closes the avi and video.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I enjoy working with C#, Java, Perl and C++

Comments and Discussions

 
GeneralRe: ADD_FRAME_FROM_ .. buffer? Pin
Rod VanAmburgh16-Jun-04 19:27
Rod VanAmburgh16-Jun-04 19:27 
GeneralRe: ADD_FRAME_FROM_ .. buffer? Pin
mound17-Jun-04 4:20
mound17-Jun-04 4:20 
GeneralRe: ADD_FRAME_FROM_ .. buffer? Pin
mound17-Jun-04 9:53
mound17-Jun-04 9:53 
GeneralRe: ADD_FRAME_FROM_ .. buffer? Pin
Rod VanAmburgh18-Jun-04 17:22
Rod VanAmburgh18-Jun-04 17:22 
GeneralRe: ADD_FRAME_FROM_ .. buffer? Pin
mound22-Jun-04 8:03
mound22-Jun-04 8:03 
GeneralCXIMAGE to AVI... Pin
sherrinmultimedia20-Oct-03 3:57
sherrinmultimedia20-Oct-03 3:57 
GeneralRe: CXIMAGE to AVI... Pin
Ted Ferenc20-Oct-03 4:18
Ted Ferenc20-Oct-03 4:18 
GeneralRe: CXIMAGE to AVI... Pin
sherrinmultimedia20-Oct-03 4:48
sherrinmultimedia20-Oct-03 4:48 
I appreciate your help. I have attempted to modify the class CxImage to include your new functions, however, I am having a problem with the declaration of several of your variables. I have added the functions directly to ximage.h and ximage.cpp as follows:

BITMAPINFOHEADER *GetBITMAPINFOHEADER() <br />
{ <br />
 return(&head); <br />
}<br />
 <br />
BITMAPINFO* CxImage::GetInfo(void)<br />
{<br />
 static BITMAPINFO bmInfo;<br />
 <br />
 if(!m_Image.IsValid())<br />
 {<br />
  return((BITMAPINFO*) NULL);<br />
 }<br />
 <br />
 // Roll our own!<br />
 CopyMemory(&bmInfo.bmiHeader, GetInfoHeader(), sizeof(BITMAPINFO));<br />
 <br />
 return(&bmInfo);<br />
}<br />
 <br />
BITMAPINFOHEADER* CxImage::GetInfoHeader()<br />
{<br />
if(m_Image.IsValid())<br />
return(m_Image.GetBITMAPINFOHEADER());<br />
else<br />
return((BITMAPINFOHEADER*) NULL);<br />
}


however, m_Image and head both appear as indeclared identifiers. Where and how should I declare them. (sorry if I am asking a very simplistic question... I have taught myself enough C++ to get to this point because I need a piece of software to do just what I need, so I'm really a beginner with no experience as of yet)
GeneralRe: CXIMAGE to AVI... Pin
vanamburghrod@wmconnect.com20-Oct-03 15:57
sussvanamburghrod@wmconnect.com20-Oct-03 15:57 
GeneralRe: CXIMAGE to AVI... Pin
sherrinmultimedia21-Oct-03 2:42
sherrinmultimedia21-Oct-03 2:42 
GeneralRe: CXIMAGE to AVI... Pin
sherrinmultimedia21-Oct-03 3:36
sherrinmultimedia21-Oct-03 3:36 
GeneralRe: CXIMAGE to AVI... Pin
RoyalVN6-Apr-05 21:45
RoyalVN6-Apr-05 21:45 
GeneralAudio Pin
srinivas vaithianathan27-May-03 6:24
srinivas vaithianathan27-May-03 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.