Skip to main content

Video streams mixing

Products: Video Capture SDK .Net

SDK can mix several video streams with different resolutions and frame rates.

Sample code

1. Set video mixing mode using the PIP_Mode property

Horizontal stack

VideoCapture1.PIP_Mode = PIPMode.Horizontal;

Vertical stack

VideoCapture1.PIP_Mode = PIPMode.Vertical;

2×2 square

VideoCapture1.PIP_Mode = PIPMode.Mode2x2;

Custom coordinates and output video size

VideoCapture1.PIP_Mode = PIPMode.Custom;
VideoCapture1.PIP_CustomOutputSize_Set(1920, 1080);

2. Add sources

The first source is the main configured source. A screen for screen capture mode, a camera for video capture mode, etc. Additional sources can be added using PIP API. Add video capture device:

VideoCapture1.PIP_Sources_Add_VideoCaptureDevice(
deviceName,
format,
false,
frameRate,
input,
left,
top,
width,
height);

Add IP camera source:

var ipCameraSource= new IPCameraSourceSettings
{
URL = "camera url"
};

// set other IP camera parameters
// ...

VideoCapture1.PIP_Sources_Add_IPCamera(
ipCameraSource,
left,
top,
width,
height);

Add screen source:

ScreenCaptureSourceSettings screenSource = new ScreenCaptureSourceSettings();
screenSource.Mode = ScreenCaptureMode.Screen;
screenSource.FullScreen = true;
VideoCapture1.PIP_Sources_Add_ScreenSource(
screenSource,
left,
top,
width,
height);

3. Update on-the-fly source position and parameters (0 is a major source, 1 and later – sources added using PIP API)

await VideoCapture1.PIP_Sources_SetSourcePositionAsync(
index,
left,
top,
width,
height);

bool transparency = 127; // (0-255)
bool flipX = false;
bool flipY = false;

await VideoCapture1.PIP_Sources_SetSourceSettingsAsync(transparency, transparency, flipX, flipY);

Required redists

  • Video capture redist x86 x64

Visit our GitHub page to get more code samples.