Failed to decode h264 frame with DXVA2.0 because returned buffer is to small

Grill2010 15 Reputation points
2023-05-15T16:33:59.3+00:00

Hi,

I'm currently developing a streaming application with HW-Acceleration for Windows, so far everything works fine but using DXVA2 hw accerlation the decoder has problem to decode certain keyframes. I searched for a long time on the internet already but could not find any solution to my problem. I'm using ffmpeg and the reason for not be able to decode that video slice is because the buffer returned from the IDirectXVideoDecoder_GetBuffer function was too small

this is where the error is occurs

I found a question in regards a similar problem but it was never answered. The problem is not present when using a software decoder, D3D11VA or cuda hw acceleration. I attach her the hex value of the key frame here (with sps and pps prepended).

h264_test_key_frame.txt

I can compile ffmpeg and could start playing around with it, but I have absolutely no idea what factors the returned buffer size depends on. Is this a limitation of the DXVA2 decoder in general? Are there any settings which one must provide to the decoder so it will be able to deal with larger frame slices? I'm a little bit lost here and if I could get some inputs here of what I can try I would really appreciate that.

If necessary I can provide a minimal reproducable example although I have to admit that I use javacv bindings to the native ffmpeg functions.

Windows development | Windows API - Win32
Developer technologies | C++
{count} votes

1 answer

Sort by: Most helpful
  1. Grill2010 15 Reputation points
    2023-05-17T23:24:05.8766667+00:00

    @Xiaopo Yang - MSFT I tried now on a 3rd test device a Surface with Intel GPU and to my surprise it my example works perfectly fine there. No issues with DXVA2? Could this be a Nvidea driver problem or a Windows problem in combination with Nvidea GPUs? This is definitely not normal behaviour and I'm curious what's the root cause of the problem.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.