Class VirtualVideoWriter
- Namespace
- VisioForge.Core.VirtualCamera.Push
- Assembly
- VisioForge.Core.dll
Pushes raw video frames to the VisioForge Virtual Camera via shared memory, bypassing DirectShow completely. The virtual camera source filter reads these frames and presents them to consumer applications (Zoom, OBS, browsers, etc.).
public sealed class VirtualVideoWriter : IDisposableInheritance
Implements
Inherited Members
Remarks
Not thread-safe: do not call Start, Stop or Dispose while a push runs on another thread.
Constructors
VirtualVideoWriter(int, int, double, string, BaseContext)
Creates a new virtual video writer.
public VirtualVideoWriter(int width, int height, double fps, string streamName, BaseContext context)Parameters
widthint-
Frame width in pixels (must be even).
heightint-
Frame height in pixels.
fpsdouble-
Target frame rate (e.g., 30.0).
streamNamestring-
Shared memory stream name. Default matches the virtual camera filter.
contextBaseContext-
SDK logging context. May be null (falls back to Trace).
Remarks
The camera shows a TRIAL banner; pass a license key to the other constructor to remove it.
VirtualVideoWriter(int, int, double, string, BaseContext, string)
Creates a new virtual video writer with a Virtual Camera SDK license key.
public VirtualVideoWriter(int width, int height, double fps, string streamName, BaseContext context, string licenseKey)Parameters
widthint-
Frame width in pixels (must be even).
heightint-
Frame height in pixels.
fpsdouble-
Target frame rate (e.g., 30.0).
streamNamestring-
Shared memory stream name. Default matches the virtual camera filter.
contextBaseContext-
SDK logging context. May be null (falls back to Trace).
licenseKeystring-
Virtual Camera SDK license key. Null or a wrong key leaves the TRIAL banner on.
Properties
FrameCount
Number of frames successfully pushed since Start().
public long FrameCount { get; }Property Value
Methods
Dispose()
Releases all resources used by the VisioForge.Core.VirtualCamera.Push.VirtualVideoWriter, sending an EOS signal to the virtual camera before closing shared memory.
public void Dispose()PushFrame(ReadOnlySpan<byte>)
Pushes a YUY2 frame. Data must be exactly width * height * 2 bytes.
public bool PushFrame(ReadOnlySpan<byte> yuy2Data)Parameters
yuy2DataReadOnlySpan<byte>
Returns
PushFrameBgr24(ReadOnlySpan<byte>, int)
Pushes a 24-bit frame with bytes in B, G, R order (WPF Bgr24, GDI+ Format24bppRgb,
OpenCV CV_8UC3), rows top to bottom.
Converted natively; needs VisioForge_MFPX64.dll (VisioForge_MFPX.dll on x86, VisioForge_MFPX_ARM64.dll on ARM64).
public bool PushFrameBgr24(ReadOnlySpan<byte> bgrData, int stride)Parameters
bgrDataReadOnlySpan<byte>-
The frame, at least
stride* (height - 1) + width * 3 bytes. strideint-
Bytes from the start of one row to the next, at least width * 3.
Returns
PushFrameBgra(ReadOnlySpan<byte>, int)
Pushes a 32-bit frame with bytes in B, G, R, A order (WPF Bgra32/Bgr32,
GDI+ Format32bppArgb/Format32bppRgb), rows top to bottom. Alpha is ignored.
Converted natively; needs VisioForge_MFPX64.dll (VisioForge_MFPX.dll on x86, VisioForge_MFPX_ARM64.dll on ARM64).
public bool PushFrameBgra(ReadOnlySpan<byte> bgraData, int stride)Parameters
bgraDataReadOnlySpan<byte>-
The frame, at least
stride* (height - 1) + width * 4 bytes. strideint-
Bytes from the start of one row to the next, at least width * 4.
Returns
Start()
Opens shared memory and signals that streaming is starting. Must be called before PushFrame.
public void Start()Exceptions
- InvalidOperationException
-
An application reading the virtual camera, or an earlier writer that is not disposed, holds the stream with another frame size (a different frame rate is accepted), or the shared memory could not be opened.
Stop()
Signals end of stream and stops writing.
public void Stop()