Nikos Steiakakis
Nikos Steiakakis

Reputation: 5745

Split wmv/wav file in WinForms application

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

Upvotes: 1

Views: 2697

Answers (1)

Anax
Anax

Reputation: 9372

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.

Upvotes: 4

Related Questions