-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win-mf: Add Windows Media Foundation Capture Device and Intel NPU AI features #10471
base: master
Are you sure you want to change the base?
Conversation
fc46b24
to
0584cda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a more descriptive commit message.
In C++ for variables/functions/identifiers that remain in C++, we prefer camelCase over snake_case.
Is it possible to, at minimum, split this into two commits, or perhaps two PRs:
- Add Media Foundation
- Add the NPU features
c8280fd
to
dcea1bb
Compare
|
The deps updated with obsproject/obs-deps#242 was merged, so this is no longer a draft, but it will need to be rebased. |
So I was able to get this building with current deps, however it does not work on Windows 10. This is due to usage of IMFCameraControlMonitor. I assume this is expected, but I'm noting it for posterity.
|
I launched this PR on a Windows 11 Insider build, and got a crash when adding the source. Snippets:
Full logs (session and crash): |
It looks like the Crash logs are from the Windows 10 build, are there any from your attempt at adding the source on Windows 11? |
This builds and runs on Windows 11 23H2 with the Windows 11 SDK (10.0.22621.0). The "Video Capture Device 2" is available and correctly loads my webcam. However, in Debug configuration, it spams the log with the following: log spam
Given the log spam, I wonder if something is not appropriately gated. Appropriately, since the hardware I'm testing on at the moment does not have an NPU, I do not see the NPU features (background removal, eye gaze correction, etc.). I will re-check on capable hardware at a later time. |
plugins/win-mf/mf-plugin.cpp
Outdated
obs_data_t *obs_settings = obs_data_create(); | ||
obs_apply_private_data(obs_settings); | ||
obs_data_release(obs_settings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obs_data_t *obs_settings = obs_data_create(); | |
obs_apply_private_data(obs_settings); | |
obs_data_release(obs_settings); |
Unnecessary line of code, since the settings instance is not even modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out; it should be removed now.
The current implementation of this PR will also need to bump the minimum Windows SDK version to 22621 due to the usage of IMFCameraControlNotify. obs-studio/cmake/windows/compilerconfig.cmake Lines 45 to 47 in 8b975c4
|
obs_property_set_long_description(p, | ||
obs_module_text("Buffering.ToolTip")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This configures the "Buffering.ToolTip" text onto the "FPS" dropdown. If there is no plan to keep Buffering, I recommend going through and deleting related buffering code, otherwise re-introduce the Buffering toggle and assign this tooltip to it.
@thyintel I was able to track down the crash to the fact I have NDI Virtual Input installed. I expect the crash is not limited to this particular virtual camera device, but rather any device where the extended controls aren't implemented/available. This was my workaround, which fixes the crash but still allows the camera to appear in the list: diff --git a/plugins/win-mf/libmfcapture/source/PhysicalCamera.cpp b/plugins/win-mf/libmfcapture/source/PhysicalCamera.cpp
index 65c4a8815..48b7052df 100644
--- a/plugins/win-mf/libmfcapture/source/PhysicalCamera.cpp
+++ b/plugins/win-mf/libmfcapture/source/PhysicalCamera.cpp
@@ -1360,6 +1360,9 @@ HRESULT PhysicalCamera::GetMepSetting(MepSetting &setting)
bool blur, shallowfocus, mask, autoframing, eyegaze;
+ if (m_spExtController == nullptr)
+ return S_OK;
+
RETURN_IF_FAILED(GetBlur(blur, shallowfocus, mask));
setting.Blur = blur;
setting.ShallowFocus = shallowfocus; |
Thank you for the suggestion, I changed the code to include this :) |
I think I see what is happening with the build failure. While the Windows runners have CMake 3.30.2 installed, our CMake specifies: cmake_minimum_required(VERSION 3.22...3.25) This sets the CMake
This means that, because the runners are currently running Windows 10.0.20348, CMake running on them will select the Windows10SDK.20348 by default, because the To get CI to build this PR, we would have to do one of the following: cc @PatTheMav |
I have a CMake 3.27 update ready, but given that Ubuntu 24.04 provides CMake 3.28 it might make more sense to get straight to that (macOS default would be CMake 3.30, but most recent Visual Studio-provided version is also 3.28). |
A minor correction: Visual Studio 17.11 (the current stable release) provides CMake 3.29.5. |
84577d8
to
677be88
Compare
677be88
to
2b117ff
Compare
Description
PR is linked with: obsproject/obs-deps#242 (Requires wil headers to build)
Windows 11 is also required for this PR to build and Windows 11 SDK (10.0.22000.0).
This is a draft implementation of Intel AI features using the NPU(=”Intel AI Boost”) on Intel Core Ultra(a.k.a Meteor Lake).
It enables Background Blur(Standard and Portrait), Background Removal, Auto Framing and Eye Contact correction over new Microsoft Effect Package and Media Foundation.
Because this capture device is based on Media Foundation, we created separate “Video Capture Device 2”. We are thinking that it’s better to integrate it into the existing DShow based Video Capture Device in order to not to make end-users confused.
Thus, we need help for (1) overall design guidance how we can integrate - how we can kick off MF based device instead of DShow base, (2) Any missing features to get merged? Because we focus on prototyping new AI features, wondering if we’re missing something on the MF device.
BTW, this feature only works on OEM integrated web-cam, external USB camera is planned to be supported for the future, but not yet supported as of March 2024, no ETA announced.
Screen shots:
GPU 99%, NPU 30% over 3D Mark, w/ AI features are enabled
New UI for AI – Background Blur, Removal, Auto Framing, Eye Contact by NPU(=Intel AI Boost)
they only appear on MTL, otherwise this section would be skipped.
Motivation and Context
Utilize Intel NPU for OBS and be able to add AI capabilities in OBS for Intel devices.
How Has This Been Tested?
This has been tested on:
Types of changes
Checklist: