MediaEncoder throws exception RPC_E_SERVERFAULT
I'm making a program that uses the Windows Media Encoder SDK
I can open files and encode them to other files but when i try to stream my movies i get this exception:
""The server threw an Exception". (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))""
This is my code (which is an exact copy of an example in the SDK)
// Create WMEncoderApp and WMEncoder objects.WMEncoderApp encoderApp =newWMEncoderApp();IWMEncoder myEncoder = encoderApp.Encoder;// Display the predefined Encoder UI. encoderApp.Visible =
true;// Specify the source for the input stream.IWMEncSourceGroupCollection srcGrpColl = myEncoder.SourceGroupCollection;IWMEncSourceGroup srcGrp = srcGrpColl.Add("SG_1");IWMEncSource srcAud = srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);IWMEncVideoSource2 srcVid = (IWMEncVideoSource2)srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);srcAud.SetInput(
"e:\video.wmv","","");srcVid.SetInput(
"e:\video.wmv","","");// Specify a profile.IWMEncProfile pro;IWMEncProfileCollection proColl = myEncoder.ProfileCollection;for (int i = 0; i < proColl.Count; i++){
if (pro.Name =="Windows Media Video 8 for Local Area Network (384 Kbps)")pro = proColl.Item(i);
{
break;srcGrp.set_Profile(pro);
}
}
// Create a broadcast.IWMEncBroadcast brdCst = myEncoder.Broadcast;brdCst.set_PortNumber(
WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, 12345);// Start the encoding process.myEncoder.PrepareToEncode(
true); /////// << Here i get the exceptionmyEncoder.Start();
And i don't only get this exception in my own programs, if i just start the Win Media Encoder-program and start a stream i will also get this "report error to microsft..."-window.
It's the same thing here as in my app, you can start the program and encode things to a file but as soon as you start a webcast it will crash![]()

