VL.Video.VirtualCamera 1.0.0

dotnet add package VL.Video.VirtualCamera --version 1.0.0
                    
NuGet\Install-Package VL.Video.VirtualCamera -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VL.Video.VirtualCamera" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VL.Video.VirtualCamera" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="VL.Video.VirtualCamera" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VL.Video.VirtualCamera --version 1.0.0
                    
#r "nuget: VL.Video.VirtualCamera, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VL.Video.VirtualCamera@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VL.Video.VirtualCamera&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=VL.Video.VirtualCamera&version=1.0.0
                    
Install as a Cake Tool

VL.Video.VirtualCamera

A Windows 11 virtual camera for vvvv gamma: share any Stride texture or Skia image as a webcam that other apps (OBS, browsers, the Windows Camera app) can select as a video source.

The package provides a single VirtualCamera [Video] node. It consumes a VideoStream, which means both graphics backends work out of the box through the conversion nodes that ship with vvvv:

Stride:  Texture -> TextureToVideoStream [Stride.Video] -> VirtualCamera [Video]
Skia:    SKImage -> SKImageToVideoStream [Graphics.Skia.Video] -> VirtualCamera [Video]

Requirements

  • Windows 11 (build 22000 or newer). The underlying MFCreateVirtualCamera API does not exist on Windows 10, the node reports this on its Status pin.
  • vvvv gamma 8.0, preview build 0439 or later (VL.Core 2026.8.0). vvvv gamma 7.4 runs on .NET 8 and cannot load this package.
  • One time registration of the camera media source with administrator rights, see Installation.

Installation

  1. Install the package (nuget: VL.Video.VirtualCamera) or clone this repository into a folder that vvvv scans for packages.
  2. Open the virtualcam folder inside the package.
  3. Right click register.cmd and select "Run as administrator".

The script copies the media source DLL (VL.Video.VCamSource.dll) to %ProgramData%\vvvv\VirtualCamera and registers it with regsvr32. The copy is required because Windows loads the DLL into its Frame Server service, which runs as Local Service and cannot read files inside a user profile.

To remove the camera from the system run virtualcam\unregister.cmd as administrator.

Quick start

Open the help patch HowTo Share a texture as virtual camera from vvvv's help browser, connect a texture and check the Windows Camera app. The minimal patch is:

  1. Create a TextureToVideoStream [Stride.Video] node and connect your texture.
  2. Create a VirtualCamera [Video] node and connect the video stream.
  3. Is Running turns true and the camera named "vvvv Virtual Camera" appears in consuming apps.

Node reference

VirtualCamera [Video]

Pin Type Default Description
Video Stream VideoStream The frames to share, as produced by TextureToVideoStream or SKImageToVideoStream.
Friendly Name String vvvv Virtual Camera Name of the camera as shown to consuming apps.
Size Int2 1920, 1080 Output resolution of the camera. Incoming frames of a different size are scaled and letterboxed with black bars. Applied on camera start.
Fps Float32 60 Advertised frame rate. Applied on camera start.
Allocator Sample Count (optional) Int32 4 Depth of the sample allocator the camera stream hands to the Windows camera pipeline. Caps how many frames the pipeline and its consumers can hold or request ahead of playback, trading latency (small values) against robustness for consumers that hold on to samples (larger values). Range 2 to 16. Applied on camera start.
Enabled Boolean True Turns the camera on or off. While off the camera is removed from the system.
Is Running Boolean True while the camera is up and available to other apps.
Status String Human readable state, shows registration and startup errors with instructions.
Diagnostics String (optional) Producer side counters, refreshed once per second: frames in/written/dropped per second, handoff block time (high values slow the render loop), frame section write duration (plain memory copies, high values point at memory pressure) and contiguous vs copied source frames.

Changing Size, Fps or Friendly Name restarts the camera; consuming apps reconnect automatically. Supported input pixel formats are the 8 bit BGRA and RGBA variants, which is what the ToVideoStream nodes produce for regular 8 bit textures and images.

How it works

A Windows virtual camera has two halves:

  1. The control side runs inside vvvv: the VirtualCamera node calls MFCreateVirtualCamera and publishes every incoming frame into a shared memory ring buffer.
  2. The media source is a COM DLL registered under a fixed CLSID. Windows' Frame Server service and every consuming app load this DLL into their own processes and pull frames from it. The DLL reads the newest frame from the shared ring buffer, converts it to the negotiated format (RGB32 or NV12) and hands it to the pipeline.

