I’d written a previous post about editing files with Encoder v2 in the SDK however in V3 we changed things a little bit to support adding multiple files to a single timeline. In the case where you want to edit bits out of a single file you now need to go through the Source object.
Here’s some sample code that does this which should hopefully be self-explanatory.
// Create a media item and get a pointer to the inital source.
MediaItem item = new MediaItem(@"c:\users\Public\Videos\Sample Videos\Wildlife.wmv");
Source source = item.Sources;
// Change the first clip so that instead of spanning the entire file
// I'm just going to encode the bit from 5 to 10 seconds.
source.Clips.StartTime = new TimeSpan(0, 0, 5);
source.Clips.EndTime = new TimeSpan(0, 0, 10);
// Also add the bit from 20 to 30 seconds from the original file.
TimeSpan secondClipStart = new TimeSpan(0,0,20);
TimeSpan secondClipEnd = new TimeSpan(0,0,30);
source.Clips.Add(new Clip(secondClipStart, secondClipEnd));