Skip to content
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

AugmentedMediaSource not work #29

Closed
comor86 opened this issue Apr 24, 2022 · 3 comments
Closed

AugmentedMediaSource not work #29

comor86 opened this issue Apr 24, 2022 · 3 comments

Comments

@comor86
Copy link

comor86 commented Apr 24, 2022

The simpleMediaSource and HWMediaSource work well on my computer. But with AugmentedMediaSource, I have tried many times, like using UWP, using Installer, changing some codes, and virtual camera can be created,but no image shown in preview or CameraApp. When I select the AugmentedMediaSource option, the Installer will crash and UWP reports an unspecified error. the CameraApp also reports an error.

image

image

@comor86
Copy link
Author

comor86 commented Apr 25, 2022

For clean show, I changed some log code. and crash log like below.
image

@LPBourret
Copy link
Contributor

Hi,
yes I see the issue, as you can see in the trace, AugmentedMediaStream::Initialize() will filter through the set of MediaTypes exposed on the source you want to wrap and will keep only the one it can understand (i.e. in this case NV12 MediaTypes below 1080p at max 30fps. Problem is that first this routine runs on the client side and I assume your USB camera exposes MJPEG MediaTypes.. which FrameServer duplicates as well as NV12 MediaTypes (decode on the fly. However, when the virtual camera is then created on the frame server side, it does not have access to those MJPEG->NV12 MediaTypes and does not find any other compliant MediaType on any pin of the camera and fails to expose a stream.. (0xc00d36b4 == MF_E_INVALIDMEDIATYPE). There are a couple of things you can do to accommodate your camera in Windows 11 build 22000, although note that in the next release of Windows 11 there will be a new API to avoid this problem entirely..

You could accept MJPEG MediaType to go through in AugmentedMediaStream::Initialize() (and expose them out as NV12 MediaTypes) and insert a MJPEG decoder to decode samples on the fly on your own (see IMFTransform https://docs.microsoft.com/en-us/windows/win32/medfound/basic-mft-processing-model?redirectedfrom=MSDN

I think we need to provide a sample to do this anyway and I will take it as an action item

@comor86
Copy link
Author

comor86 commented Jul 28, 2022

Thanks very much for the email to guide me fix this, I've made this work.
https://github.com/comor86/Windows-Camera

@comor86 comor86 closed this as completed Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants