vmaf-mcp

v1.0.0rc3
vmaf-mcp Checked 4 days ago Published 2 months ago

MCP server exposing VMAF scoring, model listing, and benchmark runs via JSON-RPC.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

vmaf_score

Compute a VMAF score for a (reference, distorted) YUV pair. Optional tiny-AI/DNN, feature-selection, CTC-preset, and frame-range parameters map onto the corresponding vmaf CLI flags (ADR-1117).

ParameterTypeDescription
bitdepth *integer
dis *stringDistorted YUV path.
height *integer
pixfmt *string
ref *stringReference YUV path.
width *integer
aom_ctcstringAOM Common Test Conditions preset (--aom_ctc). Configures a fixed model + feature set; mutually exclusive with manual feature/model config.
backendstring
cpumaskintegerBitmask restricting permitted CPU SIMD instruction sets (--cpumask).
csvbooleanWrite output file as CSV (--csv). Equivalent to output_fmt='csv'.
disable_clipbooleanDisable score clipping to [0, 100] on the model (--model ...:disable_clip).
dnn_epstringAlias for tiny_device: ONNX Runtime execution provider for the tiny model (--dnn-ep / --tiny-device). Default: auto.
enable_transformbooleanEnable score transform on the model (--model ...:enable_transform).
featurearrayAdditional feature extractors, each passed as a repeated --feature flag. Use the libvmaf 'name[=key=val:...]' syntax, e.g. 'psnr' or 'cambi=full_ref=true'. Mutually exclusive with aom_ctc/nflx_ctc.
frame_cntintegerMaximum number of frames to process (--frame_cnt).
frame_skip_distintegerSkip the first N frames of the distorted input (--frame_skip_dist).
frame_skip_refintegerSkip the first N frames of the reference (--frame_skip_ref).
gpumaskintegerBitmask restricting permitted GPU operations (--gpumask).
hip_deviceintegerSelect HIP GPU device by index (--hip_device).
metal_deviceintegerSelect Metal GPU device by index (--metal_device).
modelstring
nflx_ctcstringNetflix Common Test Conditions preset (--nflx_ctc). Mutually exclusive with manual feature/model config.
no_predictionbooleanExtract features only, skip VMAF prediction (--no_prediction).
no_referencebooleanNo-reference (NR) mode (--no-reference). Requires tiny_model (an NR ONNX model); the reference path becomes a formality — pass any valid YUV of matching geometry since only the distorted picture is…
output_fmtstringScore output format (--json, --xml, --csv, --sub). Default: json.
precisionstringScore precision format. Default 'legacy' (%.6f, Netflix-compatible per ADR-0119); use 'max' for lossless float output (%.17g).
subbooleanWrite output file as subtitle-style per-frame scores (--sub). Equivalent to output_fmt='sub'.
subsampleintegerScore every Nth frame (1 = every frame).
sycl_deviceintegerSelect SYCL GPU device by index (--sycl_device).
threadsintegerWorker thread count (--threads). Capped to hardware cores by the CLI.
tiny_codecstringEncoder name for codec-aware tiny models (--tiny-codec), e.g. libx264.
tiny_crfintegerCRF / QP integer for codec-aware tiny models (--tiny-crf; clamped to 0..63).
tiny_devicestringONNX Runtime execution provider for the tiny model (--tiny-device / --dnn-ep). Default: auto.
tiny_fp16booleanRequest fp16 IO where the execution provider supports it (--tiny-fp16).
tiny_modelstringPath to a tiny ONNX model loaded alongside classic models (--tiny-model).
tiny_model_verifybooleanRequire Sigstore-bundle verification of the tiny model before use (--tiny-model-verify).
tiny_presetstringEncoder preset string for codec-aware tiny models (--tiny-preset).
tiny_resizestringAuto-resize filter for NCHW tiny models on dimension mismatch (--tiny-resize). Default: disabled (mismatch hard-errors).
tiny_threadsintegerCPU EP intra-op thread count for the tiny model (--tiny-threads; 0 = ORT default).

list_models

Enumerate VMAF models (JSON / pickle / ONNX) shipped with the repo.

list_backends

Report which runtime backends (cpu / cuda / sycl / hip / metal) the local vmaf binary was built with.

run_benchmark

