面向开发人员的混合现实捕获Mixed reality capture for developers

备注

有关适用于 HoloLens 2 的新 MRC 功能的指南,请参阅下面 的 PV 相机中的 RenderSee Render from the PV camera below for guidance on a new MRC capability for HoloLens 2.

由于用户可能会在任何时候都采用 混合现实捕获 (MRC) 照片或视频,因此,在开发应用程序时,应注意以下事项。Since a user could take a mixed reality capture (MRC) photo or video at any time, there are a few things that you should keep in mind when developing your application. 这包括在捕获 MRCs 时,可用于 MRC 视觉质量并响应系统更改的最佳实践。This includes best practices for MRC visual quality and being responsive to system changes while MRCs are being captured.

开发人员还可以将混合现实捕获和插入无缝集成到其应用中。Developers can also seamlessly integrate mixed reality capture and insertion into their apps.

HoloLens 上的 MRC (第一代) 支持最多720p 的视频和照片,而在 HoloLens 2 上,MRC on HoloLens (first-generation) supports videos and photos up to 720p, while MRC on HoloLens 2 supports videos up to 1080p and photos up to 4K resolution.

质量 MRC 的重要性The importance of quality MRC

混合现实捕获的照片和视频可能是用户对你的应用程序的第一次曝光。Mixed reality captured photos and videos are likely the first exposure a user will have of your app. 是否在 Microsoft Store 页面上或从其他用户共享社交网络上的 MRCs 混合现实屏幕截图。Whether as mixed reality screenshots on your Microsoft Store page or from other users sharing MRCs on social networks. 您可以使用 MRC 来演示您的应用程序、培训用户、鼓励用户共享其混合世界交互,以及进行用户研究和解决问题。You can use MRC to demo your app, educate users, encourage users to share their mixed world interactions, and for user research and problem solving.

MRC 如何影响你的应用How MRC impacts your app

在应用程序中启用 MRCEnabling MRC in your app

默认情况下,应用程序无需执行任何操作即可使用户接受混合的现实捕获。By default, an app does not have to do anything to enable users to take mixed reality captures.

在应用中为 MRC 启用改进的对齐方式Enabling improved alignment for MRC in your app

默认情况下,混合现实捕获会将适当眼睛的全息输出与照片/视频 (PV) 摄像组合在一起。By default, mixed reality capture combines the right eye's holographic output with the photo/video (PV) camera. 这两个源使用当前运行的沉浸式应用设置的焦点组合在一起。These two sources are combined using the focus point set by the currently running immersive app.

