.NET选项将视频文件作为WebCam图像流式传输

时间:2022-09-20 14:11:30

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.

我有兴趣开发一个应用程序,允许我从xml(包含视频标题,持续时间等)构建视频列表,并将该列表作为我的网络摄像头流播放。这意味着,如果我要访问ustream.tv,或者在live messenger上激活我的网络摄像头,我的视频播放列表会注册为我的活动网络摄像头。

Does anybody have experience in this area, and perhaps have some advice to offer?

有没有人在这方面有经验,也许有一些建议可以提供?

2 个解决方案

#1


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.

我在这个领域没有很多经验,但我会从查看DirectShow API的MSDN文档开始。

A couple of .NET wrapper libraries exist as well:

还存在几个.NET包装器库:

#2


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.

如果您希望这样做,以便第三方应用程序将您的视频视为标准网络摄像头流(听起来非常像您),那么唯一的方法就是编写虚拟网络摄像头驱动程序。然后,您就可以将视频内容“播放”为网络摄像头的流媒体输出。这将涉及编写代码来解码视频内容 - 可能使用DirectShow - 然后将原始视频流复制到网络摄像头的输出流。您需要编写自定义DirectShow渲染器过滤器或使用样本抓取器来访问原始的解码帧。

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和驱动程序开发都有相当陡峭的学习曲线。您可以使用各种不同的驱动程序模型,具体取决于您的目标。最简单的方法是创建一个Video for Windows(VfW)虚拟摄像头驱动程序。这种方法的巨大好处是驱动程序将完全是用户模式代码 - 更容易调试和编写。

#1


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.

我在这个领域没有很多经验,但我会从查看DirectShow API的MSDN文档开始。

A couple of .NET wrapper libraries exist as well:

还存在几个.NET包装器库:

#2


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.

如果您希望这样做,以便第三方应用程序将您的视频视为标准网络摄像头流(听起来非常像您),那么唯一的方法就是编写虚拟网络摄像头驱动程序。然后,您就可以将视频内容“播放”为网络摄像头的流媒体输出。这将涉及编写代码来解码视频内容 - 可能使用DirectShow - 然后将原始视频流复制到网络摄像头的输出流。您需要编写自定义DirectShow渲染器过滤器或使用样本抓取器来访问原始的解码帧。

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和驱动程序开发都有相当陡峭的学习曲线。您可以使用各种不同的驱动程序模型,具体取决于您的目标。最简单的方法是创建一个Video for Windows(VfW)虚拟摄像头驱动程序。这种方法的巨大好处是驱动程序将完全是用户模式代码 - 更容易调试和编写。