intel / libva

Libva is an implementation for VA-API (Video Acceleration API)
http://intel.github.io/libva/
Other
664 stars 302 forks source link

vpp_qsv hardware context issue #814

Closed akhilxavi closed 5 months ago

akhilxavi commented 6 months ago

I am trying to decode scale and format conversion using hevc_qsv, vpp_qsv, vpp_scale respectively. below command work as expected on my device

ffmpeg -hwaccel qsv -c:v hevc_qsv -i /media/pcie/latency-test/complex-video/nv12-5000.h265 -vf 'vpp_qsv=framerate=60,scale_qsv=w=1920:h=1080:format=vuyx,hwdownload,format=vuyx' -f null -

But when I code after linking the filters source -> vpp_qsv -> scale_qsv -> hwdownload -> format -> sink, I am seeing below error,

**[vpp_qsv @ 0x5c5eb9dc18c0] No hw context provided.

[vpp_qsv @ 0x5c5eb9dc18c0] Failed to configure output pad on vpp_qsv**

How to specify hw context for vpp? How the vpp sink pad is expected to be configured?

Thank you in advance.

XinfengZhang commented 6 months ago

@xhaihao

xhaihao commented 6 months ago

@akhilxavi What's your FFmpeg version ? There should be a default HW context for vpp_qsv if you use a recent version of FFmpeg.

xhaihao commented 6 months ago

@akhilxavi What's your FFmpeg version ? There should be a default HW context for vpp_qsv if you use a recent version of FFmpeg.

Sorry, I misunderstood your question. You may refer to https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffmpeg_filter.c#L574-L615 for hw device setting for each filter.

akhilxavi commented 6 months ago

@xhaihao I was trying the filter chain "vpp_qsv=framerate=60,scale_qsv=w=1920:h=1080:format=vuyx,hwdownload,format=vuyx" but it failed with vpp_qsv issues. Now I modified the filter chain to:

filter chain: decoder(qsv)->scale_qsv->hwdownload->output(vuyx)

"scale_qsv=w=1920:h=1080:format=vuyx,hwdownload,format=vuyx" and the filter source is feed with AV_PIX_FMT_QSV from the decoder itself. It works with the same code which I set hw and frame context for each members in the filter chain.

if(avfilter_graph_parse_ptr(filter_graph, args, &inputs, &outputs, NULL) <0)
         av_log(NULL, AV_LOG_ERROR, "failed to parse filter graph description\n");

for(unsigned int i = 0; i < filter_graph->nb_filters; i++){
        if(!(filter_graph->filters[i]->hw_device_ctx = avctx->hw_device_ctx))
                av_log(NULL, AV_LOG_ERROR, "hw device ctx to filters failed\n");
    }

seems like the issue is only with "vpp_qsv" component. Does "vpp_qsv" need any extra initialization other than the above one?

My kernel version is: 6.8.0-31-generic Vaapi version: 1.22.0 (libva 2.22.0.pre1) libmfx: 1.2.10 intel iHD drivers - 24.2.1 firmwares: DMC firmware i915/adlp_dmc.bin (v2.20) GuC firmware i915/tgl_guc_70.bin version 70.20.0 HuC firmware i915/tgl_huc.bin version 7.9.3

akhilxavi commented 5 months ago

more reference here https://github.com/intel/cartwheel-ffmpeg/issues/324