How can I intercept the streams of videos or images from a webcam and change them?

Is there a general API call that I can make to get the handle of the image or video stream coming from the webcam and replace it with my own image or video so that applications interact with the camera (for example, MSN / Skype / Yahoo IM) will see mine image instead of what the camera captures?

Ideally, I try to solve this in a general way, regardless of the device or device interface (through the standard webcam stack that all these applications use if such a thing exists).

This is a security application that should be able to disable webcams on clients other than specific targets. I can stop and start the image capture devices using the code, but ideally I would prefer to leave the device turned on and replace the captured image with graphics that tell the user why they cannot use the camera.

+4
source share
1 answer

Most modern webcams that are designed to work in general will usually be implemented as a WDM device, which is then displayed as a DirectShow core filter. Applications can then use DirectShow to work with the live video stream. You could write your own filter with high dignity, which could try and insert yourself into any appropriate graph, and then modify the video stream on the fly. However, this method is certainly not reliable and can easily work. There are also other video capture technologies that will not be affected by this method. In short, there is no reliable way to do what you want for all devices, or reliably. If you just want to be able to use a standard webcam and programmatically change the video stream in an unsecured way, then the above method will work.

Look here for general DirectShow information and here for video capture information. AmCap and EZRGB24 samples will also be a useful place to start.

+3
source

All Articles