I'm trying to implement a Hardware scaling filter (vf_scale_d3d11) using the VideoProcessBlt D3D11 DDI, and also add PIX_FMT_D3D11 support for the MediaFoundation Encoder (mfenc).
Initially, there were a lot of "Static surface pool size exceeded".
decode_receive_frame_internal failed = Invalid data found when processing input
Static surface pool size exceeded
get_buffer() failed
thread_get_buffer() failed
decode_slice_headec error
no frame!
This got fixed by incrementing initial_pool_size
by 3. Now the following two flows works as expected:
./ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format d3d11 -hide_banner -i bbb_sunflower_2160p_30fps_normal.mp4 -hw_encoding 1 -c:v h264_mf -vframes 100 -loglevel verbose sample.mp4 -y
./ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format d3d11 -hide_banner -i bbb_sunflower_2160p_30fps_normal.mp4 -hw_encoding 1 -c:v h264_mf -vf "scale_d3d11=width=1920:height=1080" -vframes 100 -loglevel verbose sample.mp4 -y
When I try to call av_hwframe_transfer_data() within the if(encoder_requires_software_frame)
block for the following flow, "Static surface pool size exceeded" occurs once again.
./ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format d3d11 -hide_banner -i bbb_sunflower_2160p_30fps_normal.mp4 -c:v rawvideo -vframes 10 -loglevel verbose sample.yuv -y
Increasing the initial_pool_size
to any higher value doesn't seem to resolve this issue. The same error can be observed when the changes are integrated in HandBrake application, even for use cases (1) and (2). Any insights on why this would occur and how to fix this would be appreciated. Link to patch: https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241230/ce28c8db/attachment.obj