Help with Windows Media SDK 9

P

priya

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
 
P

Priya B

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.
 
P

priya

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top