Video Compression

VideoNerd

The stand-alone VMAF calculation source code can be cloned:

git clone https://github.com/Netflix/vmaf.git

Building in Windows of the VMAF stand-alone program (vmafossexec.exe) is a nightmare, therefore i added already compiled for Windows  vmafossexec.exe plus models (vmaf_4k_v0.6.1.pkl and vmaf_4k_v0.6.1.pkl.model) here.


Example  [compute VMAF scores for 1080p video using the model 4k_v0.6.1]:
vmafossexec.exe    yuv420p    1920    1080    ref.yuv  test_25M.yuv   vmaf_4k_v0.6.1.pkl  --log logs\test.xml

VMAF scores and its components for each frame are stored at logs\test.xml file (xml-format):

<frame frameNum=”0″ adm2=”0.94942″ motion2=”0″ vif_scale0=”0.418306″ vif_scale1=”0.767485″ vif_scale2=”0.860666″ vif_scale3=”0.911131″ vmaf=”84.1549″ />
<frame frameNum=”1″ adm2=”0.969361″ motion2=”2.61322″ vif_scale0=”0.502735″ vif_scale1=”0.856727″ vif_scale2=”0.924066″ vif_scale3=”0.954039″ vmaf=”92.0891″ />
<frame frameNum=”2″ adm2=”0.972103″ motion2=”2.17506″ vif_scale0=”0.529791″ vif_scale1=”0.888681″ vif_scale2=”0.944979″ vif_scale3=”0.96707″ vmaf=”93.3399″ />
<frame frameNum=”3″ adm2=”0.977656″ motion2=”2.17506″ vif_scale0=”0.575567″ vif_scale1=”0.921117″ vif_scale2=”0.963096″ vif_scale3=”0.978697″ vmaf=”95.2355″ />
<frame frameNum=”4″ adm2=”0.973411″ motion2=”4.02439″ vif_scale0=”0.549572″ vif_scale1=”0.900846″ vif_scale2=”0.950547″ vif_scale3=”0.96941″ vmaf=”94.8831″ />

 

 

Computing VMAF with ffmpeg

Check that you have ffmpeg containing libvmaf:

ffmpeg -filters | findstr vmaf

....

... libvmaf VV->V Calculate the VMAF between two video streams.

 

If not take the full ffmpeg version from here

 

Example:

ffmpeg -r 60 -s 1920x1080 -i  ref.yuv -r 60 -s 1920x1080 -i test_25M.yuv -vsync 0 -lavfi libvmaf="model_path=vmaf_4k_v0.6.1.pkl:log_path=test.xml:pool=mean" -report -f null -

VMAF scores per frame are stored in log-file test.xml.

 

If you wish to report in the log-file PSNR along with VMAF use the following code:

ffmpeg -r 60 -s 1920x1080 -i  ref.yuv -r 60 -s 1920x1080 -i test_25M.yuv -vsync 0 -lavfi libvmaf="model_path=vmaf_4k_v0.6.1.pkl:log_path=test.xml:pool=mean:psnr=true" -report -f null -

 

The test.xml file:

<frame frameNum=”0″ adm2=”0.976425″ motion2=”0″ psnr=”33.9097″ vif_scale0=”0.483704″ vif_scale1=”0.817439″ vif_scale2=”0.899884″ vif_scale3=”0.941171″ vmaf=”90.7096″/>
<frame frameNum=”1″ adm2=”0.993283″ motion2=”2.56958″ psnr=”36.1306″ vif_scale0=”0.561779″ vif_scale1=”0.895547″ vif_scale2=”0.95159″ vif_scale3=”0.973982″ vmaf=”97.7492″/>
<frame frameNum=”2″ adm2=”0.992615″ motion2=”2.03314″ psnr=”36.7073″ vif_scale0=”0.58476″ vif_scale1=”0.919656″ vif_scale2=”0.964479″ vif_scale3=”0.980839″ vmaf=”97.9331″/>
<frame frameNum=”3″ adm2=”0.99483″ motion2=”2.03314″ psnr=”37.9205″ vif_scale0=”0.624615″ vif_scale1=”0.94397″ vif_scale2=”0.976264″ vif_scale3=”0.98745″ vmaf=”98.9168″/>

Leave a Reply

Your email address will not be published. Required fields are marked *