使用 DirectShow 和 Windows Media Format SDK 进行直播

发布于 2024-07-18 03:35:31 字数 791 浏览 3 评论 0原文

首先,一些背景知识:
我正在开发 Silverlight 3 应用程序,并希望添加对实时流媒体的支持(网络摄像头 + 麦克风作为输入)。 不幸的是,Silverlight 本身无法访问网络摄像头或麦克风,因此我需要创建一个独立的应用程序来建立媒体流。 我想 Silverlight 最适合 Microsoft 技术,因此我想使用带有 WMV/WMA 编码的 ASF 格式。

经过一些研究后,我认为我可以做以下事情:

  • 似乎可以使用 DirectShow 捕获网络摄像头和麦克风输入,然后将其组合成一个“流”。
  • 要对流进行编码,我可能需要将其传递给 Windows Media Format SDK 库(MSDN 文档描述了如何将 DirectShow 与 WM ASF Writer 一起使用)。
  • 我认为应该可以使用“Network Sink”之类的东西来广播 ASF 流(而不将其写入 HDD)。
  • 我想将大量客户端连接到流会占用大量带宽,因此我应该将流发送到服务器并从那里广播它。 我只是不知道是否可以使用 ASF 读取器/写入器的组合来通过服务器“传递”流。 我也不知道是否可以使用多播来实现类似的结果。

我计划使用 C#,尽管这可能没有太大区别,因为无论如何我都必须使用一些 C++ 库的包装器(如 DirectShow.Net 或 SlimDX)。

不幸的是,我几乎没有处理媒体流的经验。 所以我的第一个问题是,是否有可能按照我描述的方式进行流式传输?

如果可能的话,这是一种明智的方式还是我应该考虑使用一些不同的库/框架?

First, some background:
I'm developing a Silverlight 3 application and want to add support for live streaming (webcam + microphone as input). Unfortunately, Silverlight cannot access a webcam or a microphone itself, so I need to create a stand-alone application for establishing the media stream. I guess Silverlight would work best with Microsoft technology, so I want to use the ASF format with WMV/WMA encoding.

After doing some research, here is what I think I could do:

  • It seems it is possible to capture both webcam and microphone input with DirectShow and then combine it into one "stream".
  • To encode the stream, I probably need to pass it to the Windows Media Format SDK libraries (MSDN documentation describes how to use DirectShow with WM ASF Writer).
  • I think it should be then possible to use something like "Network Sink" to broadcast the ASF stream (without writing it to the HDD).
  • I guess that connecting lots of clients to the stream would be quite heavy on bandwidth, so I should probably send the stream to a server and broadcast it from there. I just don't know if it's possible to use a combination of ASF Reader/Writer to "pass" the stream through the server. I also don't know if I could use multicasting to achieve a similar result.

I'm planning to use C#, although this probably doesn't make much difference as I will have to use some wrappers for C++ libraries anyway (like DirectShow.Net or SlimDX).

Unfortunately, I have virtually no experience with handling media streams. So my first question is, is it even possible to do streaming in the way I described?

And if it IS possible, is it a sensible way or should I consider using some different libraries/frameworks?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

貪欢 2024-07-25 03:35:31

虽然使用 DShow 和/或 WMF SDK 将为您提供最大的灵活性,但如果您的唯一目标是将视频/音频流式传输到 Silverlight,您可以使用类似 Windows Media Encoder 9 或者您可以使用新的表达式编码器。 两者都支持将实时网络摄像头和麦克风流式传输到 Windows Media Server 发布点,也可以在本地端口上托管流。 两者都有一个可通过 .NET 使用的 SDK(WME 使用 COM 互操作,而 Encoder 具有本机 .NET API)此流与 Silverlight 和 Windows Media Player 兼容。

While using DShow and/or WMF SDK will give you the greatest amount of flexibility, if you only goal is to stream video/audio to Silverlight you can use something like Windows Media Encoder 9 or you can use the new Expression Encoder. Both support streaming live webcam and mic to a Windows Media Server publishing point or it can host the stream on a local port. Both have an SDK that is available via .NET (WME uses COM interop and Encoder has a native .NET API) This stream is compatible with Silverlight and Windows Media Player.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文