How to encode IMFSample from Windows Duplication API to H264?

0

I'm looking for a working alternative to make this work

My target is a Generic Computer(so it would tentatively work on every's client computer), i've tried for months with the IMFTransform library, but on my computer (even with different filters on MFTEnumEx), I couldn't get an IMFTransform that was d3d11_aware [I've asked on this page and tried all of these answers : How to get an IMFTransform that is d3d_aware (To encode input from Windows Duplication API to H264)? ]

Since this library isn't working for me, I'm looking for an alternative. I've heard there is FFMPEG for encoding, but so far i couldn't find evidence it can take DXGI_FORMAT_B8G8R8A8_UNORM as input . If there is a way, i will go full gas on researching it , I only need direction

edit1 (on edit2 i'll leave the fix of this, in case it can help someone ) :

The problem apparently was when retrieving imfAttributes, it was coming empty I've just found that with Hardware_flag filter there actually is one at ppActivate[0], but I get an Exception when i check it's attributtes, when i jump the step of checking on the ppActivates[] if MF_SA_D3D_AWARE, apparently the IMFTransform works fine

IMFAttributes* imfAttributes;
CatchError(pTransform->GetAttributes(&imfAttributes), (LPSTR)"Error getAttributes from pTransform");
CatchError(imfAttributes->GetUINT32(MF_SA_D3D_AWARE,0), (LPSTR)"Error pTransform not D3D_AWARE"); 

when running, at the last line i got Exception thrown at 0x00007FFC7EEED4CB (mfplat.dll) in VRscreenStreamer.exe: 0xC0000005: Access violation writing location 0x0000000000000000

edit2 :To fix that, i used MFGetAttributeUINT32 instead of GetUINT32 :

BOOL bD3DAware = FALSE;
bD3DAware = MFGetAttributeUINT32(imfAttributes, MF_SA_D3D11_AWARE, FALSE);
winapi
video
directx-11
ms-media-foundation
desktop-duplication
asked on Stack Overflow Jan 11, 2020 by Ezequiel Berazategui • edited Jan 12, 2020 by Ezequiel Berazategui

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0