Nodes/ComfyUI-CustomNodeKit/视频帧数统计
ComfyUI Node

视频帧数统计

How many frames is that clip? Ask ffmpeg instead of counting

By user2318·Created 4 months ago·Updated about a month ago· 56
视频帧数统计
    • frames
    • fps
    video_path
    fps0.00

    VideoFrameCounter answers one question - "how many frames is this file, and at what frame rate?" - and hands you the answer as an INT and a FLOAT you can actually wire into graph logic. It reads the video via ffmpeg (through the imageio-ffmpeg bundled binary, so you don't need a system ffmpeg install), multiplies duration by frame rate, and that's the whole job.

    Which sounds trivial until you're building the loop-based long-video workflows this pack is built around. When you split a source video into segments and feed each to pose detection and then to WanAnimate, you need the total frame count to compute segment boundaries, overlap, and how many iterations the loop runs. That number is exactly what this node produces, no guesswork, no "let me open it in a player and count."

    Inputs and outputs

    • video_path - path to the video file (required).
    • fps (default 0) - the interesting one. Set to 0 and the node uses the video's own frame rate. Set it to anything else and it treats that as the target rate, computing frames = duration × your_fps. This is how you ask "how many frames would this be at 16fps" without re-encoding.

    Outputs are frames (INT) and fps (FLOAT) - the effective frame rate actually used, which is your value when you overrode it, or the file's native rate otherwise. Wire frames into loop counters or slice math and fps into whatever node needs the timing.

    What it won't do

    It's not a loader - it never pulls frames into the graph, so you'll still use VideoHelperSuite's loader for actual video. It's also only as accurate as the container's reported duration; for variable-frame-rate files the count can be a frame or two off, which nobody building chunks cares about but a frame-accurate VFX pipeline might.

    Install

    Part of ComfyUI-CustomNodeKit. ComfyUI Manager → search "ComfyUI-CustomNodeKit", or:

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

    Restart ComfyUI. The pack's imageio-ffmpeg dependency brings its own ffmpeg binary, so there's nothing else to install.

    Categoryvideo

    Inputs (2)

    NameTypeDefaultDescription
    video_pathSTRING视频文件的路径。Path to the video file.
    fpsFLOAT0.000–120目标帧率,设为0则自动使用视频自身的帧率。Target frame rate, set to 0 to use the video's original frame rate.

    Outputs (2)

    NameTypeDescription
    framesINT
    fpsFLOAT