Nodes/ComfyUI-PainterNodes/Painter Frame Rate Converter
ComfyUI Node

Painter Frame Rate Converter

Resample frames without the headache

By princepainter·Created 7 months ago·Updated 5 days ago· 194
Painter Frame Rate Converter
  • image
  • image
  • frame_count
source_fps24.0
force_rate0.0
formatAnimateDiff

Every video model has a preferred frame count, and they're rarely the same number. Wan wants 4n+1, LTX wants 8n+1, Mochi and Hunyuan want their own things - and your source clip is probably in some arbitrary count that matches none of them. PainterFrameRateConverter is the node that rescales a clip's frame count to whatever the target model wants, either by resampling to a specific FPS or by snapping to a format's rules. It's the "make my frames legal" step that keeps you from feeding a model a length its VAE will reject.

What it is

An image/batch-style utility that takes an IMAGE sequence, a source_fps, and a target, and returns a resampled image plus the new frame_count. The target is specified two ways: a force_rate (just resample to this FPS) or a format (pick "AnimateDiff", "Mochi", "LTXV", "Hunyuan", "Cosmos", or "Wan" and let the node enforce that model's frame rule).

How it works

The math is straightforward resampling. If force_rate is 0 (or matches source_fps), the frames pass through untouched. Otherwise it computes the clip duration (frames / source_fps), works out how many frames the target FPS needs, and picks the nearest source frame for each target time slot - a nearest-neighbor reindex, not interpolation. New frames are duplicated/selected rather than synthesized, so motion stays honest but you don't get any in-between frames invented.

Then the format rules kick in. Each selected format has a frames rule (e.g. frames % 8 == 1 for LTXV, 4n+1 for Wan), and the node trims the sequence to the largest valid count below what you have. Set force_rate to 0 and just pick a format, and the whole job becomes "give me a Wan-legal length" - that alone is worth the install.

The inputs that matter

  • source_fps - the FPS your source clip was meant to be (default 24). Get this wrong and the duration math is wrong, and the resample lands at the wrong length.
  • force_rate - 0 means "skip resampling," otherwise the target FPS.
  • format - the model family whose frame-count rule you want enforced. None skips the format check.

Outputs: image (the resampled sequence) and frame_count (what you actually got - wire this into your latent builder so downstream knows the real length).

Install

Part of the PainterNodes pack. ComfyUI Manager → search "PainterNodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/princepainter/ComfyUI-PainterNodes
cd ComfyUI-PainterNodes
pip install -r requirements.txt

Common issues

  • Frame count still wrong for your model - the format rules are the author's mapping, and the trim direction is down, never up. If you're under the target rule (e.g. you have 90 frames and want LTXV's 8n+1), you get whatever valid count is closest below. If you need more frames, resample to a higher FPS first or pad separately.
  • Resampled video looks steppy - expected. This is frame selection, not optical flow interpolation. For buttery interpolation you'd run a dedicated interpolation pass; this node is for making counts legal, not for making motion smooth.
  • Unspecified FPS - the node needs a sensible source_fps or the duration math is meaningless. Don't skip it if you care about the resample landing at the right place.

It's a small, unglamorous node in a pack full of flashy video generators - but half the "why won't this model take my clip" posts end at frame-count rules. This is the fix in one node.

CategoryPainterNodes

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
source_fpsFLOAT24.01–120
force_rateFLOAT0.00–120
formatCOMBOAnimateDiff7 options: None, AnimateDiff, Mochi, LTXV, Hunyuan, Cosmos, +1

Outputs (2)

NameTypeDescription
imageIMAGE
frame_countINT