Capturing frames from a webcam


I am trying to capture frames from a webcam. I am using the vfw library with the capture macros. However, for the moment I only managed to playback the webcam in a window. I want to intercept the frames *before* they are displayed, for further processing.

The macro capGrabFrameNoStop(hWnd) seems to be appropriate.
But the problem is that it only displays the actual frame on the capture window. I want to intercept this frame before it is displayed.
The point is not to actually see what the camera sees but process it.

Thanx for the help



  • After further searches the only way to access raw data of a captured frame seems to be via interupt functions set by the capvideostreamcallback() macro. Every time a new frame is available in the streaming buffer, the interrupt function is called and send a parameter VIDEOHDR, that should contain the actual frame raw data.

    Any further explanation would be greatly appreciated,

  • Okay, I'm talking to myself, but anyways it was indeed the VIDEOHDR structure which is passed to the callback fuunction which contains the frame data. The data is in the lpData member of the structure VIDEOHDR. The encoding of this raw data seems to depend on the webcam possibilities and model. I use a Philips TouchCam, and the raw data is encoded in YUV420 format. Mail me for further informations.
  • hm,is VIDEOHDR a user-defined structure?
    well I also have a little Genius webcam,but I believe the format is 160x120~640x480 RGB24:-)
  • No, in fact VIDEOHDR is a structure part of MSDN. It is passed to the frame callback function as a parameter.
    It's contents is described here :

    The encoding of the frames depends on the webcam. My stupid philips, encodes the frames in a YUV420 format which is not as easy as RGB24 to decode :)

    Frdric Patin
    YOV408 Technologies
    [email protected]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!