Run the full multi-fixture benchmark harness (bench_all.sh) across all available backends (CPU, CUDA, SYCL) on three canonical YUV fixture sets: the 576x324 Netflix golden pair, a 1080p 5-frame pair, and the 4K BBB 200-frame pair. Returns stdout (per-backend scores + backend comparison table) and stderr. Takes no arguments — fixtures are built-in. ADR-0513.

eval_model_on_split

Run an ONNX tiny-AI regressor on a parquet feature cache, filter to a deterministic train/val/test split (keyed by the 'key' column), and report PLCC / SROCC / RMSE.

ParameterTypeDescription
features *stringParquet feature cache path.
model *stringONNX model path.
input_namestring
splitstring

compare_models

Rank several ONNX models on the same parquet feature split by descending PLCC. Models that fail to load or score are listed under 'errors' instead of aborting the whole call.

ParameterTypeDescription
features *string
models *array
input_namestring
splitstring

describe_worst_frames

Score a (ref, dis) pair, pick the N worst-VMAF frames, extract each as PNG via ffmpeg, and describe the visible artefacts with a local vision-language model through ONNX Runtime GenAI (VMAF_MCP_VLM_MODEL, [vlm] extra). Returns frame metadata with a note when no model is configured. ADR-0172 / ADR-1886.

ParameterTypeDescription
bitdepth *integer
dis *string
height *integer
pixfmt *string
ref *string
width *integer
backendstring
modelstring
nintegerHow many worst-VMAF frames to describe.

probe_backend

Run a 1-frame VMAF health check to distinguish 'compiled in' from 'driver present + functional'. Returns compiled_in (bool), runtime_healthy (bool), latency_ms, score (the VMAF mean on a 64×64 mid-grey pair; >=36px per dimension is required by CUDA ADM), and any error string. Use this when list_backends returns true but actual GPU dispatch may fail (driver not loaded, ICD missing, KFD ioctl failure, etc.). ADR-0608.

ParameterTypeDescription
backend *stringBackend to health-check.

vmaf_version

Return the local vmaf binary's identity and build flags. Reports binary_path, version string (from --version), and build_flags dict (cpu/cuda/sycl/hip/metal). Use this to confirm which fork build is running before scoring. ADR-0608.

vmaf_score_encoded

Score a (reference, distorted) pair of encoded video files (MP4, MKV, Y4M, WebM, etc.) by decoding them to raw YUV via ffmpeg and then running vmaf_score. Geometry (width, height, pixel format, bit depth) is probed automatically from the reference stream — no manual size entry required. Returns the same response shape as vmaf_score plus reference_encoded and distorted_encoded fields. Requires ffmpeg + ffprobe on PATH. ADR-0608.

