Skip to main content

Picture-In-Picture

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

You can add file pairs to make them horizontally / vertically split or place 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 the 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 the rectangle for a "big" file area, the same as the video track resolution

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

Set the 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 the 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 can the required redists be installed or deployed to the user's PC?


Visit our GitHub page to get more code samples.