correaAlex / OBSVirtualCameraOutput

Sends frames to a OBS Virtual Camera from .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OBSVirtualCameraOutput

Sends frames to a OBS Virtual Camera from .NET

Getting started

Step 1: Install libyuv

  .\vcpkg install libyuv

Step 2: Add VirtualOutput to dependencies in your project

Usage

Bitmap image = new Bitmap(640, 480);
Random rnd = new Random();
VirtualOutput virtualOutput = new VirtualOutput(image.Width, image.Height, 20, FourCC.FOURCC_24BG);
ImageConverter converter = new ImageConverter();
while (true)
{
  for (var x = 0; x < image.Width; x++)
  {
    for (var y = 0; y < image.Height; y++)
    {
      Color randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
      image.SetPixel(x, y, randomColor);
    }
  }
  byte[] imageBytes = (byte[])converter.ConvertTo(image, typeof(byte[]));
  virtualOutput.Send(imageBytes);
}

For more examples check out the Examples folder

Example

About

Sends frames to a OBS Virtual Camera from .NET


Languages

Language:C++ 72.7%Language:C# 21.3%Language:C 6.1%