Tool
Paste the file names from your originals folder and your encodes folder, and this tool pairs them automatically and builds a script that measures VMAF for every file and collects the results into a single CSV. Instead of installing a dedicated VMAF GUI, you leave the repetitive work to the FFmpeg you already use. The files are never read or uploaded; only the names go into the script.
1. Environment to run in
2. Paste file names (one per line)
Select all the files in a folder and copy their names, or print just the names in PowerShell with something like (Get-ChildItem -Name) -join "`n" and paste them here. If a path is attached, only the file name is used. The files themselves are never read or uploaded.
4 pairs · 3 originals · 5 encoded files
| Encoded | Original |
|---|---|
| clip01_x264_crf23.mkv | clip01.mp4 |
| clip01_x265_crf26.mkv | clip01.mp4 |
| clip02_x264_crf23.mkv | clip02.mp4 |
| clip10_x265_crf26.mkv | clip10.mp4 |
Encoded files with no match (1): extra_test.mp4 — left out of the script.
3. Folders
4. Measurement options
You don't enter resolution or fps. The script reads them from each file with ffprobe; if an encoded file's resolution differs from the original it is scaled to the original's size, and if its fps differs it is matched to the original's fps.
5. Script
# Batch VMAF measurement — script generated by Codec Lab's tool
# Run: powershell -ExecutionPolicy Bypass -File .\vmaf-batch.ps1
# Requires: ffmpeg (with libvmaf) and ffprobe on PATH
$ErrorActionPreference = 'Stop'
$RefDir = 'D:\originals'
$DistDir = 'D:\encodes'
$OutDir = 'D:\vmaf-out'
$ModelOpt = 'model=version=vmaf_v0.6.1'
$Threads = 4
$Subsample = 1
# Pair list (dist = encoded file, ref = original)
$Pairs = @'
dist,ref
"clip01_x264_crf23.mkv","clip01.mp4"
"clip01_x265_crf26.mkv","clip01.mp4"
"clip02_x264_crf23.mkv","clip02.mp4"
"clip10_x265_crf26.mkv","clip10.mp4"
'@ | ConvertFrom-Csv
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
$RefDir = (Resolve-Path -LiteralPath $RefDir).Path
$DistDir = (Resolve-Path -LiteralPath $DistDir).Path
$OutDir = (Resolve-Path -LiteralPath $OutDir).Path
function Get-Num([string]$r) {
$p = $r -split '/'
if ($p.Count -eq 2 -and [double]$p[1] -ne 0) { return [double]$p[0] / [double]$p[1] }
return [double]$p[0]
}
function Get-Info([string]$f) {
$o = (& ffprobe -v error -select_streams v:0 -show_entries stream=width,height,avg_frame_rate -of csv=p=0 $f | Select-Object -First 1)
$a = $o -split ','
return @{ W = [int]$a[0]; H = [int]$a[1]; Fps = $a[2] }
}
$rows = New-Object System.Collections.Generic.List[object]
$n = 0
foreach ($p in $Pairs) {
$n++
$dist = Join-Path $DistDir $p.dist
$ref = Join-Path $RefDir $p.ref
$log = ('vmaf_{0:000}.json' -f $n)
$row = [ordered]@{ dist = $p.dist; ref = $p.ref; status = ''; vmaf_mean = ''; vmaf_harmonic_mean = ''; vmaf_min = ''; psnr_y_mean = ''; size_MB = ''; kbps = ''; scaled = ''; log = $log }
if (-not (Test-Path -LiteralPath $dist) -or -not (Test-Path -LiteralPath $ref)) {
$row.status = 'missing file'; $rows.Add([pscustomobject]$row); Write-Warning ('File not found: ' + $p.dist + ' / ' + $p.ref); continue
}
try {
$d = Get-Info $dist; $r = Get-Info $ref
$dChain = @()
if ($d.W -ne $r.W -or $d.H -ne $r.H) { $dChain += ('scale={0}:{1}:flags=bicubic' -f $r.W, $r.H); $row.scaled = ('{0}x{1}->{2}x{3}' -f $d.W, $d.H, $r.W, $r.H) }
if ([math]::Abs((Get-Num $d.Fps) - (Get-Num $r.Fps)) -gt 0.01) { $dChain += ('fps=' + $r.Fps) }
$dChain += 'format=yuv420p'
$dChain += 'setpts=PTS-STARTPTS'
$rChain = @()
$rChain += 'format=yuv420p'
$rChain += 'setpts=PTS-STARTPTS'
$opts = @($ModelOpt)
if ($Threads -gt 0) { $opts += ('n_threads=' + $Threads) }
if ($Subsample -gt 1) { $opts += ('n_subsample=' + $Subsample) }
$opts += 'log_fmt=json'
$opts += ('log_path=' + $log)
$filter = '[0:v]' + ($dChain -join ',') + '[dist];[1:v]' + ($rChain -join ',') + '[ref];[dist][ref]libvmaf=' + ($opts -join ':')
# Run from the output folder so the log path can be relative (avoids escaping the drive-letter colon)
Push-Location $OutDir
try { & ffmpeg -hide_banner -loglevel error -y -i $dist -i $ref -lavfi $filter -f null - } finally { Pop-Location }
if ($LASTEXITCODE -ne 0) { throw ('ffmpeg exit code ' + $LASTEXITCODE) }
$j = Get-Content -LiteralPath (Join-Path $OutDir $log) -Raw | ConvertFrom-Json
$m = ($j.pooled_metrics.PSObject.Properties | Where-Object { $_.Name -like 'vmaf*' } | Select-Object -First 1).Value
$row.vmaf_mean = [math]::Round([double]$m.mean, 3)
$row.vmaf_harmonic_mean = [math]::Round([double]$m.harmonic_mean, 3)
$row.vmaf_min = [math]::Round([double]$m.min, 3)
$bytes = (Get-Item -LiteralPath $dist).Length
$dur = [double](& ffprobe -v error -show_entries format=duration -of csv=p=0 $dist | Select-Object -First 1)
$row.size_MB = [math]::Round($bytes / 1MB, 2)
if ($dur -gt 0) { $row.kbps = [math]::Round($bytes * 8 / $dur / 1000, 0) }
$row.status = 'ok'
} catch {
$row.status = 'error: ' + $_.Exception.Message
Write-Warning ($p.dist + ' measurement failed: ' + $_.Exception.Message)
}
$rows.Add([pscustomobject]$row)
Write-Host ('[{0}/{1}] {2} {3} VMAF={4}' -f $n, @($Pairs).Count, $p.dist, $row.status, $row.vmaf_mean)
}
$csv = Join-Path $OutDir 'vmaf-summary.csv'
$rows | Export-Csv -LiteralPath $csv -NoTypeInformation -Encoding UTF8
Write-Host ('Summary CSV: ' + $csv)
In PowerShell, run the saved file with powershell -ExecutionPolicy Bypass -File .\vmaf-batch.ps1. When it finishes, the results folder contains a JSON log for each file and vmaf-summary.csv.
Search for “vmaf gui” and you get small GitHub projects and commercial tools. Many of those programs are known to call FFmpeg's libvmaf filter under the hood. When you have dozens of files encoded at different CRF values, what you actually need is not a window but three things: pairing, repeated runs, and collecting results. This tool turns those three things into one script. There is nothing new to install, you can open and read the script, and changing an option and rerunning it is easy.
_, -, . or a space. clip01.mp4 ↔ clip01_x264_crf23.mkv is an example. When there are two candidates, the longer original name wins, so even if clip1 and clip10 both exist, clip10_x265.mkv is attached to clip10.scaled to the original's size, and if the fps differs it is matched to the original fps. Which files were scaled is recorded in the scaled column of the CSV. A score measured after matching can differ from a score measured between files of the same resolution, so measure the files you want to compare in the same way.scale, fps, format, setpts) as the VMAF Command Builder for single commands.vmaf_001.json, so no C: escaping is needed. The model defaults to a built-in version name, so it needs no path either. If you specify a model file path yourself, only that path is escaped.dist, ref, status, vmaf_mean, vmaf_harmonic_mean, vmaf_min, psnr_y_mean, size_MB, kbps, scaled, log. If one file fails, the script does not stop; it writes the reason in status and moves on to the next file. The PowerShell version of the CSV is UTF-8 with a BOM, so Excel usually opens even non-ASCII file names correctly.kbps is the encoded file's size divided by its duration, so it is an overall average that includes audio and container overhead. It is not the bitrate of the video stream alone.vmaf_v0.6.1) is known to be calibrated for a 1080p display, and it is the model our lab measurements used. The 4K model assumes a 4K display, so it is a candidate for 3840x2160 video. NEG is known as a model that measures without the score boost that preprocessing such as sharpening can give. For a fuller comparison, see the explanation on the command builder page.vmaf_min or vmaf_harmonic_mean is much lower than its mean may have bad moments. A case where a high mean hides bad stretches is in Is Average VMAF 95 Good Enough? (lab measurement).size_MB and vmaf_mean side by side and ask “at a similar score, which one is smaller?” Don't compare scores across different originals; each original differs in how easy it is to compress.status column and the PowerShell warning message, and paste the log into the FFmpeg Error Log Explainer.libvmaf shows up in ffmpeg -filters. If it doesn't, inspect your build with the FFmpeg build checker. The model syntax assumes libvmaf 2.x (FFmpeg 5 or later).mean, harmonic_mean and min from the first entry in pooled_metrics whose name starts with vmaf. With a log in a different format, those columns come out empty or the file is marked as failed.output (1).mp4) cannot be paired. Rename it or run the list in separate batches. If the pair table shows a wrong pairing, fix the names before using the script.jq. The PowerShell version uses only built-in features. A double quote in a file name can throw the CSV off (Windows file names can't contain one).