Capturing frames from a webcam - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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



  • yov408yov408 Posts: 12Member
    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,

  • yov408yov408 Posts: 12Member
    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.
  • Johnny13Johnny13 Posts: 128Member
    hm,is VIDEOHDR a user-defined structure?
    well I also have a little Genius webcam,but I believe the format is 160x120~640x480 RGB24:-)
  • yov408yov408 Posts: 12Member
    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.