Windows 10上不提供网络摄像头MJPG捕获流 [英] Webcam MJPG capture streams are unavailable on Windows 10

查看:428
本文介绍了Windows 10上不提供网络摄像头MJPG捕获流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 10内部版本10.1607.14393.10(又称周年纪念版)上,我不再能够获取MJPG捕获流。以前是MJPG和YUY2分辨率,现在在IBaseFilter源连接到任何东西之前,我在DirectShow(内核流)和Media Foundation中仅得到YUY2的MJPG将媒体类型转换为NV12的方式。在具有不同相机的多个系统上进行了尝试。任何想法可能有什么问题吗?

On Windows 10 build 10.1607.14393.10 (aka Anniversary edition) I am unable to get MJPG capture streams anymore. Used to be both MJPG and YUY2 resolutions, now I am getting only YUY2 in DirectShow (Kernel Streaming) and in Media Foundation MJPG converted media types into NV12 way before IBaseFilter source is connected to anything. Tried on multiple systems with different cameras. Any ideas what might be wrong?

     640x480   @30   YUY2
     ...
     640x480   @30   MJPG <- gone
 ...
DirectShow:
    com_t<IAMStreamConfig> sc;
    if_failed_return_result(camera_output_pin->QueryInterface(&sc));
    int number_of_capabilities = 0;
    int capability_size = 0;
    if_failed_return(sc->GetNumberOfCapabilities(&number_of_capabilities, &capability_size), -1);
    for (int i = 0; i < number_of_capabilities && k < count; i++) {
        VIDEO_STREAM_CONFIG_CAPS scc;
        assert(sizeof(scc) == capability_size);
        AM_MEDIA_TYPE* mt = null;
        if_failed_return(sc->GetStreamCaps(i, &mt, (BYTE*)&scc), -1);
...

在MMF中:

    640x480   @30   YUY2
    ...
    640x480   @30   NV12 // camera reports MJPG 4cc in USBView and KsStudio

for (int i = 0; k < count; i++) {
    com_t<IMFMediaType> type;
    if (d->reader->GetNativeMediaType(VIDEO_STREAM, i, &type) != 0) {
        break;
    }
    GUID guid_major_type = {0};
    if_failed_return_result(type->GetMajorType(&guid_major_type));
    if (guid_major_type == MFMediaType_Video) {
        GUID guid_subtype = {0};
        if_failed_return_result(type->GetGUID(MF_MT_SUBTYPE, &guid_subtype));
        AM_MEDIA_TYPE* amMediaType = null;
        if_failed_return_result(type->GetRepresentation(FORMAT_MFVideoFormat, (void**)&amMediaType));
        assert(amMediaType->cbFormat == sizeof(MFVIDEOFORMAT));
        const MFVIDEOFORMAT* mi = (const MFVIDEOFORMAT*)amMediaType->pbFormat;


推荐答案

由Microsoft的Mike M解释


因此,可以,对MJPEG和H.264进行解码/过滤是我们需要实现的一系列功能的结果,并且这种行为是经过计划,设计,测试的,并在1月底左右发布给了我们的合作伙伴和Windows Insiders今年。我们与合作伙伴合作,以确保他们的应用程序在整个更改过程中仍能正常运行,但是我们在将此更改传达给你们方面做得很差。我们将球丢在了前面,所以我想向大家表示歉意。

So yes, MJPEG and H.264 being decoded / filtered out is the result of a set of features we needed to implement, and this behavior was planned, designed, tested, and flighted out to our partners and Windows Insiders around the end of January of this year. We worked with partners to make sure their applications continued to function throughout this change, but we have done a poor job communicating this change out to you guys. We dropped the ball on that front, so I’d like to offer my apologies to you all.

在Windows 10周年更新MJPG中来自网络摄像头的视频被新的帮助程序服务 Windows Camera Frame Server捕获,该服务自身自我介绍为使多个客户端能够从摄像头设备访问视频帧。 Mike M提到了同样的问题。

In Windows 10 Anniversary Update MJPG video from webcam is captured by new helper service "Windows Camera Frame Server", which is self-introducing itself as "Enables multiple clients to access video frames from camera devices.". The same is mentioned by Mike M.

我无法看到多个客户端共享摄像机,因为TopoEdit的第二个实例给了我一个典型的错误:开始播放时出错。硬件MFT由于缺少硬件资源而无法开始流式传输。

I for one was unable to see multiple clients sharing a camera as second instance of TopoEdit gave me typical error: Error starting playback. Hardware MFT failed to start streaming due to lack of hardware resources.

MJPG和H264媒体类型确实被过滤掉了,因为平台更新现在声称有责任避免多种情况发生客户端同时访问同一台摄像机,并且每个摄像机都自己进行解码,从而使工作量倍增。

MJPG and H264 media types however are indeed filtered out as the platform update now claims responsibility to avoid scenarios where multiple clients access the same camera simultaneously and each one does decoding on its own duplicating the effort.


Windows解码MJPEG的主要原因之一为您的应用程序是因为性能。借助Windows 10周年更新,现在可以使多个应用程序以前所未有的方式访问相机。对我们而言,启用并发摄像头访问非常重要,因此Windows Hello,Microsoft Hololens和其他产品和功能可以可靠地假定在任何给定时间都可以使用该摄像头,而不管其他应用程序正在访问它。导致MJPEG解码的原因之一是因为我们要防止多个应用程序同时解码同一流,这将是重复的工作,因此会不必要地影响性能。

One of the main reasons that Windows is decoding MJPEG for your applications is because of performance. With the Anniversary Update to Windows 10, it is now possible for multiple applications to access the camera in ways that weren’t possible before. It was important for us to enable concurrent camera access, so Windows Hello, Microsoft Hololens and other products and features could reliably assume that the camera would be available at any given time, regardless of what other applications may be accessing it. One of the reasons this led to the MJPEG decoding is because we wanted to prevent multiple applications from decoding the same stream at the same time, which would be a duplicated effort and thus an unnecessary performance hit.

显然,这种改进使很多人感到意外。

Apparently this "improvement" caught many by surprise.

UPDATE 。已检测到通过创建如下定义的注册表值,可以在系统范围内禁用使用新Frame Server功能的行为。一旦Media Foundation API看到此值,它就会选择原始代码路径以直接绕过Frame Server与硬件(KS代理)进行对话。

UPDATE. It was detected that behavior to use new Frame Server feature can be disabled system wide by creating a registry value as defined below. Once Media Foundation API sees this value it chooses an original code path to talk to "hardware" (KS proxy) directly bypassing Frame Server.


  • 密钥名称:


    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Media Foundation\Platform(64位应用程序; 32位中的32位应用程序)操作系统)

    • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Media Foundation\Platform(64位OS中的32位应用程序)

    这篇关于Windows 10上不提供网络摄像头MJPG捕获流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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