Nodes/CMK Flow/CMK Video Compare
ComfyUI Node

CMK Video Compare

Proving your split-and-merge round trip didn't drop two frames

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Video Compare
  • SEGMENTS
  • VIDEO
  • LOG
  • METRICS
  • LOG
  • diagnostic

Video processing in ComfyUI has a nasty habit of being almost lossless. You segment a clip, run it through a face swap, merge it back - and the result plays fine, looks fine, and has 4 fewer frames, a 0.05 fps drift and an audio track that's a fifth of a second out of sync. Nothing yells at you. CMK Video Compare is the node that yells at you.

It is the objective validator for the pack's VIDEO → SEGMENTS → MERGE → VIDEO loop: source in one hand, merged result in the other, and a verdict out. It changes nothing - it doesn't steer the segments and it doesn't alter the video - which is exactly what you want from a check.

How it works

The node probes both files. It prefers ffprobe for structured metadata and falls back to reading container metadata through the ffmpeg binary (the bundled imageio-ffmpeg one counts) when ffprobe isn't on the system - the same fallback strategy the split node uses. Probe values come out as raw numbers: width, height, fps, duration, frame count, audio presence and audio duration.

Then it grades five metrics independently and takes the worst as the overall status:

  • Resolution - exact width/height match, PASS or FAIL. No tolerance, correctly.
  • FPS - PASS within 0.001, WARNING within 0.05, else FAIL.
  • Duration - tolerance is derived from the source frame time: PASS within two frames, WARNING within six.
  • Frames - same shape: ±2 frames passes, ±6 warns, beyond that fails.
  • Audio - presence must match, and audio duration is graded on the same two-frame/six-frame basis.

Those tolerances aren't sloppiness; they're container reality. Re-encoding a video goes through timestamp and GOP rounding, so demanding bit-exact duration from a merge is demanding something mp4 can't give you. Two frames of slack absorbs that. Six is a warning: watch it, but a pass-through re-encode can legitimately sit there.

One honest caveat baked into the code: if the audio metadata is unavailable - which happens when ffprobe is missing and the ffmpeg fallback can't report audio streams - audio status is WARNING with the reason "audio metadata unavailable without ffprobe". So a WARNING on audio in an otherwise clean run is often an install fact, not a bad merge.

It also builds a timeline from the segment metadata: for each segment, the source range, the trim applied at the start of the following fragment to remove overlap, and where it lands in the merged file. That table is the useful output when a merge is wrong.

Inputs and outputs

  • SEGMENTS (CMK_VIDEO_SEGMENTS, required) - the working context from CMK Split Video into Segments: source path, segment boundaries, overlap metadata. Anything else raises a type error.
  • VIDEO (CMK_VIDEO, required) - the merged result context from the merge-and-save node. The file behind it must exist or the node raises with the path.
  • LOG (CMK_LOG_PIPE, required) - documentary, appended to rather than consulted.

Three outputs: METRICS (a CMK_VIDEO_METRICS payload - immutable per-metric statuses, deltas, both probe dictionaries, the timeline tuple and the overall verdict), LOG (the same headline lines, indented into a labelled block: RESOLUTION, FPS, DURATION, FRAMES, AUDIO, each with its status), and diagnostic (the full log plus the segment timeline, ready for CMK Summary).

Wire LOG onward to keep the verdict in the run log, and hang a CMK Summary off diagnostic if you want the timeline readable on canvas instead of in the shell.

Install

Manager → search CMK Flow → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/CMKFlow/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

For the best signal, have a real ffmpeg (and ideally ffprobe) install:

# macOS
brew install ffmpeg
# Debian/Ubuntu
sudo apt install ffmpeg

The pack's imageio-ffmpeg dependency will get you a working ffmpeg binary, but not a separate ffprobe, and that's the difference between a graded audio verdict and a permanent WARNING.

Common issues

  • FAIL on frames in a run that looked fine. Usually a segment boundary problem rather than a compare-node bug: read the timeline, and check whether overlap was high enough that the merge had trims to apply.
  • Audio WARNING every single time. Install ffprobe - see above.
  • "video is outside ComfyUI input/output/temp and cannot be previewed." The node builds its preview descriptor from whichever ComfyUI root the file lives under. A custom merge output folder can be read but not shown.
  • Remember what the verdict covers. This checks the round trip - that segmentation and merging didn't lose or shift anything. It says nothing about whether the swap inside the loop looked good.
CategoryCMK/Toolbox/Video

Inputs (3)

NameTypeDefaultDescription
SEGMENTSCMK_VIDEO_SEGMENTS—
VIDEOCMK_VIDEO—
LOGCMK_LOG_PIPE—

Outputs (3)

NameTypeDescription
METRICSCMK_VIDEO_METRICS—
LOGCMK_LOG_PIPE—
diagnosticCMK_DIAGNOSTIC—