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

Nikos Steiakakis
  • 5,605
  • 7
  • 44
  • 54

1 Answers1

4

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
  • 9,122
  • 5
  • 34
  • 68
  • 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 Oct 01 '09 at 05:50