Nodes/ComfyUI-UtilsCollection/Video Resolution Selector
ComfyUI Node

Video Resolution Selector

Never hand a video model a broken resolution again

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Video Resolution Selector
    • width
    • height
    aspect_ratio16:9 (Widescreen)
    megapixels1.0
    multiple32

    Video models are picky about dimensions in a way image models just aren't. Resolutions need to be multiples of 16 or 32, stay near a sensible megapixel target, and keep your chosen aspect ratio - and doing that arithmetic by hand for every new model is the kind of busywork that wastes afternoons. UC_VideoResolutionSelector does it for you: pick an aspect ratio, set a megapixel target, and it returns width and height as plain integers, aligned to whatever multiple you need.

    What it is

    A pure math node, no models involved. You give it three things - aspect ratio, megapixels, and a pixel multiple - and it returns two INTs (width, height) that satisfy all of them as closely as possible. Out of the box it handles the standard landscape and portrait video ratios (16:9, 9:16, 21:9, 3:2, 4:3, and more), and the multiple default of 32 lines up with what most modern video backbones want.

    How it works

    Internally it's the same resolution-selection logic as the pack's UC_ImageScaleAndResolutionPicker, but for the video case: it takes your nominal megapixels target, finds the resolution closest to it for the chosen aspect_ratio, then snaps both dimensions down to the required multiple. That last step is the part people forget - a "1MP" 16:9 frame that lands on 1024×577 is useless if your model needs multiples of 32; the node returns 1024×576 instead. It also enforces a sane floor and the model's max resolution, so you can't get something degenerate out the other side.

    The megapixels slider runs 0.1 to 16.0 in 0.1 steps - 1.0 is the sweet spot for most 1MP video models, and you raise it for 2K or 4K pipelines. The multiple range is 8–128 in steps of 4, so it covers both the strict 32-multiple models and the more lenient ones.

    The inputs and outputs that matter

    • aspect_ratio - the dropdown (16:9 Widescreen is default).
    • megapixels - your target total.
    • multiple - the alignment constraint, default 32.
    • Outputs: width and height as INTs - wire them into Core's Create Empty Latent or any node that takes explicit dimensions.

    Installing it

    Part of ComfyUI-UtilsCollection:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
    

    Restart ComfyUI, or use ComfyUI Manager (search "ComfyUI-UtilsCollection"). Zero extra dependencies, no models, and it needs a recent ComfyUI since the pack is built on the current Core node API.

    Common issues

    The main trap is forgetting what "closest to target" means: the node picks a resolution near your megapixel number, it doesn't hit it exactly - snapping to a multiple always costs a few pixels. If you're feeding a video model with a hard requirement, set multiple to match its docs rather than trusting the default. And remember this returns plain integers, so if a workflow node won't accept an INT wiring, convert to string or float at the boundary. Otherwise it's about as trouble-free as a ComfyUI node gets.

    Categoryutilities

    Inputs (3)

    NameTypeDefaultDescription
    aspect_ratioCOMBO16:9 (Widescreen)The preferred output aspect ratio.
    megapixelsFLOAT1.00.1–16Nominal target total megapixels used to choose the nearest viable resolution.
    multipleINT328–128Required pixel multiple for both output dimensions.

    Outputs (2)

    NameTypeDescription
    widthINTSelected video width in pixels.
    heightINTSelected video height in pixels.