The shared buffer itself has two parts (protocol version 2):

  • A small configuration file (4 KB, under %ProgramData%\vvvv\VirtualCamera) carries the camera format, the writer heartbeat and the single writer exclusivity: a second vvvv instance cannot open it. It has a fixed size and is rewritten in place on format changes, so reader mappings can never block the writer. Only the heartbeat page is ever dirtied, disk writes are negligible.
  • A pagefile backed section (Global\vvvv-vcam0-v2-{width}x{height}) holds the frame slots and the seqlock state. Because the memory has no file behind it, publishing frames causes no disk writeback at all; at 1080p60 the version 1 file based ring dirtied around 500 MB/s of file pages, which wore the SSD and could throttle the writing thread. The section is created by the media source inside the Frame Server service (session 0, where creating Global objects needs no privilege) with a DACL that lets the vvvv node write and everyone including sandboxed consumers (AppContainer, LPAC) read. The node simply opens the section once the camera has started, dropping frames until it appears; a size change addresses a differently named section, so stale consumers can never misinterpret the memory.

The ring uses a per slot sequence counter (seqlock) so readers detect torn reads without any cross process locks. The writer heartbeat in the file tells the media source when the vvvv process is gone, in which case it serves black frames until the producer returns. The media source is published with NativeAOT, so it is a single self contained native DLL that does not load the .NET runtime into the Frame Server or consuming apps. NV12 output is produced in BT.601 limited range, the interpretation every consumer applies to NV12 without explicit range metadata and what hardware webcams deliver.

Frame timing and the clock beat

The camera delivers samples paced to its advertised frame rate: a delivery thread inside the media source completes one request per frame interval on a fixed schedule with evenly spaced timestamps. This makes playback smooth in consumers, but one subtle timing artifact remains and is worth understanding.

Two independent clocks. vvvv's mainloop writes a frame into the shared buffer roughly every interval, timed by its own clock. The camera's delivery thread hands out a sample every interval, timed by the Windows performance counter. Both nominally run at the same rate, for example 60 Hz, but no two clocks are exactly equal: crystal tolerance, scheduler jitter and mainloop load make one always run a few parts per million faster than the other.

The mechanism. The phase between "vvvv publishes" and "camera delivers" therefore drifts continuously. Most delivery ticks find exactly one new frame in the buffer. Periodically the drift crosses a boundary: a delivery tick lands just before the next vvvv frame arrives and the previous frame is served again (a repeat); moments later two vvvv frames arrive within one delivery interval and the buffer only keeps the latest, so one is never shown (a skip). The net effect is one repeated plus one skipped frame per beat period of the two clocks.

How often. The beat frequency is the difference of the two rates. Clocks differing by 0.1 percent produce one repeat and skip pair about every 17 seconds at 60 fps; clocks differing by 10 parts per million about every 28 minutes. It is the same phenomenon as two car turn signals slowly drifting in and out of sync.

Why this is inherent and usually imperceptible. Consumers resample to their own clocks at the far end anyway: OBS composites at its canvas rate, displays refresh on their own clock. A beat of this kind reappears at the consumer boundary no matter how perfectly the camera delivers, which is why every unsynchronized camera pipeline, including physical webcams, shows the same artifact and why it is rarely visible in practice.

Measuring it. The media source's ETW trace (see virtualcam/README.md) logs one line per 300 samples including distinct and repeats counters: distinct counts samples that carried a new vvvv frame, repeats counts samples that re-served the previous one. In steady 60 to 60 operation expect distinct near 300 with a small number of repeats matching the beat frequency.

The theoretical full fix and why it is not implemented. Delivery could be slaved to vvvv's clock by signaling every published frame across the process boundary. That would reintroduce cross process synchronization objects the shared buffer protocol deliberately avoids (they raised the access control questions the file based design solved), would still need fallback pacing for a stalled writer, and the beat would reappear at the consumer boundary regardless. The paced schedule with the buffer as a mailbox is the better trade off.

Troubleshooting

All startup problems surface on the node's Status pin with instructions. The most common ones:

  • "Media source not registered": run virtualcam\register.cmd as administrator.
  • After updating the package the camera stays black and the Status pin shows "Waiting for the camera service to create the frame section": the registered media source DLL is older than the node and still speaks protocol version 1. Re-run virtualcam\register.cmd as administrator so the registered DLL matches the package.
  • "Access denied starting the virtual camera": the registered DLL is not readable by the Frame Server service. Re-run register.cmd, it installs the DLL to ProgramData with read access for Everyone.
  • "Virtual camera frame buffer is in use by another instance": another vvvv instance already runs a virtual camera. Only one camera instance is supported.
  • "Waiting for apps to release the previous frame buffer": only possible once, right after updating from a version 1 package: consumers still hold mappings of the old, larger buffer file. They release within a few seconds and the camera starts on the next retry.
  • "Virtual camera requires Windows 11": the API is not available on this Windows version.
  • Camera shows black in the consuming app: the patch is stopped, Enabled is false, or no frames arrive on the Video Stream pin. Also check that the upstream ToVideoStream node receives a texture.
  • Camera lingers after a vvvv crash: the camera is created with session lifetime. After a crash it may stay listed (serving black) until you log off or start and stop the node again.

For live tracing of the media source inside the Frame Server see virtualcam/README.md (ETW provider for WpfTraceSpy).

When the delivery thread starts, the trace shows one line. The line mmcss:Capture index:N means the thread is registered with the Multimedia Class Scheduler Service. The line mmcss:off error:N means the registration failed. The thread then runs at normal priority.

Development

The repository follows the layout of other VL packages:

VL.Video.VirtualCamera.vl        minimal document that references and forwards the assembly
src/
  VL.Video.VirtualCamera.sln     solution with all three projects
  VL.Video.VirtualCamera/        the vvvv facing assembly (VirtualCamera node), builds to lib/net10.0
  VL.Video.VCamSource/           the media source COM DLL (NativeAOT, no VL dependency)
  VL.Video.VirtualCamera.Tests/  NUnit tests, see Testing
  shared/                        shared buffer protocol (file, frame section, seqlock, color conversion), compiled into both assemblies and the tests
virtualcam/                      registration scripts, the published media source DLL lands here
help/                            help patches
deployment/                      nuspec for publishing

Build everything (both assemblies and the tests):

dotnet build -c Release src\VL.Video.VirtualCamera.sln

The node DLL in lib\net10.0 is committed. Build it as Release before a commit: vvvv runs a Debug build without JIT optimization. The build needs the .NET 10 SDK. The VL packages come from the vvvv package feed in NuGet.config.

Publish the media source DLL (requires the Visual Studio C++ build tools and a Windows 11 SDK for the NativeAOT linker):

publish-vcamsource.cmd

For the dev loop, launch vvvv with the repo's parent folder as package repository:

vvvv.exe --package-repositories D:\_dev\_vl-libs -o VL.Video.VirtualCamera.vl

The interop follows the conventions of VL.Video in VL.StandardLibs: Win32 and Media Foundation calls go through CsWin32 (NativeMethods.txt), the COM server side of the media source uses .NET source generated COM (GeneratedComInterface / GeneratedComClass), which works under NativeAOT.

Testing

dotnet test src\VL.Video.VirtualCamera.Tests

The tests run on Windows 10 or 11 without registering anything:

  1. RingBufferTests: unit tests of the configuration file protocol (in place rewrite, exclusivity, staleness) and the writer's section attachment.
  2. FrameSectionTests: unit tests of the pagefile backed frame section, including a torn read hammer test for the seqlock. They use session local section names, so no privilege or Frame Server is involved. They also check that a read of an unchanged frame is skipped and leaves the destination as it is.
  3. ColorConvertTests: tests of the BGRA to NV12 conversion in BT.601 limited range. The SIMD path must give the same bytes as the scalar reference. The 4K timing test PerformanceCanary_4K is explicit.
  4. SamplePacerTests: tests of the pacing of the sample delivery. They use plain tick values and no real clock. They cover the fixed grid, skipped slots, new grid anchors and the clamped wait.
  5. PixelCopyTests: tests of the copy of a source frame into the output frame. The copy swaps red and blue for RGBA input, scales the frame and adds black bars. The fast path must give the same bytes as the reference. The test Timing_1080p is explicit. It prints the time for a 1920x1080 frame. Run it with: dotnet test -c Release src\VL.Video.VirtualCamera.Tests --filter "FullyQualifiedName~Timing_1080p"
  6. StartRetryTimerTests: tests of the timer that spaces the start attempts of the node. They check that the first attempt is never blocked.
  7. ProducerStatsTests: tests of the producer side counters. They check the text of the Diagnostics pin and that the counters reset after each report.
  8. WorkerHandoverTests: tests of the ownership handover between the node and its writer thread. Exactly one side must dispose the resources.
  9. PackageTests: headless compile checks via VL.TestFramework. The main document and every help patch are compiled against a real vvvv installation (default D:\vvvv\vvvv_gamma_8.0-0439, override with the VVVV_DIR environment variable). This validates the node import, all pin names and the help patch wiring without opening the editor.

After publishing the media source DLL there is an additional in process smoke test that drives it exactly like the Frame Server would (DllGetClassObject, class factory, activation, presentation descriptor), without registration and on any Windows version:

dotnet run --project tools\VCamSmokeTest -c Release

With the environment variable VCAM_SECTION_LOCAL=1 the frame section moves to the session local namespace, which the test process is allowed to create. The smoke test then additionally verifies the full version 2 handshake against the published DLL: the media source creates the section during activation, the writer side attaches, publishes a frame and a consumer mapping reads it back. Never set this variable in production, a local section next to the real global one would keep the camera black.

End to end verification (camera visible in apps) requires a Windows 11 machine: register, open the help patch, then check the feed in the Windows Camera app, OBS and a browser. To unload the media source DLL between iterations restart the "Windows Camera Frame Server" service.

Credits

The media source is a port of Simon Mourier's VCamNetSample, a .NET implementation of a Windows 11 virtual camera. Its AOT variant also showed the way for hosting source generated COM under NativeAOT.

License

MIT, see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 11/28/2026