John
John

Reputation: 181

Is there any way to write compressed video data to a buffer instead of a file using VFW?

I've got a program which uses the (deprecated) VFW API for recording the screen. In order to capture the screen without saving the results, the program takes about 600-700 ms / 100 frames. However, calling the AVIStreamWrite () function increases this to ~2000 ms, and I suspect it's because of saving to the harddisk directly. So I'd like to save all video data to a RAM buffer instead of a file and save it later to the harddisk.
I also tried using the IC functions instead, however I've encountered other difficulties with those.
Is there any way to make the AVIStreamWrite () function write to a buffer instead of a file?

Some simplified code (I'll add the function arguments and develop the code if required):

bool record=1;
AVIFileInit();
//Initial stream and bitmap header declaration
AVIFileOpen();
//Declaration of compressed stream and of its parameters
AVIMakeCompressedStream();
AVIStreamSetFormat();
while(record) //main loop
{
      //FPS stabilization
      //Screen capturing below, takes about 6 ms per frame
      BitBlt();
      GetDIBits ();
      //Frame saving and compressing below, takes about 14 ms per frame 
      AVIStreamWrite();
      //Something that breaks the main loop
}
//clean-up

Upvotes: 0

Views: 131

Answers (0)

Related Questions