error to start Windows Media Encoder

Posted by George2 on Stack Overflow See other posts from Stack Overflow or by George2
Published on 2009-05-18T09:31:45Z Indexed on 2010/04/12 23:53 UTC
Read the original article Hit count: 463

Hello everyone,

I am using the following code snippet to run on Windows Server 2003 x64 edition. I met with the following error when invoking encoder.start method. I am using Windows Media Encoder 9.

System.Runtime.InteropServices.COMException 0xC00D1B67

My code snippet is below, does anyone have any ideas what is wrong?

    IWMEncSourceGroup SrcGrp;
    IWMEncSourceGroupCollection SrcGrpColl;
    SrcGrpColl = encoder.SourceGroupCollection;
    SrcGrp = (IWMEncSourceGroup)SrcGrpColl.Add("SG_1");

    IWMEncVideoSource2 SrcVid;
    IWMEncSource SrcAud;
    SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
    SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);

    SrcVid.SetInput("ScreenCap://ScreenCapture1", "", "");
    SrcAud.SetInput("Device://Default_Audio_Device", "", "");

    // Specify a file object in which to save encoded content.
    IWMEncFile File = encoder.File;
    string CurrentFileName = Guid.NewGuid().ToString();
    File.LocalFileName = CurrentFileName;
    CurrentFileName = File.LocalFileName;

    // Choose a profile from the collection.
    IWMEncProfileCollection ProColl = encoder.ProfileCollection;
    IWMEncProfile Pro;
    for (int i = 0; i < ProColl.Count; i++)
    {
        Pro = ProColl.Item(i);

        if (Pro.Name == "Screen Video/Audio High (CBR)")
        {
            SrcGrp.set_Profile(Pro);
            break;
        }
    }
    encoder.Start();

thanks in advance, George

© Stack Overflow or respective owner

Related posts about windows-media-encoder

Related posts about windows-server-2003