How do video capture programs work

This is a discussion on How do video capture programs work within the Windows Programming forums, part of the Platform Specific Boards category; I would like to know how video capture applications are coded for the windows platform. By video capture I mean ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    167

    How do video capture programs work

    I would like to know how video capture applications are coded for the windows platform. By video capture I mean those applications that record the activities going on on the desktop. I would like to know if there are apis or sdks available to do this or do the programs just take a series of still images and make a video out of them? If this is the case how are these images converted to videos. I think there is an application that does that, ffmpeg. Are there alternative methods? Thanks.
    silk.odyssey

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I don't specifically know how all of them work, but if you are trying to just record the goings on of a given desktop, it would probably fastest (and use the least memory for both operation and storage) to just have system hooks that keep tabs on everything that is going on. Of course if you are trying to make something like fraps or something, you will need to copy over video buffers.

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Quote Originally Posted by silk.odyssey View Post
    I would like to know how video capture applications are coded for the windows platform. By video capture I mean those applications that record the activities going on on the desktop. I would like to know if there are apis or sdks available to do this or do the programs just take a series of still images and make a video out of them? If this is the case how are these images converted to videos. I think there is an application that does that, ffmpeg. Are there alternative methods? Thanks.
    The sure thing is that if you have a set of still images you can make a video. That is what a video is anyway.
    Generally to make a mpeg you would do this:
    1) Capture some still pictures.
    2) Use mpeg algorithm to compress data
    3) Add header and other information so it will be a valid mpeg file
    Then you are done.

    Dunno if there are apis/skds/apps that do this, probably there should be. In any case the logic is the same. Now, of course the "taking a still picture" part means reading information from somewhere. For that there are functions to read the pixels of the screen. So even you could make such a program, if you know how to create a valid mpeg (or other format)

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    If I were wanting to write something that output mpegs of a game or something how I would do it is this (brace yourself this is quite visual)

    Code:
    In code tags.... stupid thing was complaining at me.
    
    
    Step 1:
    [game video buffer] -> <capture at fixed intervals of 30fps> -> vbuffer
    [game sound buffer] -> <capture at a fixed interval of 96kb/s> -> sbuffer
    
    Step 2:
    vbuffer
       \ 
        <uncompressed data file> -> {compression queue} -> {compress like 320kb/s} -> mbuffer
       / 
    sbuffer
    
    Step 3:
    mbuffer -> [output file.]
    I would only do it this way because I assume you would be trying to play your game while capturing video. At least if you do something like this technique you are sacrificing quality but not that many fps. Plus you could do the compression as slow as you deemed necessary to keep your fps within reasonable range.

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by silk.odyssey View Post
    I would like to know how video capture applications are coded for the windows platform. By video capture I mean those applications that record the activities going on on the desktop. I would like to know if there are apis or sdks available to do this or do the programs just take a series of still images and make a video out of them? If this is the case how are these images converted to videos. I think there is an application that does that, ffmpeg. Are there alternative methods? Thanks.
    I use two methods. For desktop capture I use GDI and BitBlt() from the desktop DC (0). For webcam capture I use DirectShow. As for creating a video, You can either use DirectShow which exposes all MPEG and other video encoding methods, or write your own custom video encoding technique. I have found that for a specific application the later usually gives higher performance, although teh development time is longer.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Apps modify monitor work area
    By insanedesio in forum C# Programming
    Replies: 4
    Last Post: 01-03-2007, 07:46 PM
  2. Replies: 19
    Last Post: 11-29-2006, 08:02 PM
  3. Problems with program at work
    By VirtualAce in forum Windows Programming
    Replies: 2
    Last Post: 07-28-2004, 12:08 AM
  4. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 08:39 AM

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