Several video streams mixing, Picture-in-Picture in Video Capture SDK .Net

Related 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 PIP_Mode property.

Horizontal stack
VideoCapture1.PIP_Mode = VFPIPMode.Horizontal;
Vertical stack
VideoCapture1.PIP_Mode = VFPIPMode.Vertical;
2×2 square
VideoCapture1.PIP_Mode = VFPIPMode.Mode2x2;
Custom coordinates and output video size
VideoCapture1.PIP_Mode = VFPIPMode.Custom;
VideoCapture1.PIP_CustomOutputSize_Set(1920, 1080);

2. Add sources

The first source is the main configured source. A screen for screen capture mode, 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 = VFScreenCaptureMode.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):

VideoCapture1.PIP_Sources_SetSourcePosition(
    index,
    left,
    top,
    width,
    height);

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

VideoCapture1.PIP_Sources_SetSourceSettings(transparency , transparency, flipX, flipY);
Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
abstract 2abstract 1abstract 3
logo
VisioForge © 2006 - 2021