这意味着,由于 PV 摄像机与右显示) 之间的物理距离,因此焦点平面外的全息影像不会对齐 (。This means that holograms outside the focus plane won't align as well (due to the physical distance between the PV camera and the right display).

设置焦点Set the focus point

在 HoloLens) 上 (沉浸式应用程序时,应将 焦点 设置为要将其稳定平面置于何处。Immersive apps (on HoloLens) should set the focus point of where they want their stabilization plane to be. 这确保了耳机和混合现实捕获中的最佳对齐。This ensures the best alignment in both the headset and in mixed reality capture.

如果未设置焦点,则 "稳定" 平面将默认为两米。If a focus point is not set, the stabilization plane will default to two meters.

通过 PV 相机进行渲染 (选择加入) Render from the PV camera (opt-in)

HoloLens 2 添加了一种功能,使沉浸式应用能够在混合现实捕获运行时 从 PV 摄像机进行呈现HoloLens 2 adds the ability for an immersive app to render from the PV camera while mixed reality capture is running. 若要确保应用正确支持其他呈现,应用必须选择启用此功能。To ensure the app supports the additional render correctly, the app has to opt-in to this functionality.

PV 相机中的呈现功能与默认的 MRC 体验相比具有以下改进:Render from the PV camera offers the following improvements over the default MRC experience:

  • 与您的物理环境和双手 (进行近交互的全息图对齐) 应在所有距离上准确准确,而不是在默认 MRC 中看到的距离以外的距离。Hologram alignment to both your physical environment and hands (for near interactions) should be accurate at all distances, instead of having an offset at distances other than the focus point as you might see in the default MRC.
  • 头戴式耳机不会受到影响,因为它不会用于呈现 MRC 输出的全息影像。The right eye in the headset won't be compromised, as it won't be used to render the holograms for the MRC output.

可以通过以下三个步骤,通过 PV 相机实现呈现:There are three steps to enable rendering from the PV camera:

  1. 启用 PhotoVideoCamera HolographicViewConfigurationEnable the PhotoVideoCamera HolographicViewConfiguration
  2. 处理附加的 HolographicCamera 呈现Handle the additional HolographicCamera render
  3. 通过此附加 HolographicCamera 正确验证着色器和代码呈现Verify your shaders and code render correctly from this additional HolographicCamera
在 DirectX 中启用 PhotoVideoCamera HolographicViewConfigurationEnable the PhotoVideoCamera HolographicViewConfiguration in DirectX

若要选择从 PV 相机进行呈现,应用只需启用 PhotoVideoCamera 的 HolographicViewConfigurationTo opt-in to rendering from the PV Camera, an app simply enables the PhotoVideoCamera's HolographicViewConfiguration:

var display = Windows.Graphics.Holographic.HolographicDisplay.GetDefault();
var view = display.TryGetViewConfiguration(Windows.Graphics.Holographic.HolographicViewConfigurationKind.PhotoVideoCamera);
if (view != null)
{
    view.IsEnabled = true;
}
在 DirectX 中处理附加的 HolographicCamera 呈现Handle the additional HolographicCamera render in DirectX

当应用程序有选择地从 PV 相机进行呈现且混合现实捕获开始时:When the app has opt-in to render from the PV camera and mixed reality capture starts:

  1. HolographicSpace 的 CameraAdded 事件将激发。HolographicSpace's CameraAdded event will fire. 如果此时应用无法处理照相机,此事件可能会延迟。This event can be deferred if the app cannot handle the camera at this time.
  2. 事件完成后 (并且没有未完成的延迟) HolographicCamera 将在下一个 HolographicFrame 的 AddedCameras 列表中显示。Once the event has completed (and there are no outstanding deferrals) the HolographicCamera will appear in the next HolographicFrame's AddedCameras list.

当混合现实捕获停止时 (或应用在混合现实捕获正在运行时禁用了视图配置) : HolographicCamera 将显示在下一个 HolographicFrame 的 RemovedCameras 列表中,并激发 HolographicSpace 的 CameraRemoved 事件。When mixed reality capture stops (or if the app disables the view configuration while mixed reality capture is running): the HolographicCamera will appear in the next HolographicFrame's RemovedCameras list and the HolographicSpace's CameraRemoved event will fire.

已将 ViewConfiguration 属性添加到 HolographicCamera,以帮助标识相机所属的配置。A ViewConfiguration property has been added to HolographicCamera to help identify the configuration a camera belongs to.

在 Unity 中启用 PhotoVideoCamera HolographicViewConfigurationEnable the PhotoVideoCamera HolographicViewConfiguration in Unity

备注

这需要 unity 2018.4.13 f1unity 2019.3.0 f1或更高版本。This requires Unity 2018.4.13f1, Unity 2019.3.0f1, or newer.

若要选择从 PV 相机进行呈现,请在使用 混合现实工具包时,启用 Windows Mixed reality 相机设置 提供程序并 从 PV 相机设置中检查渲染To opt-in to rendering from the PV Camera, when using the Mixed Reality Toolkit, enable the Windows Mixed Reality Camera Settings provider and check the Render from PV Camera setting.

如果使用的不是混合现实工具包,则可以使用组件 手动选择启用 DirectX。If you're not using the Mixed Reality Toolkit, you can use a component to manually opt-in as described above for DirectX.

处理 Unity 中的其他 HolographicCamera 呈现Handle the additional HolographicCamera render in Unity

这是由 Unity 自动完成的。This is done for you automatically by Unity.

启用 Unreal 中的 PhotoVideoCamera HolographicViewConfigurationEnable the PhotoVideoCamera HolographicViewConfiguration in Unreal

备注

这需要 Unreal Engine 4.25 或更高版本。This requires Unreal Engine 4.25 or newer.

若要选择从 PV 摄像机进行渲染:To opt-in to rendering from the PV Camera:

  1. 调用 SetEnabledMixedRealityCamera 和 ResizeMixedRealityCamera Call SetEnabledMixedRealityCamera and ResizeMixedRealityCamera
    • 使用“尺寸 X”和“尺寸 Y”值设置视频尺寸。 Use the Size X and Size Y values to set the video dimensions.

第三人称摄像头

在 Unreal 中处理附加的 HolographicCamera 呈现Handle the additional HolographicCamera render in Unreal

这是由 Unreal 自动完成的。This is done for you automatically by Unreal.

验证着色器和代码支持其他相机Verify shaders and code support additional cameras

运行混合现实捕获,并检查是否存在异常对齐、缺少内容或性能问题。Run a mixed reality capture and check for unusual alignment, missing content, or performance issues. 根据需要更新着色器和代码。Update shaders and code as appropriate.

如果某些场景无法支持向其他相机进行呈现,则可以在 PhotoVideoCamera 的 HolographicViewConfiguration 中禁用它。If there are certain scenes that cannot support rendering to an additional camera, you can disable the PhotoVideoCamera's HolographicViewConfiguration during them.

在应用中禁用 MRCDisabling MRC in your app

2D 应用2D app

当混合现实捕获正在运行时,2D 应用可以选择使其视觉内容遮盖:2D apps can choose to have their visual content obscured when mixed reality capture is running by:

沉浸式应用Immersive app

沉浸式应用可通过以下方式选择将其视觉内容从混合现实捕获中排除:Immersive apps can choose to have their visual content excluded from mixed reality capture by:

密码键盘Password Keyboard

使用 Windows 10 的2019更新可能会在密码或 pin 键盘可见时,自动从混合现实捕获中排除可视内容。With the Windows 10 May 2019 Update, visual content is automatically excluded from mixed reality capture when a password or pin keyboard is visible.

了解 MRC 何时处于活动状态Knowing when MRC is active

应用程序可以使用 AppCapture 类来了解系统混合现实捕获运行的时间 (音频或视频) 。The AppCapture class can be used by an app to know when system mixed reality capture is running (for either audio or video).

备注

如果混合现实捕获在设备上不可用,则 AppCapture 的 GetForCurrentView API 可以返回 null。AppCapture's GetForCurrentView API can return null if mixed reality capture isn't available on the device. 在应用暂停时取消注册 CapturingChanged 事件也很重要,否则可能会进入 "已阻止" 状态。It's also important to de-register the CapturingChanged event when your app is suspended, otherwise MRC can get into a blocked state.

(HoloLens 特定) 的最佳实践Best practices (HoloLens-specific)

对于开发人员而言,MRC 应该无需额外工作就能正常运行,但需要注意一些事项,以便为应用提供最佳混合现实体验。MRC is expected to work without additional work from developers, but there are a few things to be aware of to provide the best mixed reality capture experience of your app.

MRC 使用全息图的 alpha 通道与 相机 图像混合MRC uses the hologram’s alpha channel to blend with the camera imagery

最重要的步骤是确保您的应用程序清除为透明黑色,而不是清除为不透明的黑色。The most important step is to make sure your app is clearing to transparent black instead of clearing to opaque black. 在 Unity 中,这是默认情况下通过 MixedRealityToolkit 完成的,但是如果是在非 Unity 中进行开发,则可能需要更改一行。In Unity, this is done by default with the MixedRealityToolkit but if you are developing in non-Unity, you may need to make a one line change.

如果你的应用未清除透明黑色,以下是你可能会在 MRC 中看到的一些项目:Here are some of the artifacts you might see in MRC if your app is not clearing to transparent black:

示例失败:内容周围的黑色边缘 (未能清除透明黑色) Example Failures: Black edges around the content (failing to clear to transparent black)

Failing to clear to transparent black: black edge artifacts around holograms Failing to clear to transparent black: black edge artifacts around holograms

示例失败:全息图的整个背景场景显示为黑色。Example Failures: The entire background scene of the hologram appears black. 将背景 alpha 值设置为1会导致黑色背景Setting a background alpha value of 1 results in a black background

将背景 alpha 值设置为1会导致黑色背景

预期结果:如果清除为透明黑色,全息影像会与实际的 (预期结果相结合) Expected Result: Holograms appear properly blended with the real-world (expected result if clearing to transparent black)

清除为透明黑色时的预期结果

解决方案Solution:

  • 将显示为不透明黑色的任何内容更改为 alpha 值0。Change any content that is showing up as opaque black to have an alpha value of 0.
  • 确保应用清除为透明黑色。Ensure that the app is clearing to transparent black.
  • Unity 默认为明文以使用 MixedRealityToolkit 自动清除,但如果它是非 Unity 应用,应修改与 ID3D11DeiceContext:: ClearRenderTargetView 一起使用的颜色 ( # A1。Unity defaults to clear to clear automatically with the MixedRealityToolkit, but if it’s a non-Unity app you should modify the color used with ID3D11DeiceContext::ClearRenderTargetView(). 您需要确保清除透明的黑色 (0,0,0,0,0) 而不是不透明的黑色 (0,0,0,1) 。You want to ensure you clear to transparent black (0,0,0,0) instead of opaque black (0,0,0,1).

你现在可以根据需要调整资产的 alpha 值,但通常不需要这样做。You can now tune the alpha values of your assets if you’d like, but typically don’t need to. 大多数情况下,MRCs 将看起来不错。Most of the time, MRCs will look good out of the box. MRC 假设预乘 alpha。MRC assumes pre-multiplied alpha. Alpha 值仅影响 MRC 捕获。The alpha values will only affect the MRC capture.

在 HoloLens 上启用了 MRC 时应发生的情况What to expect when MRC is enabled on HoloLens

以下各项适用于 HoloLens (第一代) 和 HoloLens 2,除非另有说明:The following apply to both HoloLens (first-generation) and HoloLens 2, unless otherwise noted:

  • 系统会将应用程序限制为30Hz 呈现。The system will throttle the application to 30Hz rendering. 这会为 MRC 创建一些空间,使应用无需保留固定预算预留,同时还可与30fpsThis creates some headroom for MRC to run so the app doesn’t need to keep a constant budget reserve and also matches the MRC video record framerate of 30fps
  • 录制/流式处理 MRC 时,在设备上看到的全息图内容可能会显示为 "火花":文本可能会变得更难以阅读,在 HoloLens) 2 上 jaggy 的第三个照相机渲染可能会出现更多的 (Hologram content in the right eye of the device may appear to “sparkle” when recording/streaming MRC: text may become more difficult to read and hologram edges may appear more jaggy (opting-in to 3rd camera render on HoloLens 2 avoids this compromise)
  • 当应用程序启用了应用程序时,MRC 照片和视频将遵循应用程序的 重点点 ,这将有助于确保全息影像精确定位。MRC photos and videos will respect the application’s focus point if the application has enabled it, which will help ensure holograms are accurately positioned. 对于视频,重点是平滑的,因此,如果焦点深度发生变化,全息影像可能会慢慢地发生缓慢偏移。For videos, the Focus Point is smoothed so holograms may appear to slowly drift into place if the Focus Point depth changes significantly. 处于焦点不同深度的全息影像可能会显示与现实世界不同的偏移 (请参阅下面的示例,其中焦点设置为2米,而全息图位于1米) 。Holograms that are at different depths from the focus point may appear offset from the real world (see example below where Focus Point is set at 2 meters but hologram is positioned at 1 meter).

2米的全息影像会完全注册到世界。

在应用中集成 MRC 功能Integrating MRC functionality from within your app

混合现实应用可以从应用内启动 MRC 照片或视频捕获,而捕获的内容将在应用中提供,而不会存储到设备的 "照相机"。Your mixed reality app can initiate MRC photo or video capture from within the app, and the content captured is made available to your app without being stored to the device's "Camera roll." 您可以创建自定义的 MRC 记录器或利用内置的相机捕获 UI。You can create a custom MRC recorder or take advantage of built-in camera capture UI.

带有内置照相机 UI 的 MRCMRC with built-in camera UI

开发人员只需编写几行代码,即可使用 相机捕获 UI API 获取用户捕获的混合现实照片或视频。Developers can use the Camera Capture UI API to get a user-captured mixed reality photo or video with just a few lines of code.

此 API 启动内置的 MRC 相机 UI,用户可以从中拍摄照片或视频,并将生成的捕获返回到应用。This API launches the built-in MRC camera UI, from which the user can take a photo or video, and returns the resulting capture to your app. 如果你想要创建自己的照相机 UI,或者需要对捕获流进行较低级别的访问,则可以创建自定义混合现实记录。If you want to create your own camera UI, or need lower-level access to the capture stream, you can create a custom Mixed Reality Capture recorder.

创建自定义 MRC 记录器Creating a custom MRC recorder

尽管用户可以始终使用系统 MRC 捕获服务来触发照片或视频,但应用程序可能需要构建自定义相机应用程序,但在照相机流中包含全息影像,就像 MRC 一样。While the user can always trigger a photo or video using the system MRC capture service, an application may want to build a custom camera app but include holograms in the camera stream just like MRC. 这允许应用程序代表用户启动捕获、生成自定义录制 UI,或自定义 MRC 设置以命名几个示例。This allows the application to kick off captures on behalf of the user, build custom recording UI, or customize MRC settings to name a few examples.

HoloStudio 使用 MRC 效果添加自定义 MRC 相机HoloStudio adds a custom MRC camera using MRC effects

HoloStudio 使用 MRC 效果添加自定义 MRC 相机

Unity 应用程序应看到属性 Locatable_camera_in_Unity ,以启用全息影像。Unity Applications should see Locatable_camera_in_Unity for the property to enable holograms.

其他应用程序可以通过使用 Windows 媒体捕获 api 控制相机并添加 MRC 视频和音频效果来包括静止图像和视频中的虚拟全息影像和应用程序音频,来实现此目的。Other applications can do this by using the Windows Media Capture APIs to control the Camera and add an MRC Video and Audio effect to include virtual holograms and application audio in stills and videos.

应用程序有两个选项可添加效果:Applications have two options to add the effect:

备注

Visual Studio 将无法识别 MixedRealityCapture 命名空间,但字符串仍然有效。The Windows.Media.MixedRealityCapture namespace will not be recognized by Visual Studio, but the strings are still valid.

MRC 视频效果 (MixedRealityCaptureVideoEffect) MRC Video Effect (Windows.Media.MixedRealityCapture.MixedRealityCaptureVideoEffect)

属性名称Property Name 类型Type 默认值Default Value 描述Description
StreamTypeStreamType UINT32 (mediastreamtype.video) UINT32 (MediaStreamType) 1 (VideoRecord) 1 (VideoRecord) 描述此影响所使用的捕获流。Describe which capture stream this effect is used for. 音频不可用。Audio is not available.
HologramCompositionEnabledHologramCompositionEnabled booleanboolean trueTRUE 用于在视频捕获中启用或禁用全息影像的标志。Flag to enable or disable holograms in video capture.
RecordingIndicatorEnabledRecordingIndicatorEnabled booleanboolean trueTRUE 用于在全息影像捕获期间启用或禁用录制指示器的标志。Flag to enable or disable recording indicator on screen during hologram capturing.
VideoStabilizationEnabledVideoStabilizationEnabled booleanboolean falseFALSE 用于启用或禁用由 HoloLens 跟踪器支持的视频稳定的标志。Flag to enable or disable video stabilization powered by the HoloLens tracker.
VideoStabilizationBufferLengthVideoStabilizationBufferLength UINT32UINT32 00 设置视频抖动使用的历史帧数。Set how many historical frames are used for video stabilization. 从电源和性能的角度来看,0从0到延迟,几乎是 "免费"。0 is 0-latency and nearly "free" from a power and performance perspective. 15对于最高质量 (建议使用15帧延迟和内存) 。15 is recommended for highest quality (at the cost of 15 frames of latency and memory).
GlobalOpacityCoefficientGlobalOpacityCoefficient FLOATfloat 0.9 (HoloLens) 1.0 (沉浸式耳机) 0.9 (HoloLens) 1.0 (Immersive headset) 将范围从 0.0 (完全透明) 到 (1.0 的全局不透明度系数设置为完全不透明) 。Set global opacity coefficient of hologram in range from 0.0 (fully transparent) to 1.0 (fully opaque).
BlankOnProtectedContentBlankOnProtectedContent booleanboolean falseFALSE 用于启用或禁用在有显示受保护内容的 2d UWP 应用时返回空帧的标志。Flag to enable or disable returning an empty frame if there is a 2d UWP app showing protected content. 如果此标志为 false,并且二维 UWP 应用显示受保护的内容,则在耳机和混合现实捕获中,二维 UWP 应用将替换为受保护的内容纹理。If this flag is false and a 2d UWP app is showing protected content, the 2d UWP app will be replaced by a protected content texture in both the headset and in the mixed reality capture.
ShowHiddenMeshShowHiddenMesh booleanboolean falseFALSE 用于启用或禁用显示全息相机隐藏区域网格和相邻内容的标志。Flag to enable or disable showing the holographic camera's hidden area mesh and neighboring content.
OutputSizeOutputSize 大小Size 0, 00, 0 在裁剪视频稳定性后设置所需的输出大小。Set the desired output size after cropping for video stabilization. 如果指定了0或指定了无效的输出大小,则选择默认裁剪大小。A default crop size is chosen if 0 or an invalid output size is specified.
PreferredHologramPerspectivePreferredHologramPerspective UINT32UINT32 Windows 设备门户中的 "从相机呈现" 设置Render from Camera setting in the Windows Device Portal 用于指示应捕获的全息相机视图配置的枚举: 0 (显示) 意味着不会要求应用从照片/视频相机进行渲染,1 (PhotoVideoCamera) 会要求应用从照片/视频摄像机, (应用程序支持它) 。Enum used to indicate which holographic camera view configuration should be captured: 0 (Display) means that the app won't be asked to render from the photo/video camera, 1 (PhotoVideoCamera) will ask the app to render from the photo/video camera (if the app supports it). 仅在 HoloLens 2 上受支持Only supported on HoloLens 2

备注

可以通过转到混合现实捕获页面并取消选中 "从相机中进行渲染",在 Windows 设备门户中更改PreferredHologramPerspective的默认值。You can change the default value of PreferredHologramPerspective in the Windows Device Portal by going to the Mixed Reality Capture page and unchecking Render from Camera. 设置默认为 **1 (PhotoVideoCamera) **,但可以取消选中以将其设置为 **0 (显示) **。The setting defaults to 1 (PhotoVideoCamera), but can be unchecked to set it to 0 (Display).

PreferredHologramPerspective的默认值为0 (显示2020 年6月版 (Windows 全息版、版本2004内部版本19041.1106 和 windows 全息版 1903 build 18362.1064) 之前) 显示。The default value of PreferredHologramPerspective was 0 (Display) prior to the June 2020 update (Windows Holographic, version 2004 build 19041.1106 and Windows Holographic, version 1903 build 18362.1064).

(MixedRealityCaptureAudioEffect) 的 MRC 音频效果MRC Audio Effect (Windows.Media.MixedRealityCapture.MixedRealityCaptureAudioEffect)

属性名称Property Name 类型Type 默认值Default Value 描述Description
MixerModeMixerMode UINT32UINT32 2 (麦克风和系统音频) 2 (Mic and System audio) 用于指示应使用的音频源的枚举: 0 (Mic 音频) ,1 (系统音频仅) ,2 (Mic 和系统音频) Enum used to indicate which audio sources should be used: 0 (Mic audio only), 1 (System audio only), 2 (Mic and System audio)
LoopbackGainLoopbackGain FLOATfloat Windows 设备门户中的应用音频增益设置App Audio Gain setting in the Windows Device Portal 适用于系统音频音量的增益。Gain to apply to system audio volume. 范围为0.0 到5.0。Ranges from 0.0 to 5.0. 仅在 HoloLens 2 上受支持Only supported on HoloLens 2
MicrophoneGainMicrophoneGain FLOATfloat Windows 设备门户中的Mic 音频增益设置Mic Audio Gain setting in the Windows Device Portal 适用于麦克风音量的增益。Gain to apply to mic volume. 范围为0.0 到5.0。Ranges from 0.0 to 5.0. 仅在 HoloLens 2 上受支持Only supported on HoloLens 2

备注

可以通过转到混合现实捕获页面并调整其各自设置旁的滑块来更改 Windows 设备门户中LoopbackGainMicrophoneGain的默认值。You can change the default value of LoopbackGain or MicrophoneGain in the Windows Device Portal by going to the Mixed Reality Capture page and adjusting the slider next to their respective settings. 这两个设置默认为 1.0,但可以设置为 0.05.0之间的任何值。Both settings default to 1.0, but can be set to any value between 0.0 and 5.0.

在2020年6月的更新中,使用 Windows 设备门户配置默认增益 (Windows 全息版、版本2004版本19041.1106 和 Windows 全息版 1903 build 18362.1064) 。Using Windows Device Portal to configure the default gain values was added with the June 2020 update (Windows Holographic, version 2004 build 19041.1106 and Windows Holographic, version 1903 build 18362.1064).

同时 MRC 限制Simultaneous MRC limitations

同时访问 MRC 的多个应用有一定的限制。There are certain limitations around multiple apps accessing MRC at the same time.

照片/视频相机访问Photo/video camera access

照片/视频摄像机限制为可同时访问的进程数。The photo/video camera is limited to the number of processes that can access it at the same time. 当某个进程录制视频或拍摄照片时,将无法获取照片/视频相机。While a process is recording video or taking a photo any other process will fail to acquire the photo/video camera. (这适用于混合现实捕获和标准相片/视频捕获) (this applies to both Mixed Reality Capture and standard photo/video capture)

使用 HoloLens 2,应用程序可以使用 MediaCaptureInitializationSettings 的 SharingMode 属性来指示他们希望在不需要对照片/视频摄像机进行独占控制的情况下运行 SharedReadOnly。With HoloLens 2, an app can use MediaCaptureInitializationSettings' SharingMode property to indicate that they want to run SharedReadOnly if they don't need exclusive control over the photo/video camera. 这样做意味着捕获的分辨率和帧速率将限制为其他应用已配置照相机提供的内容。Doing so means the resolution and framerate of the capture will be limited to what other apps have configured the camera to provide.

内置的 MRC 照片/视频相机访问Built-in MRC photo/video camera access

通过 Cortana、开始菜单、硬件快捷方式、Miracast、Windows 设备门户) 内置于 Windows 10 (的 MRC 功能:MRC functionality built into Windows 10 (via Cortana, Start Menu, hardware shortcuts, Miracast, Windows Device Portal):

  • 默认情况下,将使用 ExclusiveControl 运行Will run with ExclusiveControl by default

但是,对每个要在共享模式下运行的子系统添加了支持:However, support has been added to each subsystem to operate in a shared mode:

  • 如果应用请求 ExclusiveControl 访问照片/视频摄像机,内置的 MRC 会自动停止使用照片/视频相机,因此应用的请求将会成功。If an app requests ExclusiveControl access to the photo/video camera, built-in MRC will automatically stop using the photo/video camera so the app's request will succeed
  • 如果在某个应用具有 ExclusiveControl 的情况下启动内置的 MRC,内置的 MRC 将在 SharedReadOnly 模式下运行If built-in MRC is started while an app has ExclusiveControl, built-in MRC will run in SharedReadOnly mode

此共享模式功能有一些限制:This shared mode functionality has certain restrictions:

  • 照片通过 Cortana、硬件快捷方式或 "开始" 菜单:需要 Windows 10 2018 年4月更新 (或更高版本) Photo via Cortana, hardware shortcuts, or Start Menu: Requires the Windows 10 April 2018 Update (or later)
  • 视频 via Cortana、硬件快捷方式或 "开始" 菜单:需要 Windows 10 2018 年4月更新 (或更高版本) Video via Cortana, hardware shortcuts, or Start Menu: Requires the Windows 10 April 2018 Update (or later)
  • 通过 Miracast 流式处理 MRC:需要 Windows 10 10 月2018更新 (或更高版本) Streaming MRC over Miracast: Requires the Windows 10 October 2018 Update (or later)
  • 通过 Windows 设备门户或 HoloLens 随附应用的流式处理 MRC:需要 HoloLens 2Streaming MRC over Windows Device Portal or via the HoloLens companion app: Requires HoloLens 2

备注

当另一个应用正在使用照片/视频摄像机时,内置 MRC 相机 UI 的分辨率和帧速率可能会从其正常值中减少。The resolution and framerate of the built-in MRC camera UI might be reduced from its normal values when another app is using the photo/video camera.

MRC 访问MRC access

使用 Windows 10 4 2018 月版更新后,多个应用程序无法再限制访问 MRC 流 (但是,对 photo/视频摄像机的访问仍有) 的限制。With the Windows 10 April 2018 Update, there is no longer a limitation around multiple apps accessing the MRC stream (however, the access to the photo/video camera still has limitations).

在 Windows 10 2018 年4月更新之前,应用程序的自定义 MRC 记录器与系统 MRC 互斥, (从 Windows 设备门户) 捕获照片、捕获视频或流式处理。Previous to the Windows 10 April 2018 Update, an app's custom MRC recorder was mutually exclusive with system MRC (capturing photos, capturing videos, or streaming from the Windows Device Portal).

请参阅See also