By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,707 Members | 1,636 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,707 IT Pros & Developers. It's quick & easy.

Help with Windows Media SDK 9

P: n/a
Hi,

I want to convert an .mpeg to a .wmv file.

//Creating an Encoder object
WMEncoder Encoder = new WMEncoder();

//Create a Source Collection Group
IWMEncSourceGroupCollection SrcGrpColl =
Encoder.SourceGroupCollection;

//Adding a source to the SrcGrpColl
IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

//Adding video to the Source Group
IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)
SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcVid.SetInput(source,"","");

//Specifying where to save the video file
IWMEncFile File = Encoder.File;
File.LocalFileName = ("c:\\output.wmv");

//Starting Encoding
Encoder.PrepareToEncode(true);
Encoder.Start();
Console.WriteLine("Press Enter when the file has been encoded");
Console.ReadLine();
}

That is the code that I have partially written and borrowed from the
SDK code samples. I am encoutering an error at Encoder.Start()

Could anyone suggest anything.

Thanks
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Satya,

What kind of error do you get?

Michel

sa***@uky.edu (priya) wrote in message news:<e4*************************@posting.google.c om>...
Hi,

I want to convert an .mpeg to a .wmv file.

//Creating an Encoder object
WMEncoder Encoder = new WMEncoder();

//Create a Source Collection Group
IWMEncSourceGroupCollection SrcGrpColl =
Encoder.SourceGroupCollection;

//Adding a source to the SrcGrpColl
IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

//Adding video to the Source Group
IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)
SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcVid.SetInput(source,"","");

//Specifying where to save the video file
IWMEncFile File = Encoder.File;
File.LocalFileName = ("c:\\output.wmv");

//Starting Encoding
Encoder.PrepareToEncode(true);
Encoder.Start();
Console.WriteLine("Press Enter when the file has been encoded");
Console.ReadLine();
}

That is the code that I have partially written and borrowed from the
SDK code samples. I am encoutering an error at Encoder.Start()

Could anyone suggest anything.

Thanks

Nov 16 '05 #2

P: n/a
Hi Michel,

The error I get is at Encoder.Start and it is
System.Runtime.InteropServices.ComException.

I tried the C# samples in the SDK too, the very first one converting a
.mpg to .wmv doesnt seem to work.

I have no clue on how to approach the problem.

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

P: n/a
Hi Michel,

The problem is that if I try to convert an mpeg it just converts
hardly a frame and if I try to convert any other file type it says
that the ClassFactory cannot supply the requested class.

Thanks!
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.