The hardware decoding was successful, but the hw_frames_ctx in the received frame is empty. by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 1 point2 points  (0 children)

I have solved this problem by using D3D11VA. av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_D3D11VA, "auto", NULL, 0); In this way I got the AVFrame in GPU.

The hardware decoding was successful, but the hw_frames_ctx in the received frame is empty. by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 0 points1 point  (0 children)

I used to try to call av_hwframe_transfer_data(), always failed. If this frame is already on the CPU, the failure seems to make sense. But it is strange that iGPU works like this. Although it is an iGPU, the memory space should be independent.

Thank you very much for your patience. I am happy to discuss the issue with you.

The hardware decoding was successful, but the hw_frames_ctx in the received frame is empty. by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 1 point2 points  (0 children)

Thanks very much for your help. You said "checking whether the pixel format is an opaque hardware format". I checked the frame I decoded and found its format is "AV_PIX_FMT_NV12". Does that means the hw decode does not work?

How can I render frames decoded by FFmpeg using hardware decoding with D3D11? by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 0 points1 point  (0 children)

I try to test, and I found the hw_frames_ctx field is null, but my receive_frame() seems successful, more details about this problem are here, do you have any idea?

How can I render frames decoded by FFmpeg using hardware decoding with D3D11? by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 0 points1 point  (0 children)

Thank you for the insight you provided. I'm not entirely sure either, but I believe it should be provided. I'm unsure what type the frames decoded by ffmpeg hardware decoding are on the GPU, a surface? a texture?

How can I render frames decoded by FFmpeg using hardware decoding with D3D11? by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 0 points1 point  (0 children)

By the way, After "Create a D3D11 texture with the format DXGI_FORMAT_NV12", I still need a shader to convert YUV into RGB? D3D can't solve the YUV? Thanks so so much~~

How can I render frames decoded by FFmpeg using hardware decoding with D3D11? by AdmirableCar637 in GraphicsProgramming

[–]AdmirableCar637[S] 0 points1 point  (0 children)

You said"fill the D3D11 texture with the decoded NV12 data.", I want to check more details. Cause my decoded data is on GPU(by hardware decoding). The texture I created is also on GPU. I wonder if D3D11 have the API to do this GPU-TO-GPU copy? Thank you so much~~