FFmpeg 集成libvmaf 分析 PSNR VMAF值

1.github 下载源码

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

2.下载build tools meson

https://mesonbuild.com/Getting-meson.html

Meson is available in the Python Package Index and can be installed with pip3 install meson which requires root and will install it system-wide.

Alternatively, you can use pip3 install --user meson which will install it for your user and does not require any special privileges. This will install the package in ~/.local/, so you will have to add ~/.local/bin to your PATH.

3.编译 libvmaf

cd vmaf/libvmaf 参考 README.md

meson build –buildtype release

ninja -vC build

sudo ninja -vC build install

4.FFmpeg 使能

./configure --enable-debug=3 --disable-doc --disable-optimizations --enable-pic --extra-cflags=-fPIC --enable-openssl --enable-libx264 --enable-libx265 --enable-gpl --enable-nonfree --enable-libfreetype --enable-libfdk-aac --enable-libaom --enable-libvpx --enable-libopus --enable-libvmaf --enable-version3

make -j8

make install

5.使用

ffmpeg -i xigua_h265.mp4 -i xigua_feijm.mp4 -filter_complex "[0:v]scale=1920x1080:flags=bicubic[main]; [1:v]scale=1920x1080:flags=bicubic,format=pix_fmts=yuv420p,fps=fps=25/1[ref]; [main][ref]libvmaf=psnr=1:phone_model=1:log_fmt=json" -f null - > out.json

其他命令参考:

ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -

参考文档:

ChristosBampis_Netflix

参考地址:

 

https://ffmpeg.org/ffmpeg-filters.html#libvmaf

Calculating VMAF and PSNR with FFmpeg