ParameterTypeDescription
distorted_encoded *stringPath to the distorted encoded video.
reference_encoded *stringPath to the reference encoded video (MP4/MKV/Y4M/...). Must be under an allowlisted root (VMAF_MCP_ALLOW).
aom_ctcstringAOM Common Test Conditions preset (--aom_ctc). Configures a fixed model + feature set; mutually exclusive with manual feature/model config.
backendstring
cpumaskintegerBitmask restricting permitted CPU SIMD instruction sets (--cpumask).
csvbooleanWrite output file as CSV (--csv). Equivalent to output_fmt='csv'.
disable_clipbooleanDisable score clipping to [0, 100] on the model (--model ...:disable_clip).
dnn_epstringAlias for tiny_device: ONNX Runtime execution provider for the tiny model (--dnn-ep / --tiny-device). Default: auto.
enable_transformbooleanEnable score transform on the model (--model ...:enable_transform).
featurearrayAdditional feature extractors, each passed as a repeated --feature flag. Use the libvmaf 'name[=key=val:...]' syntax, e.g. 'psnr' or 'cambi=full_ref=true'. Mutually exclusive with aom_ctc/nflx_ctc.
frame_cntintegerMaximum number of frames to process (--frame_cnt).
frame_skip_distintegerSkip the first N frames of the distorted input (--frame_skip_dist).
frame_skip_refintegerSkip the first N frames of the reference (--frame_skip_ref).
gpumaskintegerBitmask restricting permitted GPU operations (--gpumask).
hip_deviceintegerSelect HIP GPU device by index (--hip_device).
metal_deviceintegerSelect Metal GPU device by index (--metal_device).
modelstring
nflx_ctcstringNetflix Common Test Conditions preset (--nflx_ctc). Mutually exclusive with manual feature/model config.
no_predictionbooleanExtract features only, skip VMAF prediction (--no_prediction).
no_referencebooleanNo-reference (NR) mode (--no-reference). Requires tiny_model (an NR ONNX model); the reference path becomes a formality — pass any valid YUV of matching geometry since only the distorted picture is…
output_fmtstringScore output format (--json, --xml, --csv, --sub). Default: json.
precisionstringScore precision format. Default 'legacy' (%.6f, Netflix-compatible per ADR-0119); use 'max' for lossless float output (%.17g).
subbooleanWrite output file as subtitle-style per-frame scores (--sub). Equivalent to output_fmt='sub'.
subsampleintegerScore every Nth frame (1 = every frame).
sycl_deviceintegerSelect SYCL GPU device by index (--sycl_device).
threadsintegerWorker thread count (--threads). Capped to hardware cores by the CLI.
tiny_codecstringEncoder name for codec-aware tiny models (--tiny-codec), e.g. libx264.
tiny_crfintegerCRF / QP integer for codec-aware tiny models (--tiny-crf; clamped to 0..63).
tiny_devicestringONNX Runtime execution provider for the tiny model (--tiny-device / --dnn-ep). Default: auto.
tiny_fp16booleanRequest fp16 IO where the execution provider supports it (--tiny-fp16).
tiny_modelstringPath to a tiny ONNX model loaded alongside classic models (--tiny-model).
tiny_model_verifybooleanRequire Sigstore-bundle verification of the tiny model before use (--tiny-model-verify).
tiny_presetstringEncoder preset string for codec-aware tiny models (--tiny-preset).
tiny_resizestringAuto-resize filter for NCHW tiny models on dimension mismatch (--tiny-resize). Default: disabled (mismatch hard-errors).
tiny_threadsintegerCPU EP intra-op thread count for the tiny model (--tiny-threads; 0 = ORT default).

list_extractors

Enumerate all VmafFeatureExtractor implementations found in the local libvmaf C source tree. Returns each extractor's advertised name, inferred backend (cpu / cuda / sycl / hip / metal), and the source file it was defined in. Requires no binary — parses the C source directly. ADR-0608.

describe_model

Return metadata for a VMAF model by name or path. Accepts the model's filename stem (e.g. 'vmaf_v0.6.1'), its full filename (e.g. 'vmaf_v0.6.1.json'), or a path relative to the repo root. Fixes the Path.stem bug: 'vmaf_v0.6.1' is matched correctly against 'vmaf_v0.6.1.json' — not mis-trimmed to 'vmaf_v0.6'. Returns: name, path, format, size_bytes, model_type (JSON only), feature_names (JSON only). ADR-0608.

ParameterTypeDescription
name *stringModel name stem (e.g. 'vmaf_v0.6.1'), full filename (e.g. 'vmaf_v0.6.1.json'), or repo-relative path.

run_compare

Wrap 'vmaf-tune compare': compare codec adapters at one or more target VMAF scores and return a ranked report. Requires vmaf-tune to be installed (pip install -e tools/vmaf-tune). Emits MCP progress notifications when params._meta.progressToken is set. Default encoders: libx264,libx265,libsvtav1,libvpx-vp9. ADR-0608.

ParameterTypeDescription
src *stringSource video path (any FFmpeg-readable format or raw YUV).
encodersstringComma-separated encoder list, e.g. 'libx264,libx265'.
frameratenumberSource framerate.
heightintegerSource height (raw YUV only).
no_parallelbooleanDispatch encoders sequentially (default: parallel).
pix_fmtstring
target_vmafnumberSingle VMAF target (legacy, single-target schema).
target_vmafsstringComma-separated VMAF targets, e.g. '94,96,97,98'.
widthintegerSource width (raw YUV only).

run_ladder

Wrap 'vmaf-tune ladder': build a per-title bitrate ladder via convex-hull sweep over resolution x target-VMAF, pick K knees, and emit an HLS / DASH / JSON manifest. Requires vmaf-tune. Emits MCP progress notifications. ADR-0608.

ParameterTypeDescription
resolutions *stringComma-separated WxH list, e.g. '1920x1080,1280x720,854x480'.
src *stringSource video path.
target_vmafs *stringComma-separated VMAF targets, e.g. '95,90,85'.
encoderstringCodec adapter (default libx264).
formatstringManifest format.
frameratenumberSource framerate.
quality_tiersintegerNumber of ladder rungs to select.
spacingstring

