Hello. I have same aim like Saban. And i installed WM Encoder 9 SDK. Found Example to broadcast video stream in MSDN:
The following example shows how to create the predefined user interface, and broadcast live multimedia content from the local computer (
http://computer_name:8080). The audio and video sources are configured to use the default sound card and video capture card.
using System;
using WMEncoderLib;
class EncodeFile
{
static void Main()
{
try
{
// Create WMEncoderApp and WMEncoder objects.
WMEncoderApp EncoderApp = new WMEncoderApp();
IWMEncoder Encoder = EncoderApp.Encoder;
// Display the predefined Encoder UI.
EncoderApp.Visible = true;
// Specify the source for the input stream.
IWMEncSourceGroupCollection SrcGrpColl = Encoder.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("Default_Audio_Device", "Device", "");
SrcVid.SetInput("Default_Video_Device", "Device", "");
// Specify a profile.
IWMEncProfile Pro;
IWMEncProfileCollection ProColl = Encoder.ProfileCollection;
for (int i = 0; i < ProColl.Count; i++)
{
Pro = ProColl.Item(i);
if (Pro.Name == "Windows Media Video 8 for Local Area Network (384 Kbps)")
{
SrcGrp.set_Profile(Pro);
break;
}
}
// Create a broadcast.
IWMEncBroadcast BrdCst = Encoder.Broadcast;
BrdCst.set_PortNumber (WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, 8080);
// Start the encoding process.
Encoder.PrepareToEncode(true);
Encoder.Start();
// Use this statement so that the Windows Media Encoder window does not close until you press Enter.
Console.WriteLine("Press Enter to close this window.");
Console.ReadLine();
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
}
}
but in the "WMEncoderApp EncoderApp = new WMEncoderApp();" string I have exception:
Retrieving the COM class factory for component with CLSID {632B606B-BBC6-11D2-A329-006097C4E476} failed due to the following error: 80040154
Pls tell who know what is this...
Saban, please tell me how u solved u'r problem...
If not to use this string and remake code for capture devices
(SrcVid.SetInput("ScreenCapture1", "ScreenCap", "");)
i have another exception in the "Encoder.PrepareToEncode(true);" string about illegal video format.