DirectDraw, and Creating AVIs

This is a discussion on DirectDraw, and Creating AVIs within the C++ Programming forums, part of the General Programming Boards category; I've a pretty interesting question for you guys. I have a program that uses DirectShow, and I need a to ...

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    9

    DirectDraw, and Creating AVIs

    I've a pretty interesting question for you guys. I have a program that uses DirectShow, and I need a to figure out a way to take the data from the DirectShow window and write it into an AVI. The code that I have right now, is takes a Bitmap Screenshot in memory, and writes it directly to the AVI File, then loops until I tell it to stop. I should mention, that I haven't yet been able to put the bitmap that I store in memory into the AVI File, I'm not sure why, either, but I'm more concerned with the following problem atm.

    But, in the process of the screencapture, I have to tell it to lock the window, actually, freeze the program, so it can take an accurate screenshot. It makes the program extremely jittery, as it's looping and writing to the AVI file.

    I don't know what to do. Are there any DirectX functions that will allow faster screenshots, or even direct writing to avis?


    Thanks in advance.

  2. #2
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Posts
    44
    Thats a very messy way of doing it. But I cant suggest a better way - i have no windows c++ programming knowledge.

    anyway, you can speed up the program by writing the avi at the end of the capture - compile the bmp's to the avi. and just take the screenshots and freeze in the loop.

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    9
    Well, my way is actually quite structured, and I just didn't give it enought credit in my first post. Here's psudeocode (cause the actual code in on my other computer)

    Code:
    Start_AVI_Dump(){
    
        char filename = validhandle;
    
        CreateAVI(params);
        if (Sound_Enabled){
            Start_Wav_Dump(FileName);
        }
        DumpingAvi = 1
    }
    
    Update_AVI_Dump(){
         char = Take_Screenshot();
         AVIAddFrame(char);
    }
    
    Stop_AVI_Dump(){
          CloseAVI(param);
          DumpingAvi = 0;
    }
    The WinMain and WinProc loops hold the code for the menu items, which call the Start and Stop functions, and every loop the program makes, if checks if DumpingAVI == 1, and if it is, then calls the Update_AVI_Dump.

    The problem, I am refering to, is that every time I call my function to create the screenshot, it has to stop the loop, so that the screenshot won't be a mix of a bunch of frames. It becomes very jittery. I was hoping that there just might be some sort of code or function in DirectX that could handle AVIs directly from another part of DirectX....


    Thanks in advance.

  4. #4
    Registered User
    Join Date
    Jan 2004
    Posts
    9
    Ack! Does nobody know?

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I don't know much about DirectShow, but I looked a bit at msdn and it didn't sound like it was suited for what you want to do...It seems like it deals with devices like video cameras and such, but the monitor is an output device...

    The only experience I have with doing this is using a program to record video of a computer game, and that was terribly slow. I don't know of any programs that can do this quickly
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Registered User
    Join Date
    Jan 2004
    Posts
    9
    Hmm...Well, I found a site that has source for creating a screenshot of a DirectDraw surface using the GDI library. That *might* speed things up a bit...we'll see...

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    648

  8. #8
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    And this tutorial and the neat set of classes (in the sample, includes DirectDraw in one of the samples):
    http://www.gamedev.net/reference/art...article840.asp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectDraw
    By WebmasterMattD in forum Windows Programming
    Replies: 1
    Last Post: 08-04-2003, 05:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21