Nodes/ComfyUI-Transformers/Video Classification
ComfyUI Node

Video Classification

What's happening in that clip? The node that labels video content

By kadirnar·Created 3 years ago·Updated 7 months ago· 25
Video Classification
    • results_json
    video_path
    model_nameMCG-NJU/videomae-base-finetuned-kinetics
    top_k5

    Video generation is everywhere in ComfyUI now, which means a lot of people are generating clips they have no good way to check. VideoClassificationPipeline is the pack's answer: feed it a path to a video file and it runs a model over the frames and tells you what's happening, returning the top-K labels with scores as JSON. Want to know whether your generated clip reads as "someone skateboarding" or "someone falling off a skateboard"? This is the node for that - a content check that doesn't need you to eyeball every frame.

    It's from kadirnar/ComfyUI-Transformers, the HF-pipeline wrapper pack. Default model is VideoMAE (MCG-NJU/videomae-base-finetuned-kinetics), a masked-autoencoder video transformer fine-tuned on Kinetics-400 - that's the benchmark dataset of 400 human-action classes, which means its vocabulary is "archery," "yoga," "shaking hands," that kind of thing.

    How it works

    The mechanism is a single call: pipeline("video-classification", model=model_name) with your video_path and a top_k count, returning a JSON list of {label, score} pairs. Transformers' video pipeline decodes frames from the file, samples them (VideoMAE wants 16 frames), and runs the model. Nothing fancy on this node's side - it's about as thin as a wrapper gets.

    The catch that catches everyone: it takes a filesystem path, not a ComfyUI VIDEO type. There's no video socket here. You have to get your clip onto disk first - either via a Save Video node that writes to a known location, or by pointing at an existing file. If you feed it an empty string (the default), it will just error out. This is the node where the pack's "thin wrapper" philosophy most visibly bites.

    Inputs and outputs

    • video_path - STRING, an absolute path to the video file. This is the input you will get wrong on the first try.
    • model_name - default MCG-NJU/videomae-base-finetuned-kinetics; free text, any HF video-classification model.
    • top_k - INT, default 5, range 1–20. How many ranked labels you want back.
    • Output: results_json - STRING, a JSON array of label/score pairs.

    To read it you'll want a Show Text node; to use the top label programmatically, parse the JSON. There's no pre-built "take the winner" output, which is a small miss - you'd think a classification node would hand you the label directly.

    Installing it

    Pack-standard:

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

    or search "ComfyUI-Transformers" in ComfyUI Manager, restart. The README's cd custom/nodes is a typo. Requirements include opencv-python, which the video pipeline leans on for frame decoding, plus transformers>=4.42. First run pulls VideoMAE (~700 MB) from the Hub to ~/.cache/huggingface.

    Where people get burned

    • Empty video_path - the default. Point it at a real file before anything else.
    • Runtime is real. Video classification on CPU can take tens of seconds plus a model-load penalty on every run (the pack's pipeline cache is dead code here, as with the rest of the pack). This is not a real-time node.
    • The label set is Kinetics-400. It's great at "playing guitar," useless at abstract art-video vibes. If your generated clips don't resemble human actions, the top labels will be nonsense - not a bug, just a vocabulary mismatch.

    The honest take: it's the pack's most situational node, and the file-path input makes it awkward in a native ComfyUI video graph. But if you're generating human-action clips and want an automated "does this read as the action I asked for?" check, it's the only node in the pack that answers that specific question.

    CategoryTransformers/VideoClassification

    Inputs (3)

    NameTypeDefaultDescription
    video_pathSTRING
    model_nameSTRINGMCG-NJU/videomae-base-finetuned-kinetics
    top_kINT51–20

    Outputs (1)

    NameTypeDescription
    results_jsonSTRING