適用於開發人員的混合實境擷取Mixed reality capture for developers

注意

請參閱下面 的 PV 攝影機 轉譯,以取得 HoloLens 2 新的 MRC 功能的指引。See Render from the PV camera below for guidance on a new MRC capability for HoloLens 2.

由於使用者可能會 在一段時間內 (的) 相片或影片,讓您在開發應用程式時,應該牢記幾件事。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. 這包括了 MRC 視覺品質的最佳作法,並在 MRCs 時回應系統變更。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 (第一代) 支援最高720p 的影片和相片,而 HoloLens 2 上的 MRC 可支援最高1080p 和最高4K 解析度的影像。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

依預設,mixed reality capture 會將適當的眼睛全像影像輸出與相片/影片 (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.

當混合式事實 capture (停止,或應用程式在混合式事實捕捉正在執行時停用 view 設定) : 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. 呼叫 SetEnabledMixedRealityCameraResizeMixedRealityCameraCall SetEnabledMixedRealityCamera and ResizeMixedRealityCamera
    • 使用 Size XSize 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 年5月更新,在顯示密碼或 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類別可供應用程式用來知道系統 mixed reality capture (針對音訊或影片) 執行時。The AppCapture class can be used by an app to know when system mixed reality capture is running (for either audio or video).

注意

如果裝置上沒有混合現實 capture,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 色板來 blend 影像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、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 在 HoloLens 上啟用時的預期結果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 執行的空間,因此應用程式不需要保留固定的預算保留,也不需要符合30fps 的 MRC 影片記錄幀率This 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
  • 錄製/串流處理常式時,在裝置上顯示的全息圖內容可能會顯示為「閃爍」:文字可能會變得更難閱讀,而全息圖邊緣可能會變得更 jaggy, (在 HoloLens 2 上選擇第三個相機轉譯,以避免此折衷) 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 Media Capture 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.

MixedRealityCapture. MixedRealityCaptureVideoEffect) 的 MRC 影片效果 (MRC Video Effect (Windows.Media.MixedRealityCapture.MixedRealityCaptureVideoEffect)

屬性名稱Property Name 類型Type 預設值Default Value 描述Description
StreamTypeStreamType UINT32 (MediaStreamType) 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,而 2d UWP 應用程式顯示受保護的內容,則會在耳機和混合式現實捕捉中,以受保護的內容材質取代 2d 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組建 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).

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

屬性名稱Property Name 類型Type 預設值Default Value 描述Description
MixerModeMixerMode UINT32UINT32 2 (Mic 和系統音訊) 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 適用于 mic 音量的增益。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組建 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)
  • 透過 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 2018 年10月更新 (或更新版本) 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 2018 年4月更新,存取 MRC 串流的多個應用程式就不再有限制 (不過,相片/攝影機的存取權仍有) 的限制。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