# Video mixer

Media Blocks SDK .Net

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 direction Media type Pins count
Input Uncompressed video 1 or more
Output Uncompressed video 1

# The sample pipeline

graph LR;
    UniversalSourceBlock#1-->VideoMixerBlock;
    UniversalSourceBlock#2-->VideoMixerBlock;
    VideoMixerBlock-->VideoRendererBlock;

# Sample code

var pipeline = new MediaBlocksPipeline();

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.