[Libav-user] HW Decode d3d11va Failing for VP9/AV1 Videos

Mark Thompson sw at jkqxz.net
Wed Mar 13 23:54:32 EET 2024


On 05/03/2024 15:45, Sebastiaan Geus via Libav-user wrote:
> Hi,
> 
> I am using d3d11va hardware acceleration for decoding video’s in Unity I use the d3d11 pix_fmt to directly copy the output texture to unity.
> 
> This now works fine for h264 /h265 video’s but both vp9 and av1 video’s produce : Static surface pool size exceeded. & get_buffer() failed on decode.
> 
> Here is a log that I save from my application lines with a @ prefix are from the av_log_set_callback.
> 
> Query available decoder id.
> 
> Decoder does not exist.
> 
> Using d3d11va HWDecoder
> 
> config loading success.
> 
> USE_TCP=false
> 
> BUFF_VIDEO_MAX=18
> 
> BUFF_AUDIO_MAX=128
> 
> SEEK_ANY=false
> 
> @ Opening 'C:\FFmpeg\bin\Download\out9.webm' for reading
> 
> @ Setting default whitelist 'file,crypto,data'
> 
> @ Probing h263 score:25 size:2048
> 
> @ Probing matroska,webm score:100 size:2048
> 
> @ Format matroska,webm probed with size=2048 and score=100
> 
> @ st:0 removing common factor 1000000 from timebase
> 
> Opened file: (C:\FFmpeg\bin\Download\out9.webm).
> 
> @ Before avformat_find_stream_info() pos: 319 bytes read:32768 seeks:0 nb_streams:1
> 
> @ Format yuv420p chosen by get_format().
> 
> @ All info found
> 
> @ stream 0: start_time: 0 duration: NOPTS
> 
> @ format: start_time: 0 duration: 9.92 (estimate from stream) bitrate=144 kb/s
> 
> @ After avformat_find_stream_info() pos: 5130 bytes read:32768 seeks:0 frames:1
> 
> duration= 9920000.000000
> 
> decoding video using vp9
> 
> Using d3d11 as the HW pixel format
> 
> Using d3d11va as the HW Device Type
> 
> HW Decoder initializing!
> 
> @ Selecting d3d11va adapter 0
> 
> @ Using device 10de:1e07 (NVIDIA GeForce RTX 2080 Ti).
> 
> audio stream not found.
> 
> Initialization of decoders complete!
> 
> nativeIsVideoEnabled: true
> 
> nativeIsAudioEnabled: false
> 
> @ Format d3d11 chosen by get_format().
> 
> @ Format d3d11 requires hwaccel initialisation.
> 
> @ Decoder GUIDs reported as supported:
> 
> @ {86695f12-340e-4f04-9fd3-9253dd327460}@  103@  106@
> 
> @ {ee27417f-5e28-4e65-beea-1d26b508adc9}@  103@  106@
> 
> @ {6f3ec719-3735-42cc-8063-65cc3cb36616}@  103@  106@
> 
> @ {1b81bea4-a0c7-11d3-b984-00c04f2e73c5}@  103@  106@
> 
> @ {1b81bea3-a0c7-11d3-b984-00c04f2e73c5}@  103@  106@
> 
> @ {32fcfe3f-de46-4a49-861b-ac71110649d5}@  103@  106@
> 
> @ {d79be8da-0cf1-4c81-b82a-69a4e236f43d}@  103@  106@
> 
> @ {f9aaccbb-c2b6-4cfc-8779-5707b1760552}@  103@  106@
> 
> @ {1b81be68-a0c7-11d3-b984-00c04f2e73c5}@  103@  106@
> 
> @ {5b11d51b-2f4c-4452-bcc3-09f2a1160cc0}@  103@  106@
> 
> @ {107af0e0-ef1a-4d19-aba8-67a163073d13}@  104@  106@
> 
> @ {20bb8b0a-97aa-4571-8e99-64e60606c1a6}@  104@  106@
> 
> @ {15df9b21-06c4-47f1-841e-a67c97d7f312}@  103@  106@
> 
> @ {efd64d74-c9e8-41d7-a5e9-e9b0e39fa319}@  103@  106@
> 
> @ {ed418a9f-010d-4eda-9ae3-9a65358d8d2e}@  103@  106@
> 
> @ {9947ec6f-689b-11dc-a320-0019dbbc4184}@  103@  106@
> 
> @ {33fcfe41-de46-4a49-861b-ac71110649d5}@  103@  106@  107@
> 
> @ {463707f8-a1d0-4585-876d-83aa6d60b89e}@  103@  106@
> 
> @ {a4c749ef-6ecf-48aa-8448-50a7a1165ff7}@  104@  106@
> 
> @ {dda19dc7-93b5-49f5-a9b3-2bda28a2ce6e}@  104@  106@
> 
> @ {6affd11e-1d96-42b1-a215-93a31f09a53d}@  103@  106@
> 
> @ {914c84a3-4078-4fa9-984c-e2f262cb5c9c}@  103@  106@
> 
> @ {8a1a1031-29bc-46d0-a007-e9b092ca6767}@  103@  106@
> 
> @ Static surface pool size exceeded.
> 
> @ get_buffer() failed
> 
> Sendpacket produced Cannot allocate memory
> 
> Av Error
> 
> @ Static surface pool size exceeded.
> 
> @ get_buffer() failed
> 
> Sendpacket produced Cannot allocate memory
> 
> Av Error
> 
> @ Static surface pool size exceeded.
> 
> Errors persist on using latest shared build or release 6.1
> 
> Can someone point me in a direction of how to fix this?

D3D11 decoding requires that output is an array texture with a size fixed in advance.  It sounds like you have not told the decoder that you are going to hold on to multiple frames in the output, so it has made the array texture too small.

You probably want to set AVCodecContext.extra_hw_frames to tell the decoder how many frames you are going to hold on to.

Thanks,

- Mark


More information about the Libav-user mailing list