Virtual Webcam Driver

How to create virtual webcam in Windows 10?

Virtual webcam is typically a software only implementation that application discover as if it is a device with physical representation. The mentioned applications use APIs to work with web cameras and ability to extend the APIs and add your own video source is the way to create a virtual web camera.

In Windows there are a few APIs to consume video sources: Video for Windows, DirectShow, Media Foundation (in chronological order).

Video for Windows is not really extensible and limited in capabilities overall. It will see a virtual device if you provide a kernel mode driver for a virtual camera.

DirectShow is the API used by most video capture enabled Windows applications and it is present in all Windows versions including Windows 10 (except just Windows RT). Then it's perfectly extensible and in most cases the term "virtual webcam" refers to DirectShow virtual webcam. Methods to create DirectShow virtual webcam discussed in many StackOverflow questions remain perfectly valid for Windows 10, for applications that implement video capture using DirectShow:

  • Virtual webcam input as byte stream
  • Simulate a DirectShow Webcam

DirectShow samples were removed from Windows SDK but you can still find them in older releases:

  • Getting DirectShow Samples on Windows 8

If you provide a kernel mode driver for video camera device (your virtual webcam through custom kernel driver), DirectShow would also see it just like other video APIs.

Media Foundation is a supposed successor of DirectShow but its video capture capabilities in the part of extensibility simply do not exist1. Microsoft decided to not allow custom video sources application would be able to discover the same way as web cameras. Due to Media Foundation complexity, and overhead and overall unfriendliness it is used by modest amount of applications. To implement a virtual webcam for Media Foundation application you again, like in case of Video for Windows, have to implement a kernel mode driver.


1 Starting with Windows Build 22000 (Windows 11), there is new API MFCreateVirtualCamera which offers virtual camera creation. A developer can implement a video source which the API connects to so called Windows Camera Frame Server service, which in turn distributes the generated video as a source along with regular cameras. Applications see this software implementation the same way as if it was, for example, a webcam.

Project and build structure for Microsoft DirectShow based virtual webcam application on Window 10

I want to create simplest virtual webcam application which can output any image or video to virtual camera. That virtual camera should be visible as video device in online meetings like Google meet or zoom.

There is no support for virtual web cameras in Windows as a unified API and what you are trying to achieve is, generally speaking, possible but far more complicated than a question of setup.

The task can be decomposed into three parts, and you will be able to find past StackOverflow questions that elaborate all of the three (some references are given below).

First, you need to resolve the problem of integration of a virtual camera into third party software. Per the statement I started from, the OS API offers no way for a generic virtual camera interface in terms of OS extensibility point that enables third party application "see" a new camera device.

A popular way to inject a fake camera device into applications is virtual DirectShow video source (and respectively Vivek's VCam source code).

The diagram from Registering a network video stream as a virtual camera describes the APIs used by applications to work with cameras and illustrates limitations of virtual DirectShow cameras, specifically why they are not visible by every video-enabled application in Windows.

See also questions Virtual Driver Cam not recognized by browser and DirectShow filter is not shown as input capture device.

All in all, to develop a virtual webcam for all and any application in Windows you would need to develop a driver, something few are ready to deal with.

Newer Media Foundation API offers nothing to help with functionality of virtual webcam.

Second, you need to define a method of injection of video frames into whatever virtual camera you develop. There is no need to use DirectShow or Media Foundation because in the end of the day all you need is to submit video frames to the back end of your virtual camera implementation and you are free to use any convenient method.

Use of DirectShow for this task make sense overall, but you don't need to. If you are not familiar with the API and you are starting with basics of creation of a filter graph, then it is quite likely that it is easier to go with a non-DirectShow solution. If you need to mix a real webcam image into your feed, you can capture it with Media Foundation in particular. If you plan to use GPU services of sorts, Media Foundation would be a better API to use again. DirectShow still remains good option as API to build your pipeline on.

Third, there is often a question of interprocess communication to connect the virtual camera implementation and the source of the video. In some cases it is not necessary, but more often it is just overlooked.

A virtual DirectShow camera (or virtual Media Foundation camera if you, for example, will be detouring) is running in context of camera consuming process, and cameras in general might be accessed from multiple applications including simultaneously. Quite so often you expect to produce video from another [single] application, including the case of application of unlatching bitness/architecture, so you are to take care of the challenge of passing data between the processes. If you are in an attempt to develop a driver for virtual camera you will have the same task too.

I mentioned aspects of this in MSDN question there: How to implement a "source filter" for splitting camera video based on Vivek's vcam?, then there Read USB camera's input edit and send the output to a virtual camera on Windows and also there How to create Directshow filter?.

All in all, it is not a question of project setup. Instead, it is a set of quite sophisticated problems to solve (which are doable though, and we see examples of this).


For virtual cameras in Windows 11, see also footnote in this answer.

How to transmit with a virtual webcam driver in .NET

If you are going to end up with a virtual camera, important is what APIs you would like to expose it through. In most cases the applications will look for cameras - where they pick your virtual one - through DirectShow you tend to avoid.

Hence, you need to either deal with DirectShow directly, or use a third party middleware component which can grab/accept your data and deliver it through DirectShow.

How to build and run Vivek's Virtual Camera on Windows 10?

Filters folder contains source code for the project. .DSP is the project file for old Visual Studio (or was it Visual C++ 6.0 yet?). If current Visual Studio cannot convert the project file you should still be able to create a new DLL project file and add the source code files.

You need DirectShow BaseClasses to build the code. BaseClasses are no longer a part of Windows 10 SDK, so you have to have Windows 10 SDK and you additionally need this:

  • Win7Samples/multimedia/directshow/baseclasses

Note that BaseClasses there are fresher than VCam sample itself and Visual Studio solution file is already .SLN and is known to be buildable and acceptable (via conversion) for current Visual Studio.

Also you can find other filter projects in neighboring folders.

Bin folder contains pre-built Win32 binaries of the project. Don't be confused with .AX extension - the files are regular .DLL files and you can use them directly against regsvr32. If you build the code into .DLL files you will have the same effect as with .AX.

To see the project in action you need a 32-bit application that works with cameras via DirectShow, for example:

  • Windows 10 SDK GraphEdit
  • AMCap sample (among mentioned samples and also documented on MSDN)
  • GraphStudioNext

You should see a new camera option once you regsvr32 the built project (from privilege elevated command prompt!)

To have the project working with 64-bit applications, you need to build the project first, then regsvr32 it. Virtual Driver Cam not recognized by browser question clarifies why 32 and 64 builds work separately and target different applications.



Related Topics



Leave a reply



Submit