Av1an icon indicating copy to clipboard operation
Av1an copied to clipboard

VMAF probing edge case / fix proposal

Open simon-huber opened this issue 3 years ago • 4 comments

I get wrong log messages if the target vmaf procedure skips probing because it detected low/high cq. This results in showing the wrong approx. VMAF value.

20:20:30 Chunk: 01117, Rate: 4, Fr: 202 Q: [10, 32], Early Skip Low CQ Vmaf: [89.26, 54.92] Target Q: 10 VMAF: 54.92

Code Line responsible: https://github.com/master-of-zen/Av1an/blob/ea354916729fe72d5e1d87c6a0e7ef666a416df5/av1an/target_quality/target_quality.py#L66

It takes the last element of the array, instead of the first. Any other case I haven't thought of?

About the execution:

av1an -i "movie.mkv" -a " -c:a libopus -b:a 128k " -enc aom -v " --end-usage=q --cq-level=22 --cpu-used=4 --threads=12 --bit-depth=10 " -w 9 --target_quality 95.5 --vmaf_path "vmaf_v0.6.1.pkl" -log movie.txt -o "movie.webm" --min_q 10 --webm --keep -r

OS: Win10/Python 3.8

simon-huber avatar Apr 05 '21 18:04 simon-huber

Never mind, you refactored it since the version I used.

simon-huber avatar Apr 05 '21 19:04 simon-huber

Had an idea tonight to handle an edge case I ran into:

18:22:38 Chunk: 01095, Rate: 4, Fr: 225 Q: [10, 32], Early Skip Low CQ Vmaf: [91.68, 0.0] Target Q: 10 VMAF: 0.0

I looked into the code and realised, that you've refactored the output since:

[22:20:03] Chunk: 00194, Rate: 4, Fr: 174 [22:20:03] Probes: (0.0, 10), (89.71, 32) Early Skip Low CQ [22:20:03] Target Q: 10 VMAF: 0.0

However, I wasn't satisfied with that as in this case the encoder will do q=10. However, since VMAF did return no reasonable result, we won't know if the "visual" result will be as bad as the VMAF result.

My proposal for the method target_quality.py/per_shot_target_quality (I can offer a pull-request for this):

https://github.com/ibhh/Av1an/blob/feature/detect-bad-q-probes/av1an/target_quality/target_quality.py#L116

What's your opinion on this?

simon-huber avatar Apr 05 '21 22:04 simon-huber

@ibhh Close)?

master-of-zen avatar Apr 08 '21 14:04 master-of-zen

I've slept some nights about this issue. I think I've overshot. The problem seems to be that sometimes the encoder produces bullshit while doing the probe run. Therefore, the VMAF is very low/0. It can happen anytime. I've reduced the thing to a "0" check with a one-time retry of the VMAF calc.

It's up to you if you want to put an additional check-in there, in production I don't think it matters. The only effect is a lower Q value.

simon-huber avatar Apr 08 '21 14:04 simon-huber

Old issue, av1an changed quite a lot and no longer written in python

master-of-zen avatar Jan 16 '23 19:01 master-of-zen