Nodes/ComfyUI_agilly1989_motorway/CosmosImageToVideoLatent_motorway_edition
ComfyUI Node

CosmosImageToVideoLatent_motorway_edition

The Cosmos image-to-video latent step, now a Motorway node

By agilly1989·Created 2 years ago·Updated about a year ago· 7
CosmosImageToVideoLatent_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_vae_keyvae
INPUT_start_image_keystart_image
INPUT_end_image_keyend_image
width1280
height704
length121
batch_size1
OUTPUT_LATENT_keyLATENT

Image-to-video with NVIDIA's Cosmos models starts with a latent-prep step: take your start frame (and optionally an end frame), encode them with the Cosmos video VAE, and build the empty latent tensor that frames the whole clip. That's what CosmosImageToVideoLatent does in core ComfyUI, and the _motorway_edition is the same node reading and writing through the Motorway bus. If you're assembling a Cosmos Predict2 i2v pipeline inside the Motorway, this is the gate the images pass through before the sampler ever sees them.

How it works

The core node (from nodes_cosmos.py) allocates a zero latent shaped for the clip - 16 channels, (length-1)/8 + 1 frames, height/8 by width/8 - then VAE-encodes the start and end images into it so the sampler starts from a latent that already "contains" your keyframes. It's a real encoding step, not a passthrough, which is why the vae is a required input and why the dimensions matter: width, height, and length all need to be multiples the Cosmos VAE can actually encode. The Motorway wrapper turns the vae, start_image and end_image into key lookups and writes the resulting LATENT back under your output key.

Inputs and outputs

  • MOTORWAY 🚌💨 - the bus, required.
  • INPUT_vae_key - the Cosmos video VAE, default vae.
  • INPUT_start_image_key / INPUT_end_image_key - your frames, defaults start_image / end_image. End image is optional in the core node; if you only feed start, you get a start-to-motion clip.
  • width / height - resolution in multiples of 16, defaults 1280×704.
  • length - number of frames, default 121, step 8 (the VAE downsamples temporally, so frame counts follow that stride).
  • batch_size - default 1.
  • OUTPUT_LATENT_key - where the encoded latent goes, default LATENT.

Only output: the Motorway. The LATENT rides in the bus to wherever your Cosmos sampler lives.

Installing

The pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart, or ComfyUI Manager → "ComfyUI_agilly1989_motorway". No pip deps in the pack - but this node is useless without a Cosmos video VAE and model in your models folders, so budget for those downloads separately.

Caveats

Pack-wide reality: active beta, "BIG BROKEN WITH ASYNC" README banner, _motorway_edition clones commented out of __init__.py in the checked version (re-enable ClonedNodeMapping if missing), keys exact and case-sensitive. Two node-specific traps: use the Cosmos VAE, not an SD VAE - this node won't error nicely, it'll just produce garbage; and keep length/resolution on the VAE's native strides or the latent comes out the wrong shape. If you're not on a Motorway, the plain core CosmosImageToVideoLatent is the same step.

Categoryagilly1989 Nodes/Motorway-ed/conditioning/inpaint

Inputs (9)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_vae_keySTRINGvae
INPUT_start_image_keySTRINGstart_image
INPUT_end_image_keySTRINGend_image
widthINT128016–16384
heightINT70416–16384
lengthINT1211–16384
batch_sizeINT11–4096
OUTPUT_LATENT_keySTRINGLATENT

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