Nodes/Nodes for use with real-time applications of ComfyUI/Fps Monitor πŸ•’πŸ…‘πŸ…£πŸ…
ComfyUI Node

Fps Monitor πŸ•’πŸ…‘πŸ…£πŸ…

Your Real-Time Workflow Needs an FPS Counter That Exports a Mask

By ryanontheinsideΒ·Created 2 years agoΒ·Updated about a year agoΒ· 82
Fps Monitor πŸ•’πŸ…‘πŸ…£πŸ…
    • IMAGE
    • MASK
    β—„always_executetrueβ–Ί
    β—„width512β–Ί
    β—„height512β–Ί
    β—„text_color255β–Ί
    β—„text_size1.0β–Ί
    β—„window_size60β–Ί

    When you run ComfyUI against a live camera feed - the ComfyStream-style setup this pack is built for - the first question is never "does it look good." It's "how many frames am I actually getting?" The FPS Monitor answers that directly on screen, and it does it in the most ComfyUI way possible: it hands you both an image and a mask you can composite into your output.

    The node measures the time between its own executions using a rolling window of frame times (default 60 frames) and shows both the instantaneous FPS and the windowed average. So you get a text overlay that reads something like FPS: 12.3 (avg: 11.8) - the live number when it jerks, and the honest average when the noise would lie to you.

    Under the hood it's not doing anything clever. It grabs wall-clock time, divides 1 by the delta, keeps a FIFO list of recent deltas, and draws the result with OpenCV's putText into a black canvas and a matching mask. The smart part is the caching: it only redraws when the current FPS moves by more than 1 or the average moves by more than 0.5, so a steady 12 FPS stream doesn't waste cycles re-rendering the same text every frame.

    The inputs that matter

    • width / height - the canvas size of the overlay. Match these to your frame size or you'll be scaling a 512Β² overlay onto a 1080p stream.
    • text_color - 0–255 grayscale for the text. It's drawn in white normally; drop it toward 128 if you're compositing onto bright footage.
    • window_size - frames to average over. The default 60 is a decent second-ish window; smaller reacts faster, larger smooths more.
    • always_execute - leave this on. It's the whole trick: the node only knows the true frame rate if it actually runs every execution, and always_execute forces that.

    Wiring it up

    Outputs are IMAGE (black canvas with the FPS text) and MASK (the same text as white-on-black). Composite the image over your frame with an alpha/over blend, or use the mask to drive a mixer - the mask is a clean text-shaped matte, which makes it easy to put the number wherever you want without a solid black box behind it.

    Install

    Part of the ryanontheinside/ComfyUI_RealtimeNodes pack. Easiest via ComfyUI Manager (search "Control Nodes" - the pack's menu name - or "RealtimeNodes"), or manually:

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

    Then restart ComfyUI. It needs OpenCV, which is in the requirements, so nothing extra to chase down.

    Common issues

    The number is ComfyUI's execution rate, not your monitor's refresh - don't panic when they disagree. If it reads a nonsense value or shows the same number forever, you're probably not executing continuously: in a normal one-shot batch queue there's nothing to average, and the node reports whatever the wall-clock between two clicks was. Also remember that only the frames where this node runs count. And since it's state-based, it survives workflow edits but resets when you clear ComfyUI's state - after a big refactor, expect the window to start fresh. That's it. For a "utility" node, it's about as simple and useful as this pack gets.

    Categoryreal-time/control/utility

    Inputs (6)

    NameTypeDefaultDescription
    always_executeBOOLEANtrueWhen enabled, the node updates every execution
    widthINT51264–4096β€”
    heightINT51264–4096β€”
    text_colorINT2550–255β€”
    text_sizeFLOAT1.00.1–5β€”
    window_sizeINT601–300Number of frames to average over

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGEβ€”
    MASKMASKβ€”