views:

1303

answers:

1

Is there a generic API call I can make to get a handle of the image or video feed coming from a webcam and replace it with an image or video of my own so that applications interfacing to the cam (e.g. MSN/Skype/Yahoo IM) will see my image instead of what the camera is capturing?

Ideally, I am trying to solve this in a generic way independent of device vendor or interface (via standard webcam stack that all these apps utilize, if such a thing exists).

It is for a security application that needs to be able to disable webcams on clients other than for specific purposes. I can stop and start image capture devices through code, but ideally I would prefer to leave the device enabled and replace the captured image with a graphic that tells the user the reason they cannot currently use their cam.

+1  A: 

Most modern webcams that are designed to work generically will typically be implemented as a WDM device that is then exposed as DirectShow kernel filter. Applications can then use DirectShow to work with the live video stream. It would be possible to write a custom filter with a high merit that could try and insert itself into any relevant graph and then modify the video stream on the fly. However, this technique is certainly not foolproof and could be worked around easily. There are also other video capture technologies which would not be affected by this method. In short, there is no reliable way to do what you want for all devices or securely. If you just want to be able to use a standard webcam and programatically alter the video feed in a non-secure fashion then the above technique will work.

Look here for general DirectShow information and here for information about video capture. The AmCap and EZRGB24 samples would also be a good place to start.

Stu Mackellar