ComfyUI Node

WebP Wrangler

Animated WebP as a Video Source, Alpha and All

By Fossiel·Created 10 months ago·Updated 5 months ago· 1
WebP Wrangler
    • images
    • Alpha_as_mask
    • total_batch_count
    • split_batch_count
    • Frame_Rate
    WebP_Path
    Load_ModeAll
    Index_10
    Index_20

    Animated WebP is the format that ComfyUI just refuses to take seriously. It's everywhere on the internet - half the clips you'd want to upscale, loop, or img2vid from are WebPs - but the stock loader will only grab the first frame and call it done. WebP Wrangler is the fix: it loads an animated WebP file into your graph as a proper frame batch, alpha channel included, with frame-range control and an approximate frame rate.

    If you've ever downloaded a cool clip from somewhere and hit a dead end trying to feed it into a video model, this is the node that un-sticks you.

    How it works

    Give it WebP_Path (a full path to the file) and it uses Pillow's animation support to walk the frames and extract each one as RGBA. You get two things out of that: the RGB frames as an IMAGE batch, and the alpha channel as a MASK output - handy for compositing the animation over a background instead of fighting a baked-in checkerboard.

    The clever bit is Frame_Rate. WebP stores per-frame delays as timestamps, so the node cracks open the file's metadata with the webp Python library, works out the average delay across frames, and reports the closest whole FPS - or 10.0 if it can't be determined. That's enough to size your context windows or match frame timing when you feed the batch into a video model that wants to know how long a "clip" is.

    Load Mode mirrors the pack's Sequence Wrangler: All, From first to Index 1, From Index 1 to last, Index 1 to Index 2, or single frames (First frame, Last frame, Index 1 frame), with Index_1/Index_2 as the selectors. And the same inclusiveness rule applies - From first to Index 1 with Index_1 = 3 yields 4 frames.

    Inputs and outputs

    Inputs: WebP_Path, Load_Mode, Index_1, Index_2. Outputs: images, Alpha_as_mask, total_batch_count, split_batch_count, and Frame_Rate. Single-frame WebPs behave correctly (batch of 1), and errors - invalid paths, corrupted files - come back as clear messages rather than silent weirdness.

    Installing it

    Manager search "ComfyUI-Fossiel-QoL-Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Fossiel/ComfyUI-Fossiel-QoL-Nodes
    pip install -r ComfyUI-Fossiel-QoL-Nodes/requirements.txt
    

    Restart, find it under Fossiel/QoL. One dependency worth knowing: it needs the webp PyPI package, which is in the pack's requirements.txt - so actually run the pip install step, don't skip it assuming Manager covered everything.

    Honest caveats

    Two things to set expectations on. First, frame rate is approximate - it's derived from rounded timestamps, so don't build frame-exact audio sync off it; treat it as "good enough for context sizing." Second, WebP is a lossy compression format designed for small web files, so the frames you're loading are typically lower quality than what a direct PNG sequence would give you. For analysis, context, and img2vid starting points it's perfect; for pixel-perfect reference frames you want the original source. But for the specific gap of "I have an animated WebP and ComfyUI won't play ball," this is the whole answer.

    CategoryFossiel/QoL

    Inputs (4)

    NameTypeDefaultDescription
    WebP_PathSTRING
    Load_ModeCOMBOAll7 options: All, From_first_to_Index_1, From_Index_1_to_last, Index_1_to_Index_2, First_frame, Last_frame, +1
    Index_1INT00–10000
    Index_2INT00–10000

    Outputs (5)

    NameTypeDescription
    imagesIMAGE
    Alpha_as_maskMASK
    total_batch_countINT
    split_batch_countINT
    Frame_RateFLOAT