Exact Video Frames/FPS (WepeNerd)
Videos that are exactly N frames at exactly M fps
- video
- video
- output_path
- info
Exact Video Frames/FPS (WepeNerd) is the node for a specific, maddening problem: ComfyUI video models often want an exact frame count and frame rate, and almost nothing in your video folder actually has them. A model wants 81 frames at 24 fps and your source is 137 frames at 29.97. This node fixes that - it writes a new video with precisely the frame count and FPS you ask for, then verifies it before handing it back.
Inputs, the three that matter:
target_frame_count(default 81) andtarget_fps(default 24) - your destination. 81 frames at 24 fps is the classic latent-matching default because that's what a lot of video pipelines generate internally.quality_mode- this is the interesting one, three quality paths:lossless exact (FFV1/MKV)- the default. Decodes and rewrites losslessly to MKV, giving exact frame count and exact FPS metadata without adding generational loss. This is the "I need it right, and container format doesn't matter" choice.lossless exact (H.264 RGB/MP4)- same exactness, but as a lossless H.264 MP4, for workflows that need MP4. Slower to encode (CRF 0, veryslow) but the file is MP4.stream copy best effort (no re-encode)- copies compressed packets without re-encoding, so it's fast and lossless in the packet sense, but the README is upfront: FPS metadata is best-effort because many containers preserve the source packet timing. Frame count is still verified; exact FPS is not guaranteed.
When your target is longer than the source at the requested FPS, extension_mode decides: hold_last_frame pads with a clone of the final frame (the default - good for still-endings), or loop_source repeats the source. audio_mode defaults to drop_audio, or copy_trim_audio copies the source audio packets and trims them to the new duration without re-encoding, when the container allows.
Outputs: a video socket (a real ComfyUI VIDEO, so you can wire it straight into downstream video nodes), output_path (the absolute file path, saved under your ComfyUI output folder with a wepenerd/exact_video prefix you can change), and info - a STRING with source and output probe details plus a mode note. That info string is worth a look: it's your confirmation the output actually verified.
Mechanically it's FFmpeg under the hood, and it's honest about it: it requires ffmpeg and ffprobe on PATH, and errors at runtime if they're missing. The pipeline probes the source with ffprobe, builds an fps filter plus a tpad clone for extension and a trim to the exact frame count, then re-probes the output and raises an error if the frame count doesn't match - no silent wrong-video handoffs. One catch: the video input socket only accepts file-backed VIDEO sources (e.g. from ComfyUI's Load Video node), because exact FFmpeg processing needs a real file; an in-memory video stream will error with a clear message.
Where it fits: before a video model that demands exact lengths, after generation when you need to normalize your own outputs to a strict spec, or in dataset prep where every clip must be N frames. It's a utility node with a narrow job, and it does that job with verification built in.
Install: ComfyUI Manager (search WepeNerd) or git clone https://github.com/WepeNerd/ComfyUI-WepeNerd.git into custom_nodes, pip install -r requirements.txt, restart.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| video_file | COMBO | 1 options: | |
| target_frame_count | INT | 811–1000000 | — |
| target_fps | FLOAT | 24.0000.001–1000 | — |
| quality_mode | COMBO | lossless exact (FFV1/MKV) | 3 options: lossless exact (FFV1/MKV), lossless exact (H.264 RGB/MP4), stream copy best effort (no re-encode) |
| extension_mode | COMBO | hold_last_frame | 2 options: hold_last_frame, loop_source |
| audio_mode | COMBO | drop_audio | 2 options: drop_audio, copy_trim_audio |
| filename_prefix | STRING | wepenerd/exact_video | — |
| videoopt | VIDEO | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |
| output_path | STRING | — |
| info | STRING | — |