Opened 15 months ago

Last modified 14 months ago

#10586 new defect

Impossible to retrieve libvmaf result from AVFrame at the output of filter graph

Reported by: ichlubna Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: libvmaf frame filter libav psnr
Cc: ichlubna Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by ichlubna)

There is no way to retrieve vmaf score from the resulting frame produced at the end of the filter graph. The same approach which works for psnr and ssim filters is not working.

When I use psnr or ssim filter I can list the result from the frame read from the sink buffer of the filter graph which is stored in the metadata dictionary as:

char *entries = nullptr;
av_dict_get_string(resultFrame->metadata, &entries, ',', '|');
std::cout << entries;

I use this filter:

const AVFilter *vmafFilter  = avfilter_get_by_name("libvmaf");

The same cannot be used for libvmaf. The metadata dictionary is empty. I searched the whole frame structure and couldn't find the result anywhere. Shouldn't this be unified?

I don't see the storing of the result in the frame anywhere in the source code. Storing to the frame is visible in the code of psnr and code of ssim. I think that the storing of the vmaf score is just missing in the code.

The only workaround is to call the uninit function of the vmaf filter which triggers the log message with vmaf score (having set the log level to AV_LOG_INFO) but this is not usable for per-frame vmaf result which would be similar to psnr and ssim. It would require a new construction of the filters in the graph after processing each frame.

I think that something like this this is missing in the do_vmaf function:

double vmaf_score;
vmaf_score_pooled(s->vmaf, s->model[0], pool_method_map(s->pool), &vmaf_score, 0, s->frame_cnt - 1);       
set_meta(&dist->metadata, "lavfi.vmaf", 0, vmaf_score);

I have tried doing so but got this error with increasing index for each frame:

libvmaf ERROR vmaf_predict_score_at_index(): no feature '��%�}U' at index 1

But seems like this is working fine and does the expected! Polled would probably return the computed merged score while this at_index function returns score for each frame individually. Also need to go one index down to get a good result as the counter is not incremented yet:

vmaf_score_at_index(s->vmaf, s->model[0], &vmaf_score, s->frame_cnt - 2);

I have created a patch for this.

Change History (7)

comment:1 by ichlubna, 15 months ago

Summary: Impossible to retrieve libvmaf result from filter graph in AVFrameImpossible to retrieve libvmaf result from AVFrame at the output of filter graph

comment:2 by ichlubna, 15 months ago

Component: undeterminedavfilter

comment:3 by ichlubna, 15 months ago

Description: modified (diff)

comment:4 by ichlubna, 15 months ago

Description: modified (diff)

comment:5 by ichlubna, 14 months ago

Description: modified (diff)

comment:6 by ichlubna, 14 months ago

Description: modified (diff)

comment:7 by ichlubna, 14 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.