Skip to main content

Video mixer

The video mixer block has several inputs and one output. The block draws the inputs in the selected order at the selected positions. You can also set the desired level of transparency for each stream.

Block info

Name: VideoMixerBlock.

Pin directionMedia typePins count
InputUncompressed video1 or more
OutputUncompressed video1

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline(false);

var filename1 = "test.mp4";
var fileSource1 = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename1)));

var filename2 = "test2.mp4";
var fileSource2 = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename2)));

var mixerSettings = new VideoMixerSettings();
mixerSettings.AddStream(new VideoMixerStream(new Rect(0, 0, 1280, 720), 0));
mixerSettings.AddStream(new VideoMixerStream(new Rect(100, 100, 420, 340), 1));
var videoMixer = new VideoMixerBlock(mixerSettings);

pipeline.Connect(fileSource1.VideoOutput, videoMixer.Inputs[0]);
pipeline.Connect(fileSource2.VideoOutput, videoMixer.Inputs[1]);

var videoRenderer = new VideoRendererBlock(pipeline, VideoView1);
pipeline.Connect(videoMixer.Output, videoRenderer.Input);

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.