Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG H3 Load Whole Latent
ComfyUI Node

VRGDG H3 Load Whole Latent

Your H3 Scene Latent Is Still on Disk — Decode It Again, No Sampling

By vrgamegirl19·Created about a year ago·Updated 6 days ago· 962
VRGDG H3 Load Whole Latent
    • latent
    • frame_count
    ◄project_folder►
    ◄scene_number1►

    The free lunch hiding in the latents folder

    Every MiniMax H3 scene this pack renders dumps the sampler's raw output - picture and sound - to disk right before the VAE decode, as latents/scene_NNN.latent. That file isn't a preview cache. It's the scene, at the exact latent the sampler produced.

    This node loads it back whole. Wire the output to a VAE Decode and you get the same frames the render encoded, with zero sampling. Which means you can re-encode the clip at a finer CRF than the render wrote it at - the pack's own renders land at CRF 19, and its re-decode path defaults to 12 - for a visibly cleaner file, in decode time instead of render time. That's the pitch.

    What it does, mechanically

    Two inputs: project_folder and scene_number. It reads <project_folder>/latents/scene_NNN.latent - a safetensors file with video and audio tensors plus a JSON sidecar of metadata (there's a torch.save fallback if safetensors isn't available), and rebuilds it into a nested video+audio latent so H3's joint AV decode gets both streams. The frame_count output comes from that sidecar metadata, or is recomputed from the token count on H3's 1,4,4,4,4 cycle if the metadata is missing.

    It's also smart about re-running: IS_CHANGED hashes the file, so re-rendering the scene invalidates the cached node and you get the new latent without clearing anything by hand.

    When you'd reach for it

    Three honest cases. One, you want a better file out of a render you already paid for. Two, you're debugging - decode the saved latent and you can see exactly what pass two left on disk versus what the encoder did to it. Three, you're pulling a scene's audio back out without re-sampling anything.

    The one thing it is not for: chaining scenes. That's its sibling, VRGDG H3 Load Latent, which slices a continuation window off the predecessor and returns a token count. This node deliberately doesn't slice - it hands you the whole clip, which is what a decode wants and what a continuation absolutely does not.

    Inputs and outputs

    project_folder is the absolute (or ComfyUI-relative) project folder - something like ComfyUI/output/MyProject. Quotes get stripped, so pasting "…" from Explorer is fine. scene_number is 1-based, matching the project's numbering.

    Outputs: latent → VAE Decode → your save/preview of choice, and frame_count as a plain INT for anything downstream that needs the scene's length up front.

    Install

    Same pack as the rest of the MiniMax H3 tooling - Manager → Install Custom Nodes → search vrgamedev, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl.git
    

    Then install its requirements.txt with ComfyUI's Python, restart, and hard refresh the browser page. Yes, it's a big install for a latent loader (demucs, llama-cpp-python, stable-ts and friends all come along) - that's the cost of the pack, not of this node.

    One sourcing gotcha worth knowing: the standalone VRGDG utility nodes moved to a separate repo, VRGDG_CustomNodePack. The MiniMax H3 and Builder nodes stayed in this one. If you go hunting for this node in the other pack you'll come up empty.

    Things that go wrong

    • "No latent found for scene 003 in …/latents/. Render the scene first." The usual cause is a scene that predates the latent-saving behaviour, or the wrong project folder. Note the zero-padded scene_NNN naming - it's not scene_3.
    • The Builder won't offer its re-decode for scenes rendered with built-in audio. That path re-muxes the song file instead of re-decoding H3's audio, so it refuses those scenes outright. The node itself still loads the latent with its audio intact.
    • It'll happily load a stale latent. The Builder's re-decode checks the saved frame count against the scene's current timing and settings and refuses on a mismatch; the bare node does no such check. Change a scene's duration after rendering and this node gives you the old clip, cheerfully.
    • Re-decode isn't an upscale. The latent is whatever resolution pass two produced. It won't rescue a bad render - it only re-encodes a good one more kindly.

    If you're already happy encoding at CRF 19, ignore this node. If you've ever looked at a final stitch and thought the compression was doing the talking, it's the cheapest quality bump in the pack: no sampling, no seeds, no re-render.

    CategoryVRGDG/MiniMax H3 Latent Continuation

    Inputs (2)

    NameTypeDefaultDescription
    project_folderSTRINGProject folder path
    scene_numberINT11–999999Scene number to load

    Outputs (2)

    NameTypeDescription
    latentLATENT—
    frame_countINT—