Multi-shot Reference Matching
Use Cases and Reference Selection
When multiple shots from different cameras, batches, or user-specified successful clips need consistent tonal grading, execute a reference matching operation. If there is only one shot and the user has not requested matching, either keep it as-is or apply an explicit color grading request as specified.
The reference shot is specified by the request. Consider the following process principles: the subject and lighting should be close to the target clip, contain known neutrals or skin tones, and be representative of the project's overall look. YAVG 90–120 is a reference for explicit diagnostics, not a qualification gate for the reference shot, nor a reason to regenerate clips due to lack of a "qualified" reference.
SOP and Interface
color-cli match --ref hero.mp4 --in a.mp4 --in b.mp4 --out-dir matched-v2/ --json
- Triggered as an explicit matching request; verify one reference, at least one target, a valid output directory, real source files, and current SHA256. Fail if the reference is missing, out of bounds, or permissions are wrong; preserve the actual receipt.
- Read necessary statistics from the reference and each target, derive exposure, saturation, and chroma axis corrections. These readings are used to perform the transform, not to evaluate source acceptance.
- Execute one local transform per item, producing new files. For missing targets or FFprobe/FFmpeg processing errors, record
ok=false, the error code, and reason for that item; continue processing remaining targets. - Return a complete
resultsarray; exit 0 on full success, exit 3 if any item fails. Normal output and JSON have the same failure semantics; do not determine completion by file count alone. - For successful items, verify output SHA256; set unmeasured residuals to
nullandqualityReviewed=false. Preserve original SHA256 and historical quality failures; do not perform residual re-review or automatic second round.
Parameter Constraints
| Parameter | Constraint | Handling |
|---|---|---|
reference | Exactly one valid readable reference | Missing => explicit failure |
targets | At least one; results kept per item | Empty array => usage error |
intensity | Greater than 0 and ≤ 1 | Controls look blending |
profile | Supported profile or omitted | Do not automatically replace unknown recipes |
outDir | Valid new output directory | Originals read-only, do not overwrite input |
histogramCheck | Legacy off/warn/fail parameter compatible | Do not restore quality rejection of final clips |
denoise | Execute only when explicitly requested | Do not reject originals based on default noise review |
Optional Diagnostic Process Table
| Metric | Original Process Reference | Current Purpose |
|---|---|---|
| ΔYAVG | Not exceeding 5 | Explain luminance difference during explicit diagnostics |
| ΔUAVG / ΔVAVG | Not exceeding 3 | Explain chroma difference during explicit diagnostics |
| Skin tone HSV | 20–40° | Diagnostic reference; explicit skin patch preferred |
| Playback jumps | User review opinion | Form explicit feedback; do not auto-redo |
By default, do not measure output residuals. Severely underexposed, highlight-clipped, or soft-focus clips from successful shots are still processed by the tool. The tool must not treat null as 0, nor write "matching quality passed". User re-selection of a reference is a new local request, not triggered by diagnostic scores.
Failure Modes (Symptom → Cause → Resolution)
| Symptom | First Check Cause | Resolution |
|---|---|---|
| Reference path missing | File or source registration mismatch | Stop batch; return actual error; do not guess other references |
| Some targets missing | results[].error=not_found | Preserve full results and successful outputs; exit non-zero |
| Target container corrupt | FFprobe non-zero exit / no video track | Name the failed item and actual stderr; continue other items; do not fake success |
| Processing or disk write failure | FFmpeg, writable directory, space | Mark that item as failed; do not copy originals to impersonate matching results |
| User thinks reference selection is wrong | User feedback and current reference ID | Log new explicit reference request; preserve previous results |
| Different camera color spaces | Explicit transfer/gamut metadata | Process with supported conversions; fail explicitly for unsupported parameters; do not guess log |
Receipt and Knowledge References
Record the reference path, necessary reference statistics, and selection rationale; for each target: ok/output/actual SHA256/correction amounts/error; state that after/residual is unmeasured and quality not reviewed. Breakpoint execution takes the full failure list as input; do not automatically re-pay.
Knowledge entry: library/color-kb/_INDEX.md, CGRADE-007 Inter-shot Matching Methodology and CGRADE-005 Waveform Interpretation. Historical diagnostic thresholds can still be used for explicit analysis, but are not wired into formal material acceptance conditions.