The transition between 2 video fragments in Video Edit SDK .Net

Related products
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" };
            VFVEFileSegment[] segments1 = new[] { new VFVEFileSegment(0, 5000) };
            var videoFile = new VFVEVideoSource(
                                files[0],
                                segments1,
                                VFVideoEditStretchMode.Letterbox,
                                0,
                                1.0);
            VFVEFileSegment[] segments2 = new[] { new VFVEFileSegment(0, 5000) };

            var videoFile2 = new VFVEVideoSource(
                                            files[1],
                                            segments2,
                                            VFVideoEditStretchMode.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.
Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
abstract 2abstract 1abstract 3
logo
VisioForge © 2006 - 2021