Light_A_Video_Sampler
The sampler that keeps the light still while the world moves
- model
- images
- mask_img
- image
If Light_A_Video_Loader is the kitchen, this is the chef. Light_A_Video_Sampler takes the pipeline the Loader assembled, your video frames, and a prompt, and returns a relit video where the lighting doesn't flicker as the subject moves. That last bit is the whole reason this pack exists: applying IC-Light frame by frame was always the 2024 failure mode, because every frame re-picked its own lighting and the result strobed. Light-A-Video's "progressive light fusion" is what fixes it, and it fixes it without training anything.
How the "training-free" trick works
The relight pass is classic IC-Light: an img2img run against your relight_prompt (default "a car driving on the street, neon light"), with the light direction baked into the initial latent as a gradient. That's what bg_target does - LEFT, RIGHT, TOP, BOTTOM each build a literal bright-to-dark ramp as the "light source," the IC-Light Lighting Preference moved into video. NONE skips the ramp and just uses noise.
Then the video backbone (AnimateDiff, Wan 2.1, or CogVideoX, whichever the Loader built) runs with a patched self-attention: in the up blocks, each frame's attention gets blended with attention against a mean key/value computed across the batch of frames, mixed by a gamma weight. That shared "global light" token is the fusion - every frame is nudged toward the same lighting answer, which is why the light holds steady while the content changes. Nothing is fine-tuned; it's an inference-time attention edit. Worth knowing: num_inference_steps is really num_step / strength, so if you raise strength you're burning more steps per frame.
The inputs that matter
The model port takes the Loader's MODEL_Light_A_Video output - that's the only thing that plugs into it. images is your source video's frames (the output of a video-decode node, as an IMAGE batch). Then the short list:
- relight_prompt / n_prompt - what lighting you want (neon, sunset, soft window light) and what to avoid.
n_promptdefaults to "bad quality, worse quality". - bg_target - the light direction. This is the one setting beginners under-use; it's how you aim the light instead of hoping the prompt does it.
- strength (default 0.5), num_step (25), text_guide_scale (2) - how aggressively frames get re-drawn, sampler steps, and CFG. Lower strength = closer to your original footage.
- mask_repo - for
inpaintmode, which foreground masker to use. DefaultZhengPeng7/BiRefNetdownloads on first run; leave it blank and it uses SAM2 (sam2_b.ptauto-downloads); or skip the auto-maskers entirely and feedmask_imgyourself. - Optional fps (default 8) and width/height for the output frame size.
The output is image (an IMAGE batch of the relit frames) - the node saves nothing, so wire it into a video encoder like VHS or Save Video to get a file.
Install and gotchas
Same pack as the Loader: Manager search "ComfyUI_Light_A_Video", or clone into custom_nodes and pip install -r requirements.txt. Two gotchas stand out. First, resolution is backend-bound: the README prescribes 832x480 for Wan and 720x480 for CogVideoX, and the AnimateDiff path is stuck around 512x512 (real users have hit this wall and complained). Second, Wan needs diffusers from the main branch and a 4090 or better; the T5 encoder alone is enormous.
The README's best tip, for the Wan/Cog backends: keep the prompt that drives the video pass to just the subject - "a bear", not "a bear lit by neon" - because the lighting is controlled by bg_target, and a light-writing prompt fights the latent you just set. And if you're on SAM2 for masks, remember its focus point is dead center, so keep the subject middle-frame. Start at the defaults, then raise num_step if the relight looks washed - higher resolutions and longer clips are a straight VRAM trade on all three backends.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL_Light_A_Video | — | |
| images | IMAGE | — | |
| relight_prompt | STRING | a car driving on the street, neon light | — |
| inpaint_prompt | STRING | a car driving on the beach, sunset over sea | — |
| n_prompt | STRING | bad quality, worse quality | — |
| seed | INT | 00–2147483647 | — |
| num_step | INT | 251–1024 | — |
| strength | FLOAT | 0.500–1 | — |
| text_guide_scale | INT | 21–20 | — |
| width | INT | 51264–2048 | — |
| height | INT | 51264–2048 | — |
| bg_target | COMBO | 5 options: LEFT, NONE, RIGHT, TOP, BOTTOM | |
| mask_repo | STRING | ZhengPeng7/BiRefNet | — |
| mask_imgopt | IMAGE | — | |
| fpsopt | FLOAT | 8.08–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |