bytedeco/javacv

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

Open

#2,028 opened on May 16, 2023

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I have to admit that this might not be directly related to javacv as it might be a general ffmpeg problem but not 100% sure. There was recently a fix for the MAX_SLICES problem but it seems that DXVA2 still has problems to decode certain keyframes because the buffer returned from IDirectXVideoDecoder_GetBuffer is too small. Not sure what exactly is causing this issue but the logs from ffmpeg is printing out this

Error: [h264 @ 000001ba121896c0] Buffer for type 5 was too small. size: 58752, dxva_size: 55296 Error: [h264 @ 000001ba121896c0] Failed to add bitstream or slice control buffer Error: [h264 @ 000001ba121896c0] hardware accelerator failed to decode picture

All other decoder like D3D11VA, Cuvid or the software decoder have absolutly no problem with the keyframe. Seems to be only an issue with DXVA2. I hava a self compiled java-preset ffmpeg version so I could start to play around with some things but I don't have any idea where to start with. It might be possible that a patch could solve that problem.

I have a minimal reproducable example available here. All the logic can be found in the App.java class, instructions are in the README. When you execute the example you should receive a SUCESS with HW decoding message instead of the errors above.

Is this a known limitation of DXVA2? Anyone knows why the returned buffer might be too low?

Contributor guide