/media-os:ffmpeg-quality [reference] [distorted]from media-os
Measures video encode quality using ffmpeg full-reference filters: VMAF, PSNR, SSIM, VMAF motion, blur/block detection. Use for QA transcodes, benchmarking codecs, or finding optimal CRF.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
Reference-vs-distorted (full-reference) objective quality metrics with ffmpeg filters. VMAF is the gold standard for perceptual quality; PSNR and SSIM are older but universally understood. All full-reference filters require the two inputs to be pixel-aligned: same resolution, same frame rate, same pixel format, same length.
Full-reference metrics (VMAF, PSNR, SSIM) require both inputs to match exactly on:
scale=W:H:flags=bicubic.fps=R (or minterpolate for fractional conversions).format=yuv420p (or yuv422p10le, matching the model bit-depth).tpad, or truncate with -t.Canonical prefilter (both upscaled to 1080p, 24 fps, yuv420p):
[0:v]scale=1920:1080:flags=bicubic,fps=24,format=yuv420p[dist];
[1:v]scale=1920:1080:flags=bicubic,fps=24,format=yuv420p[ref];
Check alignment first: ffprobe -v error -select_streams v:0 -show_entries stream=width,height,r_frame_rate,pix_fmt,nb_frames <file>.
Default model (vmaf_v0.6.1) — 1080p desktop viewing:
ffmpeg -i distorted.mp4 -i reference.mp4 -lavfi \
"[0:v]scale=1920:1080:flags=bicubic[dist];[1:v]scale=1920:1080:flags=bicubic[ref];[dist][ref]libvmaf=model=version=vmaf_v0.6.1:log_path=vmaf.json:log_fmt=json:n_threads=8" \
-f null -
Order matters: [distorted][reference] — distorted first.
Model selection:
vmaf_v0.6.1 — default, 1080p desktop.vmaf_v0.6.1neg — "no enhancement gain"; penalizes over-sharpening. Use when encoder might cheat with unsharp masks.vmaf_4k_v0.6.1 — 4K displays, larger viewing distance assumed.vmaf_float_v0.6.1 — higher-precision float model.libvmaf=model=version=vmaf_v0.6.1:phone_model=1 (legacy flag; newer builds use model=path=/path/to/vmaf_v0.6.1.json).ffmpeg -i distorted.mp4 -i reference.mp4 -lavfi "[0:v][1:v]psnr=stats_file=psnr.log" -f null -
Stats file per-frame: n:X mse_avg:Y mse_y:A mse_u:B mse_v:C psnr_avg:Z psnr_y:... psnr_u:... psnr_v:....
ffmpeg -i distorted.mp4 -i reference.mp4 -lavfi "[0:v][1:v]ssim=stats_file=ssim.log" -f null -
Stats file per-frame: n:X Y:a U:b V:c All:d (dB).
ffmpeg -i in.mp4 -vf "blockdetect=period_min=3:period_max=24:planes=7" -f null -
ffmpeg -i in.mp4 -vf "blurdetect" -f null -
Both emit per-frame metadata; higher lavfi.block / lavfi.blur means more artifacts.
vmafmotion — motion-complexity only (one of VMAF's sub-features, isolated).identity — detects whether two streams are byte-identical.msad — Mean Sum of Absolute Differences (cheap proxy for PSNR).VMAF JSON summary (pooled mean):
jq '.pooled_metrics.vmaf.mean' vmaf.json
jq '.pooled_metrics.vmaf | {min, max, mean, harmonic_mean}' vmaf.json
jq '.frames[] | {n: .frameNum, vmaf: .metrics.vmaf}' vmaf.json | head
PSNR / SSIM averages print to stderr at the end:
[Parsed_psnr_0 @ ...] PSNR y:42.13 u:45.22 v:45.88 average:43.21
[Parsed_ssim_0 @ ...] SSIM Y:0.973 U:0.988 V:0.989 All:0.978 (16.54dB)
Rate-distortion sweep (use scripts/quality.py sweep, Step 4):
VMAF (0–100):
< 70 — visibly degraded.70–80 — watchable, noticeable compression.80–90 — good; streaming ladder "main" tiers.90–95 — excellent.95+ — near-transparent; reserved for archive/mastering.~100 — identical (within float noise).PSNR (dB): content-dependent ceiling. Rough bands:
< 30 — poor.30–35 — low.35–40 — moderate.40–45 — high.45+ — excellent / near-lossless.SSIM (0–1):
< 0.90 — visible degradation.0.90–0.95 — acceptable.0.95–0.98 — good.0.98+ — excellent.Per-frame dips matter more than the mean — sort frames ascending and look at the 1st percentile for worst-case scenes.
scripts/quality.py — subcommands vmaf, psnr, ssim, sweep. Stdlib-only, --dry-run, --verbose.Examples:
uv run ${CLAUDE_SKILL_DIR}/scripts/quality.py vmaf --reference ref.mp4 --distorted enc.mp4 --model vmaf_v0.6.1 --threads 8 --log-path vmaf.json
uv run ${CLAUDE_SKILL_DIR}/scripts/quality.py psnr --reference ref.mp4 --distorted enc.mp4 --stats-file psnr.log
uv run ${CLAUDE_SKILL_DIR}/scripts/quality.py ssim --reference ref.mp4 --distorted enc.mp4 --stats-file ssim.log
uv run ${CLAUDE_SKILL_DIR}/scripts/quality.py sweep --reference ref.mp4 --crfs 18,22,26,30 --encoder libx264 --preset medium
references/metrics.md for the full option tables, model catalog, scoring bands, scaling recipes, and rate-distortion methodology.scale + fps + format.[distorted][reference] (distorted first). Swapping does not crash but the result is meaningless.[0:v] vs [1:v].libvmaf requires ffmpeg built with --enable-libvmaf. Check with ffmpeg -filters | grep vmaf. Homebrew ffmpeg generally includes it; minimal static builds often do not..json model file and use model=path=/absolute/path.json.n_threads defaults to 1 — VMAF is CPU-bound; set it to nproc or at least 4 or it crawls.vmaf_v0.6.1neg is the right choice when you suspect the encoder is doing enhancement (sharpening / detail synthesis). Default model rewards sharpening, neg does not..pooled_metrics.vmaf.harmonic_mean is in the JSON).ffmpeg -i encoded_4k.mp4 -i source_4k.mov -lavfi \
"[0:v]scale=3840:2160:flags=bicubic,format=yuv420p[d];[1:v]scale=3840:2160:flags=bicubic,format=yuv420p[r];[d][r]libvmaf=model=version=vmaf_4k_v0.6.1:log_path=vmaf_4k.json:log_fmt=json:n_threads=16" \
-f null -
jq '.pooled_metrics.vmaf.mean' vmaf_4k.json
uv run ${CLAUDE_SKILL_DIR}/scripts/quality.py sweep --reference source.mov --crfs 18,20,22,24,26 --encoder libx264 --preset slow
# Review the printed table; pick the highest CRF whose VMAF mean still >= 93.
ffmpeg -i enc.mp4 -i ref.mov -lavfi "[0:v][1:v]psnr=stats_file=psnr.log" -f null -
sort -t: -k7 -n psnr.log | head -20 # 20 worst frames by psnr_avg
No such filter: 'libvmaf'Cause: ffmpeg not built with libvmaf support.
Solution: reinstall a full build (brew reinstall ffmpeg on macOS, or build with --enable-libvmaf). Verify with ffmpeg -filters | grep vmaf.
Could not parse framerate / scores look absurdCause: resolution or framerate mismatch between inputs.
Solution: add explicit scale=W:H,fps=R,format=yuv420p to both inputs before the metric filter.
Cause: clip too short (< 13 frames) or all-black frames confusing motion features.
Solution: score a longer range; trim out leading/trailing black with select='gt(scene\,0.001)' or preroll.
unable to load modelCause: older ffmpeg build expecting an external .json model.
Solution: download the model from the Netflix/vmaf repo and pass model=path=/abs/path/vmaf_v0.6.1.json.
Cause: sub-pixel or 1-pixel spatial offset between inputs.
Solution: verify ffprobe dimensions on both files; ensure no crop applied to one side; rerun with matched scale.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub damionrashford/media-os --plugin media-os110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
Other plugins' skills for the same job