### Install Library and Tools Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Install the compiled library, headers, and the `vmaf` command-line tool using Ninja. ```bash ninja -vC build install ``` -------------------------------- ### Set up Virtual Environment and Install Tools Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Use this command to set up a Python virtual environment and install necessary build tools like Meson. ```bash python3 -m pip install virtualenv python3 -m virtualenv .venv source .venv/bin/activate pip install meson sudo [package-manager] install nasm ninja-build doxygen xxd ``` -------------------------------- ### Train VMAF Model (Example) Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md An example of the training command with specific file paths and enabled options for caching and parallelization. ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf_training.py \ resource/example/example_dataset.py \ resource/feature_param/vmaf_feature_v2.py \ resource/model_param/libsvmnusvr_v2.py \ workspace/model/test_model.pkl \ --cache-result \ --parallelize ``` -------------------------------- ### Configure and Install VMAF with Meson Source: https://github.com/netflix/vmaf/blob/master/resource/doc/windows.md Sets up the build environment for the libvmaf library using Meson, specifying a static build type and installation prefix. This command should be run from the VMAF project root directory. ```bash cd mkdir C:/vmaf-install meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix C:/vmaf-install meson install -C libvmaf/build ``` -------------------------------- ### Example VMAF Execution with Specific Parameters Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md An example of running VMAF with specific video format, dimensions, and model path. This demonstrates how to provide concrete paths for reference and distorted videos. ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf.py \ yuv420p 576 324 \ python/test/resource/yuv/src01_hrc00_576x324.yuv \ python/test/resource/yuv/src01_hrc01_576x324.yuv \ --model model/other_models/nflxtrain_vmafv3.pkl ``` -------------------------------- ### Install Build Tools Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Installs build tools like cython, numpy, meson, and ninja into the activated virtual environment. Ensure ninja is version 1.7.1 or higher. ```shell script pip3 install cython numpy meson ninja ``` -------------------------------- ### Install MSYS2 Packages for VMAF Build Source: https://github.com/netflix/vmaf/blob/master/resource/doc/windows.md Installs necessary packages like NASM, GCC, Meson, and Ninja using the MSYS2 package manager. Ensure MSYS2 is installed and its shell is open before running. ```bash pacman -S --noconfirm --needed mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-ninja ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Installs necessary packages for VMAF on Debian-based or Fedora/CentOS systems. Ensure nasm is version 2.13.02 or higher. ```bash sudo apt install nasm doxygen python3-dev ``` ```bash sudo dnf install nasm doxygen python3-devel ``` ```bash sudo yum install nasm doxygen python3-devel ``` -------------------------------- ### VMAF Output Example (Text) Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Example of the console output when running the VMAF comparison. It includes the VMAF version, processing speed, and the calculated VMAF score. ```text VMAF version e1d466c 48 frames ⠀⠩ 44.72 FPS vmaf_v0.6.1: 76.668905 ``` -------------------------------- ### Install macOS Dependencies Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Installs Python 3 and other required dependencies for VMAF on macOS using Homebrew. No sudo is required for brew commands. ```bash brew install python3 ``` ```bash brew install nasm doxygen llvm libomp ``` -------------------------------- ### Configure and build FFmpeg with libvmaf Source: https://github.com/netflix/vmaf/blob/master/resource/doc/ffmpeg.md Run these commands within the FFmpeg source directory to enable and install the libvmaf filter. ```shell ./configure --enable-libvmaf make -j4 make install ``` -------------------------------- ### VMAF Input Video Examples Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Demonstrates how to specify input videos for the vmaf tool, differentiating between .y4m and raw .yuv formats. For .yuv, additional parameters like width, height, pixel format, and bitdepth are required. ```shell # .y4m --reference ducks.y4m \ --distorted ducks_dist.y4m \ ``` ```shell # .yuv --reference ducks.yuv \ --distorted ducks_dist.yuv \ --width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \ ``` -------------------------------- ### CAMBI Quality Runner Example Source: https://github.com/netflix/vmaf/blob/master/resource/doc/cambi.md Instantiates and runs the CambiQualityRunner with a given asset. Use this to calculate CAMBI scores for video content. Ensure the Asset object is properly configured with paths and dimensions. ```python dis_path = VmafConfig.test_resource_path("yuv", "KristenAndSara_1280x720_8bit_processed.yuv") asset = Asset(dataset="test", content_id=0, asset_id=0, workdir_root=VmafConfig.workdir_path(), ref_path=dis_path, dis_path=dis_path, asset_dict={'width': 1280, 'height': 720, 'dis_enc_width': 960, 'dis_enc_height': 540}) self.qrunner = CambiQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_score'], 1.218365, places=4) ``` -------------------------------- ### VMAF JSON Output Example Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md An example of the JSON output generated by the `run_vmaf` tool. It includes the final VMAF score and scores for elementary metrics. ```json { "...": "...", "aggregate": { "VMAF_feature_adm2_score": 0.93458780776205741, "VMAF_feature_motion2_score": 3.8943597291666667, "VMAF_feature_vif_scale0_score": 0.36342081156994926, "VMAF_feature_vif_scale1_score": 0.76664738784617292, "VMAF_feature_vif_scale2_score": 0.86285338927816291, "VMAF_feature_vif_scale3_score": 0.91597186913930484, "VMAF_score": 76.699271371151269, "method": "mean" } } ``` -------------------------------- ### VMAF output example Source: https://github.com/netflix/vmaf/blob/master/resource/doc/ffmpeg.md The expected console output when running the VMAF filter. ```shell [libvmaf @ 0x7fcfa3403980] VMAF score: 76.668905 ``` ```shell [libvmaf @ 0x7fb5b672bc00] VMAF score: 51.017497 ``` -------------------------------- ### Install Python Requirements Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Installs the remaining Python packages required for the VMAF library. On macOS, specific LLVM compiler flags are recommended for OpenMP support. ```shell script pip3 install -r python/requirements.txt ``` ```shell script CC=$HOMEBREW_PREFIX/opt/llvm/bin/clang CXX=$HOMEBREW_PREFIX/opt/llvm/bin/clang++ pip3 install -r python/requirements.txt ``` -------------------------------- ### CAMBI without Encoding Resolution Options Source: https://github.com/netflix/vmaf/blob/master/resource/doc/cambi.md This example shows the default CAMBI calculation when encoding width and height parameters are not explicitly provided. Note the difference in the output score compared to when these parameters are specified. ```shell libvmaf/build/tools/vmaf \ --reference KristenAndSara_1280x720_8bit_processed.yuv \ --distorted KristenAndSara_1280x720_8bit_processed.yuv \ --width 1280 --height 720 --pixel_format 420 --bitdepth 8 \ --no_prediction --feature cambi --output /dev/stdout ``` -------------------------------- ### VMAF Output Example (XML) Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Structure of the XML output file generated by VMAF. It contains VMAF version, parameters, frame-level metrics (including PSNR), and pooled metrics. ```xml ... ... ``` -------------------------------- ### Subclassing Feature Extractor for Custom Parameters Source: https://github.com/netflix/vmaf/blob/master/CONTRIBUTING.md This example demonstrates how to subclass a feature extractor to hard-code custom parameters, such as `max_db` for `PypsnrFeatureExtractor`, to overcome limitations in the `run_vmaf_training` script. ```python class CustomPypsnrFeatureExtractor(PypsnrFeatureExtractor): def _custom_init(self): self.max_db = 50.0 super()._custom_init() ``` -------------------------------- ### VMAF Feature Dictionary (All Features) Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Defines the set of features to be used for training. This example specifies that all atomic features within the 'VMAF_feature' aggregate type should be selected. ```python feature_dict = {'VMAF_feature': 'all', } ``` -------------------------------- ### Example of Cleaning VMAF Cache Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Specific example of cleaning VMAF cache results for a given dataset and metric type. This command helps resolve issues caused by corrupted cache data. ```shell script PYTHONPATH=python ./python/vmaf/script/run_cleaning_cache.py \ VMAF \ resource/example/example_dataset.py ``` -------------------------------- ### VMAF Model Parameters Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Specifies the type and hyper-parameters for the regressor. This example uses LIBSVMNUSVR with normalization, score clipping, and specific hyper-parameter values. ```python model_type = "LIBSVMNUSVR" model_param_dict = { # ==== preprocess: normalize each feature ==== 'norm_type':'clip_0to1', # rescale to within [0, 1] # ==== postprocess: clip final quality score ==== 'score_clip':[0.0, 100.0], # clip to within [0, 100] # ==== libsvmnusvr parameters ==== 'gamma':0.85, # selected 'C':1.0, # default 'nu':0.5, # default 'cache_size':200, # default } ``` -------------------------------- ### VMAF Feature Dictionary (Specific Features) Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Defines the set of features to be used for training. This example selects specific atomic features ('vif', 'adm') from the 'VMAF_feature' aggregate type. ```python feature_dict = {'VMAF_feature': ['vif', 'adm'], } ``` -------------------------------- ### Set up Virtual Environment Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Creates and activates a Python virtual environment for isolated VMAF development. Subsequent sessions require reactivating the environment. ```shell script python3 -m pip install virtualenv python3 -m virtualenv .venv source .venv/bin/activate ``` -------------------------------- ### Configure Build with Meson Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Configure the build system using Meson. Use flags like -Denable_float=true for floating-point feature extractors, -Denable_avx512=true for AVX512 SIMD instructions, -Denable_cuda=true for CUDA support, and -Denable_nvtx=true for NVTX marker support. ```bash meson setup build --buildtype release ``` -------------------------------- ### Build Project with Ninja Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Compile the project using Ninja after configuration with Meson. The -v flag provides verbose output. ```bash ninja -vC build ``` -------------------------------- ### Generate HTML Documentation Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Generate HTML documentation for the project using Ninja. ```bash ninja -vC build doc/html ``` -------------------------------- ### Build and Run Tests Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Compile the project and run all associated tests using Ninja. ```bash ninja -vC build test ``` -------------------------------- ### Download Sample Test Videos Source: https://github.com/netflix/vmaf/blob/master/resource/doc/docker.md Retrieve sample YUV files required for testing VMAF. ```shell wget https://github.com/Netflix/vmaf_resource/raw/master/python/test/resource/yuv/src01_hrc00_576x324.yuv wget https://github.com/Netflix/vmaf_resource/raw/master/python/test/resource/yuv/src01_hrc01_576x324.yuv ``` -------------------------------- ### Compute Derived Features in MatlabFeatureExtractor Source: https://github.com/netflix/vmaf/blob/master/CONTRIBUTING.md Example of calculating a derived feature from existing atom features within the post-processing step. ```python strred = srred * trred ``` -------------------------------- ### Train VMAF Model (Basic) Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md This command initiates the training of a new VMAF model. It requires paths to the dataset, feature parameters, model parameters, and an output file for the trained model. Optional flags for caching and parallelization can be included. ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf_training.py \ train_dataset_filepath \ feature_param_file \ model_param_file \ output_model_file \ [--cache-result] \ [--parallelize] ``` -------------------------------- ### Run unit tests with tox Source: https://github.com/netflix/vmaf/blob/master/python/DEVELOP.md Executes the full test suite defined in tox.ini. Ensure make is run in the root directory before executing this command. ```bash tox ``` -------------------------------- ### Run VMAF with Local Explanation (LIME) Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Use this command to run VMAF and enable local explanation using LIME for feature importance. This can be applied to any regression scheme with a pre-trained model. ```shell PYTHONPATH=python ./python/vmaf/script/run_vmaf.py \ yuv420p 576 324 \ src01_hrc00_576x324.yuv \ src01_hrc00_576x324.yuv \ --local-explain ``` ```shell PYTHONPATH=python ./python/vmaf/script/run_vmaf.py yuv420p 576 324 \ src01_hrc00_576x324.yuv \ src01_hrc00_576x324.yuv \ --local-explain \ --model model/other_models/nflxall_vmafv1.pkl ``` -------------------------------- ### VMAF Tool Usage Options Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Lists the supported command-line options for the vmaf tool, including input/output paths, video parameters, model configurations, and output formats. ```shell Usage: vmaf [options] Supported options: --reference/-r $path: path to reference .y4m or .yuv --distorted/-d $path: path to distorted .y4m or .yuv --width/-w $unsigned: width --height/-h $unsigned: height --pixel_format/-p: $string pixel format (420/422/444) --bitdepth/-b $unsigned: bitdepth (8/10/12) --model/-m $params: model parameters, colon ":" delimited `path=` path to model file `version=` built-in model version `name=` optional name used in logs --output/-o $path: path to output file --xml: write output file as XML (default) --json: write output file as JSON --csv: write output file as CSV --sub: write output file as subtitle --threads $unsigned: number of threads to use --feature $string: additional feature --cpumask: $bitmask restrict permitted CPU instruction sets --subsample: $unsigned compute scores only every N frames --quiet/-q: disable FPS meter when run in a TTY --no_prediction/-n: no prediction, extract features only --version/-v: print version and exit ``` -------------------------------- ### Build and Run VMAF Docker Container Source: https://github.com/netflix/vmaf/blob/master/resource/doc/docker.md Commands to build the VMAF image and execute the run_vmaf CLI tool. ```shell docker build -t vmaf . ``` ```shell docker run --rm vmaf [CLI] ``` -------------------------------- ### VMAF Model Configuration Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Shows how to configure VMAF models, including using built-in models by version or specifying a path to a .json model file. If no model is specified, `vmaf_v0.6.1` is used by default. ```shell # built-in model --model version=vmaf_v0.6.1 ``` ```shell # model file --model path=../model/vmaf_v0.6.1.json ``` -------------------------------- ### VMAF Confidence Interval JSON Output Source: https://github.com/netflix/vmaf/blob/master/resource/doc/conf_interval.md Example JSON output from `run_vmaf` when the `--ci` option is used, showing aggregate scores including the main VMAF score, CI high/low scores, and standard deviation. ```json { "aggregate": { "BOOTSTRAP_VMAF_bagging_score": 74.96366248843681, "BOOTSTRAP_VMAF_ci95_high_score": 77.38652840665362, "BOOTSTRAP_VMAF_ci95_low_score": 72.98503037587044, "BOOTSTRAP_VMAF_score": 75.44304785910772, "BOOTSTRAP_VMAF_stddev_score": 1.31289244504376, "VMAF_feature_adm2_score": 0.9345878041226809, "VMAF_feature_motion2_score": 3.8943597291666667, "VMAF_feature_vif_scale0_score": 0.36342081156994926, "VMAF_feature_vif_scale1_score": 0.7666473878461729, "VMAF_feature_vif_scale2_score": 0.8628533892781629, "VMAF_feature_vif_scale3_score": 0.9159718691393048, ... "method": "mean" } } ``` -------------------------------- ### Manage VMAF Models Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Load models from built-in defaults or filesystem paths. Destroy models after use to free resources. ```c int vmaf_model_load(VmafModel **model, VmafModelConfig *cfg, const char *version); int vmaf_model_load_from_path(VmafModel **model, VmafModelConfig *cfg, const char *path); void vmaf_model_destroy(VmafModel *model); ``` -------------------------------- ### Add Source File to Meson Build Source: https://github.com/netflix/vmaf/blob/master/CONTRIBUTING.md Include the new C source file in the libvmaf feature sources list within the build configuration. ```meson libvmaf_feature_sources = [ ... feature_src_dir + 'third_party/xiph/psnr_hvs.c', ... ] ``` -------------------------------- ### Build VMAF Binary Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Cleans the build and compiles the VMAF binary. Verify the build success using the --version flag. ```shell script make clean; make ``` ```shell script ./libvmaf/build/tools/vmaf --version ``` -------------------------------- ### VMAF Additional Metrics Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Illustrates how to enable additional metrics such as PSNR, PSNR-HVS, SSIM, MS-SSIM, CIEDE, and CAMBI using the `--feature` flag. ```shell # psnr, psnr_hvs, ssim, ms-ssim, ciede --feature psnr \ --feature psnr_hvs \ --feature float_ssim \ --feature float_ms_ssim --feature ciede --feature cambi ``` -------------------------------- ### Run ST-MAD, ST-RRED, and SpEED-QA Source: https://github.com/netflix/vmaf/blob/master/resource/doc/matlab_usage.md Execute quality assessment algorithms using the run_testing script. ```shell ./run_testing quality_type dataset_file ``` -------------------------------- ### Run VMAF Command Line Tool Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Executes VMAF on a reference and distorted video pair using the `run_vmaf` script. Supports various YUV formats and output formats like text, XML, or JSON. ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf.py \ format width height \ reference_path \ distorted_path \ [--out-fmt output_format] ``` ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf.py \ yuv420p 576 324 \ src01_hrc00_576x324.yuv \ src01_hrc01_576x324.yuv \ --out-fmt json ``` -------------------------------- ### Run VMAF with Confidence Interval Enabled Source: https://github.com/netflix/vmaf/blob/master/resource/doc/conf_interval.md Use the `--ci` option with a bootstrapping model to enable confidence interval calculation in the `run_vmaf` command-line tool. The output will include CI scores. ```bash ./run_vmaf yuv420p 576 324 \ src01_hrc00_576x324.yuv \ src01_hrc01_576x324.yuv \ --model model/vmaf_float_b_v0.6.3/vmaf_float_b_v0.6.3.pkl \ --out-fmt json --ci ``` -------------------------------- ### Run VMAF with NFLX CTC preset Source: https://github.com/netflix/vmaf/blob/master/resource/doc/nflx_ctc.md Executes the VMAF tool using the versioned nflx_ctc preset to compute metrics and output results to a JSON file. ```bash ./build/tools/vmaf \ --reference reference.y4m \ --distorted distorted.y4m \ --nflx_ctc v1.0 \ --json \ --output output.json ``` -------------------------------- ### Run CAMBI using VMAF command line Source: https://github.com/netflix/vmaf/blob/master/resource/doc/cambi.md Invoke CAMBI as a feature within the VMAF tool. Provide reference and distorted video paths, along with video parameters. The output will detail frame-by-frame and pooled CAMBI scores. ```shell libvmaf/build/tools/vmaf \ --reference src01_hrc01_576x324.yuv \ --distorted src01_hrc01_576x324.yuv \ --width 576 --height 324 --pixel_format 420 --bitdepth 8 \ --no_prediction --feature cambi --output /dev/stdout ``` -------------------------------- ### Execute VMAF on YUV Files Source: https://github.com/netflix/vmaf/blob/master/resource/doc/docker.md Run VMAF on reference and distorted YUV video pairs using a mounted volume. ```shell docker run --rm -v $(pwd):/files vmaf \ yuv420p 576 324 \ /files/src01_hrc00_576x324.yuv \ /files/src01_hrc01_576x324.yuv \ --out-fmt json ``` -------------------------------- ### Build and Run FFmpeg VMAF Container Source: https://github.com/netflix/vmaf/blob/master/resource/doc/docker.md Build a specialized FFmpeg container with CUDA support and execute VMAF filtering on MP4 files. ```shell docker build -f Dockerfile.ffmpeg -t ffmpeg_vmaf . ``` ```shell wget https://ultravideo.fi/video/Beauty_3840x2160_120fps_420_8bit_HEVC_RAW.hevc docker run --gpus all -e NVIDIA_DRIVER_CAPABILITIES=compute,video -v $(pwd):/files ffmpeg_vmaf \ -y -hwaccel cuda -hwaccel_output_format cuda -i /files/Beauty_3840x2160_120fps_420_8bit_HEVC_RAW.hevc \ -fps_mode vfr -c:a copy -c:v hevc_nvenc -b:v 2M /files/dist.mp4 docker run --gpus all -e NVIDIA_DRIVER_CAPABILITIES=compute,video -v $(pwd):/files ffmpeg_vmaf \ -hwaccel cuda -hwaccel_output_format cuda -i /files/Beauty_3840x2160_120fps_420_8bit_HEVC_RAW.hevc \ -hwaccel cuda -hwaccel_output_format cuda -i /files/dist.mp4 \ -filter_complex "[0:v]scale_cuda=format=yuv420p[ref];[1:v]scale_cuda=format=yuv420p[dist];[ref][dist]libvmaf_cuda" \ -f null - ``` -------------------------------- ### Run VMAF Comparison with PSNR Source: https://github.com/netflix/vmaf/blob/master/libvmaf/tools/README.md Execute the VMAF tool to compare reference and distorted YUV inputs. Specify dimensions, pixel format, bit depth, VMAF model, and include the PSNR feature for detailed metric logging. The output is saved to an XML file. ```shell ./build/tools/vmaf \ --reference src01_hrc00_576x324.yuv \ --distorted src01_hrc01_576x324.yuv \ --width 576 --height 324 --pixel_format 420 --bitdepth 8 \ --model version=vmaf_v0.6.1 \ --feature psnr \ --output output.xml ``` -------------------------------- ### Run VMAF with GPU Support Source: https://github.com/netflix/vmaf/blob/master/resource/doc/docker.md Execute the VMAF container using the NVIDIA runtime for CUDA acceleration. ```shell docker run --gpus all --rm -v $(pwd):/files vmaf \ yuv420p 576 324 \ /files/src01_hrc00_576x324.yuv \ /files/src01_hrc01_576x324.yuv \ --out-fmt json ``` -------------------------------- ### Enable JSON Logging Source: https://github.com/netflix/vmaf/blob/master/resource/doc/aom_ctc.md Use the `--json` flag to output metrics in JSON format instead of the default XML. This is useful for programmatic parsing of results. ```bash ./build/tools/vmaf \ --reference reference.y4m \ --distorted distorted.y4m \ --aom_ctc v1.0 \ --output output.json \ --json ``` -------------------------------- ### Configure Matlab Path Source: https://github.com/netflix/vmaf/blob/master/resource/doc/matlab_usage.md Set the path to the Matlab executable in the externals configuration file. ```python MATLAB_PATH = ``` ```python MATLAB_PATH = "/Applications/MATLAB_R2017a.app/bin/matlab" ``` -------------------------------- ### Invoke VMAF 4K Model Source: https://github.com/netflix/vmaf/blob/master/resource/doc/models.md Specify the path to the 4K model JSON file using the --model option to evaluate 4K content. ```shell ./run_vmaf yuv420p 3840 2160 \ ref_path \ dis_path \ --model model/vmaf_4k_v0.6.1.json ``` -------------------------------- ### Invoke VMAF Phone Model Source: https://github.com/netflix/vmaf/blob/master/resource/doc/models.md Use the --phone-model flag to calculate quality scores optimized for cellular phone viewing conditions. ```shell ./run_vmaf yuv420p 576 324 \ src01_hrc00_576x324.yuv \ src01_hrc01_576x324.yuv \ --phone-model ``` -------------------------------- ### Run VMAF with a Pre-trained Model Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Execute VMAF analysis using a specified pre-trained model. Ensure the PYTHONPATH is set correctly to access VMAF scripts and models. ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf.py \ format width height \ reference_path \ distorted_path \ [--model model_path] ``` -------------------------------- ### Run Unit Tests Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Executes the project's unit tests to ensure all tests pass. ```shell script ./unittest ``` -------------------------------- ### Basic AOM CTC Usage Source: https://github.com/netflix/vmaf/blob/master/resource/doc/aom_ctc.md Use the `--aom_ctc` preset to compute metrics according to AOM CTC standards. Specify reference and distorted video files, the CTC version, and an output file. ```bash ./build/tools/vmaf \ --reference reference.y4m \ --distorted distorted.y4m \ --aom_ctc v1.0 \ --output output.xml ``` -------------------------------- ### Run BRISQUE Source: https://github.com/netflix/vmaf/blob/master/resource/doc/matlab_usage.md Execute the BRISQUE algorithm using the run_vmaf script with a specific model. ```shell ./run_vmaf yuv_420p 1920 1080 \ NFLX_dataset_public/ref/OldTownCross_25fps.yuv \ NFLX_dataset_public/dis/OldTownCross_90_1080_4300.yuv \ --model model/vmaf_brisque_all_v0.0rc.pkl ``` -------------------------------- ### Initialize and Close VMAF Context Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Use these functions to manage the lifecycle of a VMAF context. Ensure vmaf_close is called to prevent memory leaks. ```c int vmaf_init(VmafContext **vmaf, VmafConfiguration cfg); int vmaf_close(VmafContext *vmaf); ``` -------------------------------- ### Train Bootstrap Model Source: https://github.com/netflix/vmaf/blob/master/resource/doc/conf_interval.md This command trains a bootstrap model. Set model_type to BOOTSTRAP_LIBSVMNUSVR in the parameter file and optionally specify num_models. ```bash ./run_vmaf_training resource/dataset/NFLX_dataset_public.py \ resource/param/vmaf_v6_bootstrap.py \ resource/param/vmaf_v6_bootstrap.py \ ~/Desktop/test/test_b_model.pkl \ --cache-result \ --parallelize ``` -------------------------------- ### Configure VMAF model path in PowerShell or Command Prompt Source: https://github.com/netflix/vmaf/blob/master/resource/doc/ffmpeg.md Use this format to pass an absolute Windows path to libvmaf when running FFmpeg via PowerShell or Command Prompt. ```powershell ./ffmpeg.exe -i dist.y4m -i ref.y4m \ -lavfi libvmaf=model_path="D\\:/mypath/vmaf_v0.6.1.json" \ -f null - ``` -------------------------------- ### Calculate VMAF with FFmpeg for downscaled video Source: https://github.com/netflix/vmaf/blob/master/resource/doc/faq.md Use this command to upscale a distorted video to 1080p before calculating VMAF scores using the libvmaf filter. ```bash ffmpeg -i main.mpg -i ref.mpg -filter_complex "[0:v]scale=1920x1080:flags=bicubic[main];[main][1:v]libvmaf" -f null - ``` -------------------------------- ### VMAF Context Management Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Functions to initialize and close the VMAF context. ```APIDOC ## VMAF Context Management ### Description Initializes the VMAF context and cleans up resources after processing. ### Methods - vmaf_init(VmafContext **vmaf, VmafConfiguration cfg) - vmaf_close(VmafContext *vmaf) ``` -------------------------------- ### BSD+Patent License Header Source: https://github.com/netflix/vmaf/blob/master/CONTRIBUTING.md All code contributions must include this header, which specifies the license terms for your contributions. ```text /** * Copyright 2016-2020 [the original author or authors]. * * Licensed under the BSD+Patent License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://opensource.org/licenses/BSDplusPatent * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ``` -------------------------------- ### Calculate VMAF on MP4 files with upsampling Source: https://github.com/netflix/vmaf/blob/master/resource/doc/ffmpeg.md Computes VMAF for MP4 files by scaling the distorted input to match the reference resolution using the bicubic algorithm. ```shell ffmpeg \ -r 24 -i Seeking_30_480_1050.mp4 \ -r 24 -i Seeking_10_288_375.mp4 \ -lavfi "[0:v]setpts=PTS-STARTPTS[reference]; \ [1:v]scale=720:480:flags=bicubic,setpts=PTS-STARTPTS[distorted]; \ [distorted][reference]libvmaf=log_fmt=xml:log_path=/dev/stdout:model_path={your_vmaf_dir}/model/vmaf_v0.6.1.json:n_threads=4" \ -f null - ``` -------------------------------- ### Validate Dataset with Confidence Interval Source: https://github.com/netflix/vmaf/blob/master/resource/doc/conf_interval.md Use this command to validate a dataset and generate confidence intervals. Ensure the quality type is BOOTSTRAP_VMAF and specify the correct bootstrapping model. ```bash ./run_testing \ BOOTSTRAP_VMAF resource/dataset/NFLX_dataset_public.py \ --vmaf-model model/vmaf_float_b_v0.6.3/vmaf_float_b_v0.6.3.pkl \ --cache-result \ --parallelize ``` -------------------------------- ### Read Pictures for Processing Source: https://github.com/netflix/vmaf/blob/master/libvmaf/README.md Process input pictures in a loop. Pass NULL for ref and dist to flush internal buffers after the final frame. ```c int vmaf_read_pictures(VmafContext *vmaf, VmafPicture *ref, VmafPicture *dist, unsigned index); ``` -------------------------------- ### Validate Dataset with VMAF and Caching Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Run dataset validation using VMAF metric, enabling result caching for efficiency and parallel processing. Ensure the dataset file path is correct. ```shell script PYTHONPATH=python ./python/vmaf/script/run_testing.py \ VMAF \ resource/example/example_dataset.py \ --cache-result \ --parallelize ``` -------------------------------- ### Configure VMAF model path in Bash or MSYS2 Source: https://github.com/netflix/vmaf/blob/master/resource/doc/ffmpeg.md Use the MSYS2_ARG_CONV_EXCL environment variable to prevent path conversion issues in Bash environments. Double or single quotes can be used to manage backslash escaping requirements. ```bash MSYS2_ARG_CONV_EXCL="*" \ ./ffmpeg.exe -i dist.y4m -i ref.y4m -lavfi \ libvmaf=model_path="D\\\:/mypath/vmaf_v0.6.1.json" -f null - ``` ```bash MSYS2_ARG_CONV_EXCL="*" \ ./ffmpeg.exe -i dist.y4m -i ref.y4m -lavfi \ libvmaf=model_path='D\\:/mypath/vmaf_v0.6.1.json' -f null - ``` -------------------------------- ### Test VMAF with Custom Subjective Model Source: https://github.com/netflix/vmaf/blob/master/resource/doc/python.md Runs VMAF testing using a custom subjective model. The dataset must be formatted with raw opinion scores ('os'). ```shell script PYTHONPATH=python ./python/vmaf/script/run_vmaf_testing.py \ VMAF \ resource/example/example_raw_dataset.py \ --subj-model MLE_CO_AP2 \ --cache-result \ --parallelize ``` -------------------------------- ### Convert CAMBI Heatmap to PNG using FFmpeg Source: https://github.com/netflix/vmaf/blob/master/resource/doc/cambi.md This command uses FFmpeg to convert a raw grayscale heatmap file generated by CAMBI into a PNG image format for easier viewing and analysis. ```shell ffmpeg -f rawvideo -pix_fmt gray16le -s 1280x720 -i heatmaps/cambi_heatmap_scale_0_1280x720_16b.gray -frames:v 1 heatmaps/cambi_heatmap_scale_0_1280x720_16b.png ``` -------------------------------- ### CAMBI with Encoding Resolution Options Source: https://github.com/netflix/vmaf/blob/master/resource/doc/cambi.md Use the `enc_width` and `enc_height` options to specify the accurate encoding resolution for CAMBI, which helps in assessing banding artifacts more precisely, especially after upscaling. ```shell libvmaf/build/tools/vmaf \ --reference KristenAndSara_1280x720_8bit_processed.yuv \ --distorted KristenAndSara_1280x720_8bit_processed.yuv \ --width 1280 --height 720 --pixel_format 420 --bitdepth 8 \ --no_prediction --feature cambi=enc_width=960:enc_height=540 --output /dev/stdout ``` -------------------------------- ### Configure VMAF Model Feature Overloading Source: https://github.com/netflix/vmaf/blob/master/CHANGELOG.md Use this syntax to overload individual model features, such as VIF and ADM gain limits, for simultaneous computation of VMAF and VMAF NEG. This replaces the global feature override flag. ```sh --model version=vmaf_v0.6.1:vif.vif_enhn_gain_limit=1.0:adm.adm_enhn_gain_limit=1.0 ```