编写虚拟网络摄像头?
我需要创建一个虚拟网络摄像头,它充当网络摄像头,但将其播放的一组图像作为输入。我见过像 ManyCam 和 Fake Webcam 这样的解决方案,但它们似乎都有一个限制(分辨率、最大文件大小、fps 等)。我正在 Windows XP SP3 上工作。
我知道我必须为此任务编写一个 WIA 接口,但作为一名 Python 程序员,我从未编写过设备的驱动程序或接口。编写这个界面的主要任务是什么?流程会是什么样子?
I need to create a virtual webcam that poses as a webcam, but takes as input a set of images that it plays. I have seen solutions like ManyCam, and Fake Webcam, but they all seem to one limitation or the other (resolution, max file size, fps etc.) I am working on Windows XP SP3.
I understand that I have to write a WIA interface for this task, but being a Python programmer, I have never written drivers or interfaces to devices. What are the main tasks in writing this interface ? What would the flow look like ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要编写 DirectShow 过滤器,它是一个实现
IPin
、IAMStreamConfig< /code>
和
IKsPropertySet
接口。对于IPin
部分,您最好首先继承CSourceStream
类,为此您需要获取 Windows SDK,安装 SDK 后,samples\multimedia\directshow< 中将有一个 DirectShow 基类源< /code> 文件夹,您将在其中找到
CSourceStream
(以及许多其他文件)。 COM 服务器的DllRegisterServer
函数应使用过滤器映射器在CLSID_VideoInputDeviceCategory
类别中注册您的过滤器。构建 COM 服务器后,您可以使用 regsvr32 工具注册它,您的虚拟网络摄像头应该出现在网络摄像头列表中。
另请检查
samples\multimedia\directshow\filters\ball
示例,该示例可以改进并用作您的任务的起点。You need to write DirectShow filter which is a COM server that implements an
IPin
,IAMStreamConfig
andIKsPropertySet
interfaces. For theIPin
part you'd better to start by inheriting theCSourceStream
class, for that you need to get the Windows SDK, having the SDK installed there would be a DirectShow Base Classes sources insamples\multimedia\directshow
folder, there you'll find theCSourceStream
(among many others).DllRegisterServer
function of the COM server should register your filter withinCLSID_VideoInputDeviceCategory
category using filter mapper.After building the COM-server, you register it with
regsvr32
tool, and your virtual webcam should appear in the web cam lists.Also check the
samples\multimedia\directshow\filters\ball
sample that can be improved and used as a starting point for your task.首先阅读此内容
https://learn.microsoft.com/en- us/windows/win32/directshow/writing-source-filters
那么你可以采用
https://github.com/roman380/tmhare.mvps.org-vcam
您可以在此示例虚拟相机之上工作。
这实现了
IAMStreamConfig
和IKsPropertySet
接口这是使用
CSourceStream
构建的和CSource
实现IPin
和IBaseFilter
Read this first
https://learn.microsoft.com/en-us/windows/win32/directshow/writing-source-filters
Then you can adopt
https://github.com/roman380/tmhare.mvps.org-vcam
You can work on top of this sample virtual camera.
This implements
IAMStreamConfig
andIKsPropertySet
interfacesThis is built using
CSourceStream
andCSource
class which implementsIPin
andIBaseFilter