master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.4k stars 147 forks source link

Add support for vmaf-subsample #825

Open luigi311 opened 2 months ago

luigi311 commented 2 months ago

Add vmaf-subsample as an alternative to probing-rate as it is more accurate while still providing a speed benefit compared to without it Closes #806

Looks like probe-rate 3 in this example is useless as it messes up the quality so bad it just uses 8 crf which was my min while subsample doesnt seem to run into any issues with setting it a bit to high.

Testing on a 30 second 1080p clip with little motion Target quality of 96 using x265 fast with extra-split 240 comes out to 7 scenes

default

real 3m34.966s user 24m37.871s sys 2m58.700s

default

probe 2

real 1m45.946s user 11m48.243s sys 1m41.285s

probing-rate_2

probe 3

real 1m44.766s user 10m12.201s sys 1m30.548s

probing-rate_3

subsample 3

real 2m35.967s user 17m47.618s sys 2m25.497s

vmaf-subsample_3

subsample 9

real 2m8.224s user 14m7.415s sys 1m50.762s

vmaf-subsample_9

luigi311 commented 2 months ago

I just tested with a heavy motion action scene and while it seems like they all chose the min crf of 8 the logs show a completely different picture. Looks like subsample is actually smart enough to limit itself so it doesnt try to go to high during high movement scenarios where as probe doesnt and probe 3 shows a min vmaf of 0.

Testing on a 30 second 1080p clip with lots of motion Target quality of 96 using x265 fast with extra-split 240 comes out to 10 scenes

default

real 3m1.954s user 25m15.300s sys 1m31.100s

Min VMAF: 91.71

probe 2

real 2m39.683s user 20m36.260s sys 1m27.650s

Min VMAF: 91.97

probe 3

real 2m19.869s user 17m33.692s sys 1m18.733s

Min VMAF: 0

subsample 3

real 3m0.207s user 23m29.094s sys 1m36.000s

Min VMAF: 91.54

subsample 9

real 3m0.877s user 23m13.567s sys 1m33.432s

Min VMAF: 91.54

luigi311 commented 2 months ago

renamed to probing-subsample as it only applies to probes and not the final vmaf similar to probing-rate

luigi311 commented 2 months ago

this also only provides a benefit if vmaf is the slowest part of the target quality process so you will not see many changes using --probe-slow if you are using a slow preset.

shssoichiro commented 1 month ago

I think the code looks fine, but I don't normally use the VMAF features to know more about how useful this is. Thoughts @redzic @master-of-zen ?