Skip to main content

Live Video Compositor

Live Video Compositor is a part of the VisioForge Media Blocks SDK .Net that allows you to add and remove sources and outputs in real time to a pipeline.

This allows you to create applications that simultaneously handle multiple video and audio sources.

For example, the LVC allows you to start streaming to YouTube at just the right moment while simultaneously recording video to disk. Using the LVC, you can create an application similar to OBS Studio.

Each source and output has its unique identifier that can be used to add and remove sources and outputs in real time.

Each source and output has its own independent pipeline that can be started and stopped.

Features

  • Supports multiple video and audio sources
  • Supports multiple video and audio outputs
  • Setting the position and size of video sources
  • Setting the transparency of video sources
  • Setting the volume of audio sources

LiveVideoCompositor class

The LiveVideoCompositor is the main class that allows the addition and removal of live sources and outputs to the pipeline. When creating it, it is necessary to specify the resolution and frame rate to use. All sources with a different frame rate will be automatically converted to the frame rate specified when creating the LVC.

LiveVideoCompositorSettings allows you to set the video and audio parameters. It is also necessary to set the maximum number of sources and outputs.

Adding and removing sources and outputs

The LVCAudioInput and LVCVideoInput classes are used to add sources. The classes LVCAudioOutput, LVCVideoOutput, LVCVideoAudioOutput, and LVCVideoViewOutput are used to add outputs.

Sample code

  1. Create a new instance of the LiveVideoCompositor class.
var settings = new LiveVideoCompositorSettings(1920, 1080, VideoFrameRate.FPS_25);
var compositor = new LiveVideoCompositor(settings);
  1. Add video source
  2. Add VideoView
  3. Add audio source
  4. Add audio output
  5. Start the pipeline.
await compositor.StartAsync();

Sample application on GitHub