Editing files with Encoder V3

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[0];

// 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[0].StartTime = new TimeSpan(0, 0, 5);
source.Clips[0].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));

Comments (1)
  1. Michael Collazo says:

    I’ve seen how the video profile can be changed, but how can you change the audio profile? We have numerous WAV files that we would like to be encoded to WMA Voice. The need for this is ongoing so I need to write something to take care of this.

    If you can point me in the right direction I’d truly appreciate it. A VB snippet would be ideal.


    Michael Colazo

Comments are closed.

Skip to main content