.NET 选项将视频文件流式传输为网络摄像头图像
我有兴趣开发一个应用程序,它允许我从 xml 构建视频列表(包含视频标题、持续时间等)并将该列表作为我的网络摄像头流播放。 这意味着,如果我要访问 ustream.tv,或在实时通讯软件上激活我的网络摄像头,我的视频播放列表将注册为我的活动网络摄像头。
有没有人有这方面的经验,或者可以提供一些建议?
I am interested in developing an application that will allow me to build a list of videos from xml (containing video title, duration, etc) and play that list as my webcam stream. Meaning, if I were to visit ustream.tv, or activate my webcam on live messenger my video playlist would register as my active webcam.
Does anybody have experience in this area, and perhaps have some advice to offer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望此功能起作用,以便第三方应用程序将您的视频视为标准网络摄像头流(并且听起来非常像您所做的),那么唯一的方法就是编写虚拟网络摄像头驱动程序。 然后,您将能够将视频内容作为网络摄像头的流输出“播放”。 这将涉及编写代码来解码视频内容(可能使用 DirectShow),然后将原始视频流复制到网络摄像头的输出流。 您需要编写自定义 DirectShow 渲染器过滤器或使用样本采集器来访问原始的解码帧。
这当然是一个可以实现的目标,但考虑到 DirectShow 和驱动程序开发都有相当陡峭的学习曲线,这并不是特别容易。 您可以使用多种不同的驱动程序模型来实现此目的,具体取决于您的目标是什么。 最简单的事情是创建一个 Video for Windows (VfW) 虚拟摄像头驱动程序。 这种方法的巨大好处是驱动程序将完全是用户模式代码 - 通常更容易调试和编写。
If you want this to work so that third party apps see your video as a standard webcam stream (and is sounds very much like you do) then the only way to do it is to write a virtual webcam driver. You will then then be able to "play" your video content as your webcam's streaming output. This will involve writing code to decode the video content - probably using DirectShow - and then copying the raw video stream to the webcam's output stream. You'll need to either write a custom DirectShow renderer filter or use the sample grabber to access the raw, decoded frames.
It's certainly an achievable goal, but not particularly easy given that both DirectShow and driver development have fairly steep learning curves. There are a variety of different driver models you could use for this, depending on exactly what your aims are. The easiest thing would be to create a Video for Windows (VfW) virtual camera driver. The huge benefit of this approach is that the driver will be entirely user mode code - much easier to debug and to write in general.
我在这方面没有太多经验,但我首先查看 DirectShow API 的 MSDN 文档。
还存在一些 .NET 包装器库:
I don't have a lot of experience in this area, but I would start by looking at the MSDN docs for the DirectShow API.
A couple of .NET wrapper libraries exist as well: