使用DirectShow和Windows Media Format SDK实时流式传输

[英]Live streaming with DirectShow and Windows Media Format SDK


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.

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

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".
  • 似乎可以使用DirectShow捕获网络摄像头和麦克风输入,然后将其合并为一个“流”。

  • 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).
  • 要对流进行编码,我可能需要将其传递给Windows Media Format SDK库(MSDN文档描述了如何将DirectShow与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).
  • 我认为应该可以使用类似“网络接收器”的东西来广播ASF流(而不是将其写入硬盘)。

  • 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.
  • 我想将大量客户端连接到流上的带宽非常大,所以我应该将流发送到服务器并从那里广播。我只是不知道是否可以使用ASF Reader / Writer的组合来通过服务器“传递”流。我也不知道我是否可以使用多播来获得类似的结果。

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).

我打算使用C#,虽然这可能没什么区别,因为我必须使用一些C ++库的包装器(比如DirectShow.Net或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?

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

1 个解决方案

#1


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.

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


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2009/04/24/8877821c9fe1c9a3befb14f284af7ef3.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号