Skip to main content

How to add several segments of the same file?

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

Sample code

1. Specify each segment's start and stop time to add

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

2. Create a video source that includes specified segments

VideoSource videoFile = new VideoSource(
videoFileName,
segments,
VideoEditStretchMode.Letterbox,
0,
1.0);

3. Add file to timeline

VideoEdit1.Input_AddVideoFile(videoFile, 0);

The same idea can be used to add audio file parts, with AudioSource and Input_AddAudioFile used.

Required redists

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


Visit our GitHub page to get more code samples.