run_tune_per_shot

Wrap 'vmaf-tune tune-per-shot': detect scene cuts, run a per-shot CRF bisect targeting a VMAF score, and return the encoding plan. Requires vmaf-tune. Emits MCP progress notifications. ADR-0608.

ParameterTypeDescription
src *stringSource video path.
encoderstring
formatstring
frameratenumber
outputstringOutput video path (optional; plan-only if omitted).
pix_fmtstring
scene_thresholdnumberScene-cut detection threshold (0..1).
target_vmafnumberTarget VMAF score.

vmaf_per_shot

Wrap the 'vmaf-perShot' sidecar binary: scan a raw YUV reference, detect shot boundaries from luma complexity + motion energy, and return a per-shot CRF plan targeting a VMAF score. Returns the parsed JSON plan by default (format='csv' returns the raw CSV text instead). ADR-0222.

ParameterTypeDescription
height *integer
reference *stringReference raw planar YUV path (must be under an allowlisted root).
width *integer
bitdepthintegerPlanar YUV bit depth (--bitdepth).
crf_maxintegerUpper CRF clamp (--crf-max).
crf_minintegerLower CRF clamp (--crf-min). Must not exceed crf_max.
diff_thresholdnumberShot-detector frame-diff cutoff (--diff-threshold; C default 12).
formatstringPlan encoding (--format). The MCP tool defaults to json (the C CLI defaults to csv) so the plan comes back structured.
pixel_formatstringPlanar YUV subsampling (--pixel_format).
target_vmafnumberTarget VMAF score the CRF predictor aims at (--target-vmaf).

vmaf_roi

Wrap the 'vmaf_roi' sidecar binary: compute a per-CTU saliency grid for one frame of a raw YUV file and emit an encoder ROI sidecar. encoder='x265' returns the qpfile text in 'qpfile'; encoder='svt-av1' returns the raw int8 ROI map base64-encoded in 'roi_map_base64'. Without saliency_model a centre-weighted radial placeholder is used (smoke-test quality only).

ParameterTypeDescription
frame *integer0-based frame index to score (--frame).
height *integer
reference *stringReference raw planar YUV path (must be under an allowlisted root).
width *integer
bitdepthinteger
ctu_sizeintegerCTU grid cell size (--ctu-size; x265 max-ctu).
encoderstringSidecar dialect (--encoder).
pixel_formatstring
saliency_modelstringOptional ONNX [1,1,H,W] luma->[0,1] saliency model (--saliency-model). Must be under an allowlisted root.
strengthnumberQP-offset gain applied to the saliency grid (--strength).

vmaf_bench

Wrap the 'vmaf_bench' sidecar binary: per-feature micro-benchmark over the built-in synthetic fixtures, or (validate=true) a GPU-vs-CPU correctness comparison. Distinct from run_benchmark, which runs the end-to-end bench_all.sh harness over real YUV fixtures. In validate mode a non-zero exit is reported as validation_failed=true rather than as a tool error.

ParameterTypeDescription
bpcintegerBits per component (--bpc; C default 8).
data_dirstringTest-data directory (--data-dir). Must be a directory under an allowlisted root.
device_listbooleanList the available GPU devices and exit (--list-devices).
framesintegerFrames per benchmark (--frames; C default 10, max 48).
gpu_onlybooleanSkip the CPU targets (--gpu-only).
resolutionstringSingle resolution to test (--resolution). Omit to test all.
validatebooleanGPU-vs-CPU correctness comparison (--validate).

vmaf_vpl

Wrap the 'vmaf_vpl' sidecar binary: decode an encoded (reference, distorted) pair with Intel oneVPL, import the VA surfaces zero-copy into SYCL via DMA-BUF, and score them. Only built when the oneVPL + libva + SYCL toolchain is present; otherwise the tool reports the missing binary. Returns the parsed vmaf_score and frames_processed alongside the raw stdout.

ParameterTypeDescription
dis *stringDistorted encoded video path.
ref *stringReference encoded video path.
deviceintegerSYCL device index (--device).
fallbackbooleanFall back to a host upload when the zero-copy import fails (--fallback).
framesintegerMax frames to process (--frames; 0 = all).
modelstringBare VMAF model name (--model). Paths are rejected.
render_nodestringVA-API render node (--render-node). Restricted to /dev/dri/renderD<N> or /dev/dri/card<N>.