如何在 Windows 10 中创建虚拟网络摄像头? [英] How to create virtual webcam in Windows 10?

查看:84
本文介绍了如何在 Windows 10 中创建虚拟网络摄像头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从网络摄像头获取视频,在帧上渲染一些文本并进行一些运动跟踪,然后将其传递到虚拟网络摄像头,以便轻松进行流式传输.

I would like to take video from a webcam, render some text on the frames and do some motion tracking and pass it on to a virtual webcam so it can be streamed easily.

我在 stackoverflow 上找到了一些答案,建议我应该使用 DirectShow.根据 DirectShow 文档中的信息,DirectShow SDK 是 Windows SDK 的一部分.所以我安装了 最新的 Windows SDK 但它似乎没有'不包括 DirectShow,因为 C:Program Files (x86)Microsoft SDKsWindows 下没有 DirectShow 示例.(stackoverflow 的答案也很老了——大约在 2010 年左右)

I found some answers on stackoverflow suggesting that I should use DirectShow. According to information in DirectShow documentation, the DirectShow SDK is part of Windows SDK. So I installed the latest Windows SDK but it seems that it doesn't include DirectShow because there are no DirectShow samples under C:Program Files (x86)Microsoft SDKsWindows. (The stackoverflow answers are also pretty old - dated around 2010)

您能否建议一种使 DirectShow 工作的方法(包括在 Visual Studio 2015 上工作的示例)或 DirectShow 的其他替代方法,以帮助我创建虚拟网络摄像头?

Can you suggest a way to make DirectShow work (including samples working on Visual Studio 2015) or some other alternative to DirectShow, that would help me create a virtual webcam?

推荐答案

虚拟网络摄像头通常是一种纯软件实现,应用程序发现它就好像它是具有物理表示的设备一样.上述应用程序使用 API 与网络摄像头配合使用,扩展 API 和添加您自己的视频源的能力是创建虚拟网络摄像头的方法.

Virtual webcam is typically a software only implementation that application discover as if it is a device with physical representation. The mentioned applications use APIs to work with web cameras and ability to extend the APIs and add your own video source is the way to create a virtual web camera.

在 Windows 中,有一些 API 可以使用视频源:Video for Windows、DirectShow、Media Foundation(按时间顺序).

In Windows there are a few APIs to consume video sources: Video for Windows, DirectShow, Media Foundation (in chronological order).

Video for Windows 并不是真正可扩展的,而且整体功能有限.如果您为虚拟相机提供内核模式驱动程序,它将看到一个虚拟设备.

Video for Windows is not really extensible and limited in capabilities overall. It will see a virtual device if you provide a kernel mode driver for a virtual camera.

DirectShow 是大多数支持视频捕获的 Windows 应用程序使用的 API,它存在于所有 Windows 版本中,包括 Windows 10(仅 Windows RT 除外).然后它是完全可扩展的,在大多数情况下,术语虚拟网络摄像头"是指 DirectShow 虚拟网络摄像头.许多 StackOverflow 问题中讨论的创建 DirectShow 虚拟网络摄像头的方法对于使用 DirectShow 实现视频捕获的应用程序仍然完全适用于 Windows 10:

DirectShow is the API used by most video capture enabled Windows applications and it is present in all Windows versions including Windows 10 (except just Windows RT). Then it's perfectly extensible and in most cases the term "virtual webcam" refers to DirectShow virtual webcam. Methods to create DirectShow virtual webcam discussed in many StackOverflow questions remain perfectly valid for Windows 10, for applications that implement video capture using DirectShow:

DirectShow 示例已从 Windows SDK 中删除,但您仍可以在旧版本中找到它们:

DirectShow samples were removed from Windows SDK but you can still find them in older releases:

如果您为摄像机设备提供内核模式驱动程序(您的虚拟网络摄像头通过自定义内核驱动程序),DirectShow 也会像其他视频 API 一样看到它.

If you provide a kernel mode driver for video camera device (your virtual webcam through custom kernel driver), DirectShow would also see it just like other video APIs.

Media Foundation 应该是 DirectShow 的继承者,但它在可扩展性部分的视频捕获功能根本不存在.微软决定不允许自定义视频源应用程序能够以与网络摄像头相同的方式发现.由于 Media Foundation 的复杂性、开销和整体不友好,它被适度数量的应用程序使用.要再次为 Media Foundation 应用程序实现虚拟网络摄像头,就像在 Windows 视频的情况下一样,必须实现内核模式驱动程序.

Media Foundation is a supposed successor of DirectShow but its video capture capabilities in the part of extensibility simply do not exist. Microsoft decided to not allow custom video sources application would be able to discover the same way as web cameras. Due to Media Foundation complexity, and overhead and overall unfriendliness it is used by modest amount of applications. To implement a virtual webcam for Media Foundation application you again, like in case of Video for Windows, have to implement a kernel mode driver.

这篇关于如何在 Windows 10 中创建虚拟网络摄像头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