The transition between 2 video fragments in Video Edit SDK .Net
Sample code
In this article, we add a simple transition between 2 video files (parts of them).
1. Add 2 video fragments from 2 video files, each 5 seconds (5000 ms) long.
The first fragment is located in the first 5 seconds on the timeline, seconds fragment is located between 4 and 9 seconds, so the second video overlaps the first video. This 1-second overlap will be used as a transition between videos. Each transition except fade-in/out requires this.
string[] files = { "c:\\samples\\!video.avi", "c:\\samples\\!video2.wmv" };
FileSegment[] segments1 = new[] { new FileSegment(0, 5000) };
var videoFile = new VideoSource(
files[0],
segments1,
VideoEditStretchMode.Letterbox,
0,
1.0);
FileSegment[] segments2 = new[] { new FileSegment(0, 5000) };
var videoFile2 = new VideoSource(
files[1],
segments2,
VideoEditStretchMode.Letterbox,
0,
1.0);
VideoEdit1.Input_AddVideoFile(
videoFile,
0);
VideoEdit1.Input_AddVideoFile(
videoFile2,
4000);
2. Get the ID of the required transition.
int id = VideoEdit.Video_Transition_GetIDFromName("Upper right");
3. Add a transition between 4 and 5 seconds on the timeline.
VideoEdit1.Video_Transition_Add(4000, 5000, id);
Transition names are available using "VideoEdit.Video_Transition_Names()" call. Also, you can check the IDs list in this article.