Nodes/ComfyUI_OmniShotCut/OmniShotCut ShortCount
ComfyUI Node

OmniShotCut ShortCount

How many shots did the detector find?

By GG-A9·Created 3 months ago·Updated 3 months ago· 4
OmniShotCut ShortCount
    • count
    shots_json

    OmniShotCutShortCount does exactly one thing: it takes the shots_json output of the OmniShotCut Detector and returns the number of shots in it as an INT. That's it. One input, one number. It's the kind of node that makes you say "sure, that's trivial" - and then you wire it into a workflow and realize it was exactly the missing piece.

    Where it earns its keep: the Detector's JSON is a string, and the interesting number - "how many cuts did it find?" - is buried inside. Counting shots is the first thing you want to do whether you're about to split the video, decide the output is too fragmented to use, or just log what a long render actually contains. Wire count into a text node or a PrimitiveInt-style value and you can even gate a workflow on it: fewer than two shots means the scene was one continuous take, so skip the splitter entirely.

    How it works

    Under the hood it's a three-line parser. It reads the shots_json string (or a dict/list that an upstream node passed through), digs out the pred_ranges array from the Detector's output, and returns len(pred_ranges). If the JSON is malformed or empty, it returns 0 instead of blowing up the graph - which is a small mercy, because a broken JSON parser would otherwise take down your whole run with a red error box.

    Inputs and outputs

    • shots_json (STRING, forced input) - the shots_json output of OmniShotCutDetector. It's marked forceInput, meaning you can't type JSON into the widget; it has to be wired from the Detector. Good - you shouldn't be hand-typing that blob anyway.
    • count (INT) - the number of detected shots, i.e. the length of pred_ranges.

    Install

    Same pack, same steps as the rest of the nodes:

    # in ComfyUI/custom_nodes
    git clone https://github.com/GG-A9/ComfyUI_OmniShotCut
    cd ComfyUI_OmniShotCut
    pip install -r requirements.txt
    

    No model, no checkpoint, no special setup - this node never touches the neural net. If the Loader and Detector work, this works. ComfyUI Manager (search "ComfyUI_OmniShotCut") installs the whole pack including this node.

    Common issues

    Honestly? There's not much to trip on. The one realistic failure is feeding it something that isn't the Detector's JSON - say a path string to a file, or an empty string from a node that never ran. You'll get 0 back, which is a silent "nothing here" rather than an error. If your count always reads zero, check that the Detector actually produced pred_ranges (the Detector's JSON should show a non-empty array) rather than an error string.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    shots_jsonSTRING

    Outputs (1)

    NameTypeDescription
    countINT