Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a virtual webcam?

Tags:

I need to create a virtual webcam that poses as a webcam, but takes as input a set of images that it plays. I have seen solutions like ManyCam, and Fake Webcam, but they all seem to one limitation or the other (resolution, max file size, fps etc.) I am working on Windows XP SP3.

I understand that I have to write a WIA interface for this task, but being a Python programmer, I have never written drivers or interfaces to devices. What are the main tasks in writing this interface ? What would the flow look like ?

like image 667
aloogobi Avatar asked Jun 05 '11 15:06

aloogobi


People also ask

How does a virtual webcam work?

A virtual webcam is a software application that allows users to use their computers' resources during a video call instead of using a live webcam. In other words, users can place images, videos, and other sources as their primary output during a video call.


2 Answers

You need to write DirectShow filter which is a COM server that implements an IPin, IAMStreamConfig and IKsPropertySet interfaces. For the IPin part you'd better to start by inheriting the CSourceStream class, for that you need to get the Windows SDK, having the SDK installed there would be a DirectShow Base Classes sources in samples\multimedia\directshow folder, there you'll find the CSourceStream (among many others). DllRegisterServer function of the COM server should register your filter within CLSID_VideoInputDeviceCategory category using filter mapper.

After building the COM-server, you register it with regsvr32 tool, and your virtual webcam should appear in the web cam lists.

Also check the samples\multimedia\directshow\filters\ball sample that can be improved and used as a starting point for your task.

like image 132
n0rd Avatar answered Sep 21 '22 17:09

n0rd


Read this first
https://docs.microsoft.com/en-us/windows/win32/directshow/writing-source-filters

Then you can adopt
https://github.com/roman380/tmhare.mvps.org-vcam

You can work on top of this sample virtual camera.

This implements IAMStreamConfig and IKsPropertySet interfaces
This is built using CSourceStream and CSource class which implements IPin and IBaseFilter

like image 21
Alok Avatar answered Sep 20 '22 17:09

Alok