How to render a sequence into movie?

Hi,
I have already rendered a sequence into a window(created by MFC). Now I want to make this sequence into a movie of standard format(avi,mpeg ect). How can I do this? I google this topic and find some libraries. But it seems that none of them works. Anyone knows a library which works?

One walkaround is to save the image(using glReadPixel) into images of standard format(like jpeg) than make a movie using other tool. But I do not know how to save an image to a file of standard format.
Thank you.

If size not an issue I suggest to use a uncompressed image format like tga or bmp, that could be written in just 2 steps.

  1. write the binary header (18 bytes for tga)
  2. write the byte array filled by glReadPixel.

BinaryWriter bw=new BinaryWriter(fs);

byte Pixel_Depth=(byte)(isRGB?(isAlpha?32:24):(isAlpha?16:8));
byte Image_Descriptor=(byte)(isAlpha?0x28:0x20);

// write Header (18 bytes)
bw.Write((byte)0);           // ID_Length
bw.Write((byte)0);           // Color_Map_Type
bw.Write((byte)(isRGB?2:3)); // Image_Type
bw.Write((ushort)0);         // First_Entry_Index
bw.Write((ushort)0);         // Color_Map_Length
bw.Write((byte)0);           // Color_Map_Entry_Size
bw.Write((ushort)0);         // X_Origin
bw.Write((ushort)0);         // Y_Origin
bw.Write((ushort)width);     // Width
bw.Write((ushort)height);    // Height
bw.Write(Pixel_Depth);       // Pixel_Depth
bw.Write(Image_Descriptor);  // Image_Descriptor

// write image bits
bw.Write(bits);
bw.Close();

Sorry for the C# code, but I had no C/C++ version at hand.

Look at msvfw32.dll and avifil32.dll . They can let you pick a compressor+options and you send GDI frames (DIBs) one by one, it’ll handle the compression.