Skip to main content

Picture-In-Picture

Product: Video Edit SDK .Net. Engine: VideoEditCore (Windows only).

You can add file pairs to made them horizontally / vertically split or placed one on another. In this article, you can see how to add source files.

Picture-In-Picture (one video inside another)

Create file list

string[] files = {  "!video.avi", "!video2.wmv" };

Set first file start and stop time (segment)

FileSegment[] segments1 = new[] { new FileSegment(TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(10000)) };

Create video file source

var videoFile = new VideoSource(
files[0],
segments1,
VideoEditStretchMode.Letterbox,
0,
1.0);

Same for the second file

FileSegment[] segments2 = new[] { new FileSegment(TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(10000)) };

var videoFile2 = new VideoSource(
files[1],
segments2,
VideoEditStretchMode.Letterbox,
0,
1.0);

Set rectangle for a "big" file area, the same as video track resolution

var rect1 = new Rectangle(0, 0, 1280, 720);

Set rectangle for a "small" file area

var rect2 = new Rectangle(100, 100, 320, 240);

Add video files using Picture-In-Picture

VideoEdit1.Input_AddVideoFile_PIP(videoFile, videoFile2, TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(10000), VideoEditPIPMode.Custom, true, 1280, 720, 0, rect2, rect1);

Create video file sources same as above.

Add video files using Picture-In-Picture.

Side-by-side video, vertically or horizontally

Horizontal split

VideoEdit1.Input_AddVideoFile_PIP(videoFile, videoFile2, TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(10000), VideoEditPIPMode.Horizontal, false);

Vertical split

VideoEdit1.Input_AddVideoFile_PIP(videoFile, videoFile2, TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(10000), VideoEditPIPMode.Vertical, false);

Required redists

How to install required redists or deploy them to the user's PC?


Visit our GitHub page to get more code samples.