Nodes/CMK Flow/CMK Video Metrics
ComfyUI Node

CMK Video Metrics

Width, height, fps and bit depth as real outputs you can wire

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Video Metrics
  • video
  • video
  • width
  • height
  • fps
  • bit_depth

ComfyUI's native VIDEO type is a black box with a couple of getters on it. You can preview it, you can merge it, you can hand it to another video node - but you cannot easily ask "what resolution is this actually?" and feed the answer somewhere. CMK Video Metrics is four wires' worth of answer: dimensions, frame rate and bit depth as integers, with the video passed through untouched.

That "untouched" part is the design. This is a tap, not a transformer. Video in, same video out, plus numbers.

How it works

It's one of the newer-style nodes in the pack - built on ComfyUI's comfy_api.latest io module (io.ComfyNode, io.Schema, io.Video.Input) rather than the older dict-based INPUT_TYPES layout most CMK nodes still use. That's a sign you're looking at a recent addition: the pack has both styles because it predates and then adopted the new node API.

Collection is defensive throughout, which tells you the author has been bitten. get_dimensions() gives width and height. get_components() is tried for the frame rate - under several attribute names, frame_rate, fps, framerate - because the container's shape has moved around. get_bit_depth() gives bit depth. Frame count is the most interesting: the node first reads shape[0] off the video (or a nested images/frames/video/tensor/data/samples attribute), then falls back to named count attributes (frame_count, num_frames, n_frames, total_frames, frames_count), then to plain list length. Every one of those reads is wrapped, and any failure degrades to 0 rather than raising.

The practical consequence: you will not get an exception from this node, and a 0 means "couldn't determine it", not "zero". That's the right tradeoff for a diagnostics tap but it means you should sanity-check the numbers rather than trusting a bare 0.

Inputs and outputs

One input:

  • video (VIDEO) - anything carrying ComfyUI's native video type. That includes loaded videos, merged results, and whatever a video-producing custom node hands back.

Outputs, in order:

  • video (VIDEO) - the same object, unchanged. This is what you chain onward.
  • width (INT)
  • height (INT)
  • fps (INT) - note the type. The underlying value is float, and it gets coerced through an integer conversion, so a 23.976 fps clip reports 23. If you need the exact rational frame rate, don't use this node for it.
  • bit_depth (INT)

Wire width/height into anything that wants a size - a second-pass generator, an upscale decision, a string builder for filenames. It's also a decent guard: put it in front of a pass that assumes 1080p and let a mismatch surface as a visibly wrong number rather than a silent resize.

Note what is not here. There's no frame count, duration or pixel count on this node's outputs even though the internal metrics dict computes them - they're exposed through the QuickMetrics sibling and through the pack's log and preview channels instead. If you specifically want frames or duration, you're looking at the wrong one of the pair.

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

This node needs no models and no ffmpeg - it reads whatever the video object already knows about itself. It does require a ComfyUI new enough to have the comfy_api.latest module and the native VIDEO type; on an older build the node won't register, which reads as a missing node rather than a version error. The pack's stated tested target is ComfyUI 0.38.2 with frontend 1.53.6, and CMK also wants the Vue Nodes / Nodes 2.0 setting on - it warns at startup if it isn't.

Common issues

  • Node missing from the menu. Almost always a ComfyUI that predates the comfy_api video interface, or a pack that failed to import for an unrelated reason. Check the console at startup; CMK registers nothing if its imports fail.
  • fps is 24 but the file is 23.976. Expected - the output is typed INT.
  • fps or bit_depth is 0. The container didn't report it through any of the attribute paths the node tries. For bit depth this is common with ordinary 8-bit H.264 files that never had the value set explicitly.
  • "I wired width into a node and got a type error." It's an INT output; if the target expects a float or a string you need a conversion node in between, same as any ComfyUI int.
CategoryCMK/Toolbox/Diagnostics

Inputs (1)

NameTypeDefaultDescription
videoVIDEO—

Outputs (5)

NameTypeDescription
videoVIDEO—
widthINT—
heightINT—
fpsINT—
bit_depthINT—