表达式编码器4 SDK抛出DCOM错误,而直播

本文关键字:错误 直播 DCOM 抛出 编码器 SDK 表达式 | 更新日期: 2023-09-27 18:13:35

我正在尝试将音频和视频从我的PC直播到托管服务上的发布点。我已经编写了我认为它应该包含的所有代码(目前它只是一个小型主机应用的测试代码)。代码本身不会抛出错误,它运行得很好,视频是从我的网络摄像头拉出来的,但是当试图将流发送到发布点时,我在系统事件日志中得到一个DCOM错误"DCOM无法使用任何配置的协议与计算机streamwebtown.com进行通信。"我尝试使用SDK附带的实际Expression Encoder 4客户端应用程序做同样的事情,视频/音频馈送在相同的发布点上工作得很好。我在网上到处搜索,看看是否有人遇到过这个问题,但一无所获。询问社区成员是否有什么想法?

应用程序代码:


static void Main(string[] args)
{
    EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Video)[0] : null;
    EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Audio)[0] : null;
    LiveJob job = new LiveJob();
    if (video != null && audio != null)
    {
        LiveDeviceSource source = job.AddDeviceSource(video, audio);
        job.ActivateSource(source);
        PushBroadcastPublishFormat publishingPoint = new PushBroadcastPublishFormat();
        publishingPoint.PublishingPoint = new Uri("http://streamwebtown.com/abc");
        publishingPoint.UserName = "user";
        publishingPoint.Password = PullPW("Stream");
        job.ApplyPreset(LivePresets.VC1Broadband16x9);
        job.PublishFormats.Add(publishingPoint);
        job.StartEncoding();
        Console.ReadKey();
        job.StopEncoding();
    }
}
private static SecureString PullPW(string pw)
{
    SecureString s = new SecureString();
    foreach (char c in pw) s.AppendChar(c);
    return s;
}

表达式编码器4 SDK抛出DCOM错误,而直播

我找到了答案,它根本没有对服务器进行身份验证。所以把我的代码改成下面的,它突然就工作得很好了。


 static void Main(string[] args)
        {
EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Video)[0] : null; EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Audio)[0] : null; LiveJob job = new LiveJob(); job.AcquireCredentials += new EventHandler(job_AcquireCredentials); if (video != null && audio != null) { LiveDeviceSource source = job.AddDeviceSource(video, audio); job.ActivateSource(source); PushBroadcastPublishFormat publishingPoint = new PushBroadcastPublishFormat(); publishingPoint.PublishingPoint = new Uri("http://streamwebtown.com/abc");

            WindowsMediaOutputFormat wmof = new WindowsMediaOutputFormat();
            VideoProfile vProfile = new AdvancedVC1VideoProfile();
            AudioProfile aProfile = new WmaAudioProfile();
            wmof.VideoProfile = vProfile;
            wmof.AudioProfile = aProfile;
            job.ApplyPreset(LivePresets.VC1Broadband16x9);
            job.PublishFormats.Add(publishingPoint);
            job.OutputFormat = wmof;
            job.PreConnectPublishingPoint();
            job.StartEncoding();
            //After finished encoding dispose of all objects.
            Console.ReadKey();
            job.StopEncoding();
            job.Dispose();
            video.Dispose();
            audio.Dispose();
            source.Dispose();
        }
    }
    static void job_AcquireCredentials(object sender, AcquireCredentialsEventArgs e)
    {
        e.UserName = "user";
        e.Password = PullPW("Stream");
        e.Modes = AcquireCredentialModes.None;
    }
    private static SecureString PullPW(string pw)
    {
        SecureString s = new SecureString();
        foreach (char c in pw) s.AppendChar(c);
        return s;
    }