Intel graphics hardware H264 MFT ProcessInput call fails after feeding few input samples, the same works fine with Nvidia hardware MFT

后端 未结 2 1067
野的像风
野的像风 2020-12-10 06:04

I\'m capturing the desktop using DesktopDuplication API and converting the samples from RGBA to NV12 in GPU and feeding the same to MediaFoundation hardware H264 MFT. This w

2条回答
  •  半阙折子戏
    2020-12-10 06:50

    I looked at your code.

    According to your post, i suspect an Intel video processor problem.

    My OS is Win7, so i decide to test the video processor behaviour with a D3D9Device on my Nvidia card, and then on an Intel HD Graphics 4000.

    I suppose the video processor capabilities will behave the same way for a D3D9Device as for a D3D11Device. Of course it will be necessary to check.

    So i made this program to check : https://github.com/mofo7777/DirectXVideoScreen (see D3D9VideoProcessor sub-project)

    It seems you do not check sufficient things about the video processor capabilities.

    With IDXVAHD_Device::GetVideoProcessorDeviceCaps, here is what i check :

    DXVAHD_VPDEVCAPS.MaxInputStreams > 0

    DXVAHD_VPDEVCAPS.VideoProcessorCount > 0

    DXVAHD_VPDEVCAPS.OutputFormatCount > 0

    DXVAHD_VPDEVCAPS.InputFormatCount > 0

    DXVAHD_VPDEVCAPS.InputPool == D3DPOOL_DEFAULT

    I also check input and output format supported with IDXVAHD_Device::GetVideoProcessorOutputFormats and IDXVAHD_Device::GetVideoProcessorInputFormats.

    This is where i found a difference between Nvidia GPU and Intel GPU.

    NVIDIA : 4 output format

    • D3DFMT_A8R8G8B8
    • D3DFMT_X8R8G8B8
    • D3DFMT_YUY2
    • D3DFMT_NV12

    INTEL : 3 output format

    • D3DFMT_A8R8G8B8
    • D3DFMT_X8R8G8B8
    • D3DFMT_YUY2

    On Intel HD Graphics 4000, there is no support for the NV12 output format.

    Also for the program to work correctly, i need to setup stream state before using VideoProcessBltHD :

    • DXVAHD_STREAM_STATE_D3DFORMAT
    • DXVAHD_STREAM_STATE_FRAME_FORMAT
    • DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE
    • DXVAHD_STREAM_STATE_SOURCE_RECT
    • DXVAHD_STREAM_STATE_DESTINATION_RECT

    For D3D11 :

    ID3D11VideoProcessorEnumerator::GetVideoProcessorCaps == IDXVAHD_Device::GetVideoProcessorDeviceCaps

    (D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT) ID3D11VideoProcessorEnumerator::CheckVideoProcessorFormat == IDXVAHD_Device::GetVideoProcessorOutputFormats

    (D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT) ID3D11VideoProcessorEnumerator::CheckVideoProcessorFormat == IDXVAHD_Device::GetVideoProcessorInputFormats

    ID3D11VideoContext::(...) == IDXVAHD_VideoProcessor::SetVideoProcessStreamState

    Could you first verify the video processor capabilities of your GPU. Do you see same difference as i see ?

    This is the first thing we need to know, and it seems your program does not check this, from what i've seen on your github project.

提交回复
热议问题