views:

361

answers:

1

I have a Windows Forms application, and I use an instance of Windows Media Player (via WMPLib) to play some audio/video files, either wmv or wav format. What I currently need to do is split the original file and "extract" one ore more clips from it, let's say 3-4 seconds from a specific point in time of the file.

Any ideas how to do this?

Third party libraries are ok, as long as they are not all that expensive

+2  A: 

Have a look at the Windows Media Encoder SDK. Something like this:

Int32 StartTime = 60 * 1000;
Int32 EndTime = 120 * 1000;
String SourceName = "original.mp3";
String DestinationName = "split.mp3";
WMEncBasicEdit SplitFile = new WMEncBasicEdit();
SplitFile.MediaFile = SourceName;
SplitFile.OutputFile = DestinationName;
SplitFile.MarkIn = StartTime;
SplitFile.MarkOut = EndTime;
SplitFile.Start();

should work.

Anax
Thank you my friend! It worked really sweet!! Just edit you post to use SplitFile instead of BasicEdit in the code so that it is correct for future reference!
Nikos Steiakakis