Measure Visual Information Fidelity with FFmpeg

Visual Information Fidelity (VIF) is a full-reference image and video quality metric that measures how much information is lost during distortion, such as compression or transmission. This article provides a step-by-step guide on how to use FFmpeg to calculate VIF scores. It covers the required prerequisites, the exact command-line syntax, and how to export and interpret the resulting quality scores.

Prerequisites

To measure VIF, you must use FFmpeg’s libvmaf filter. VIF is implemented as a feature within Netflix’s VMAF (Video Multi-Method Assessment Fusion) library.

Before starting, ensure that your version of FFmpeg is compiled with VMAF support. You can verify this by running the following command in your terminal:

ffmpeg -filters | grep libvmaf

If libvmaf appears in the output, your FFmpeg installation is ready.

The Command Syntax

To calculate VIF, you need two video files: the distorted (compressed) video and the reference (original) video. Both videos must have the same resolution and frame rate.

Use the following command to run the VIF assessment:

ffmpeg -i distorted.mp4 -i reference.mp4 -filter_complex "[0:v][1:v]libvmaf=feature='name=vif':log_path=vif_results.json:log_fmt=json" -f null -

Command Breakdown

Understanding the VIF Output

Once the command finishes running, open the generated vif_results.json file. The file will contain VIF scores calculated at different scales, typically labeled as:

These scales represent the visual fidelity at different spatial resolutions (multi-scale analysis).

A VIF score generally ranges from 0 to 1, where: * 1.0 indicates that the distorted video is identical to the reference video. * 0.0 indicates complete loss of visual information. * In some cases where artificial sharpening or contrast enhancement has been applied, a VIF score may exceed 1.0.