# Relight & Switch

> Relight a subject, swap or restyle a background, or composite new elements into a video, driven by the clip's own pixels, a mask and a reference image.

Source: https://nodaro.ai/docs/nodes/video/relight-and-switch

The **Relight & Switch** node relights a video and replaces or restyles parts of it, driven by the source video's own pixels. You give it the video, a mask of what to keep, and a reference image or a prompt for the new look. The model generates the new elements and relights the kept subject to match, so one node can relight a subject, swap or restyle a background, or composite new elements into a scene.

- Found in: Video › Continue & Restyle
- Output: video
- API type: `switchx`

The node is powered by Beeble SwitchX. A **Powered by SwitchX · Beeble** note appears next to the result.

## When to use it
- A subject should look lit for a new environment or a different time of day.
- The background should change, while the subject's motion and identity stay the same.
- New elements from a reference image should become part of the scene.
- One element should be replaced precisely, following a painted or generated mask.

## Quick start
### Add the node

Press Tab on the canvas and choose **Video › Continue & Restyle › Relight & Switch**.

### Connect the video

Wire the clip into the **Source video** input. Keep it at 240 frames or less, which is about 8 seconds at 30 fps.

### Connect a reference image

Wire the new look into the **Reference** input, for example a photo of a sunset beach. A reference image is optional, but it is the single biggest lever on quality.

### Choose the mode

Open the settings panel. Start with **Auto — mask the subject**, which needs no mask. You can also choose a preset from the **Relight & Composite** folder.

### Run it

Click **Run** on the node. The relit video appears on the node.

Workflow: Relight & Switch keeps the presenter, replaces the office with the beach from the reference image, and relights the presenter to match.

- Upload Video → Relight & Switch (source video)
- Upload Image → Relight & Switch (reference)
- Text → Relight & Switch (prompt)

## Inputs
| Input | Accepts | What it does |
| --- | --- | --- |
| **Source video** | Video nodes, such as Upload Video and Generate Video | The video to transform. Required. |
| **Reference** | Image nodes, such as Upload Image and Generate Image | The visual target, the new look. Optional, but strongly recommended. |
| **Prompt** | Text nodes | A description of the result. A wired prompt replaces the prompt typed in the settings panel. |
| **Mask** | Image and mask nodes, such as Generate Mask and Paint Mask | Appears in **Select** mode. A grayscale mask of one keyframe. |
| **Mask video** | Video nodes | Appears in **Custom** mode. A per-frame alpha matte video. |

The output, **Video**, is the relit or recomposited clip. The node outputs no matte.

## Settings
| Setting | What it does |
| --- | --- |
| **Mode** | How the mask is made. **Auto — mask the subject** is the default. See [The four modes](#the-four-modes). |
| **Prompt** | A description of the desired look, up to 2,000 characters. A connected reference image is strongly recommended as well. |
| **Keyframe index** | **Select** mode only. The frame that your mask describes, counted from 0. The model spreads the mask from this frame across the clip. The default is 0. |
| **Resolution** | `720p` or `1080p` (the default). |
| **Seed (optional)** | A number from 0 to 4,294,967,295 that makes a result repeatable. Leave it empty for a random seed. |
| **Pre & post text** | Text that is always added before and after the prompt. It is hidden from people who use your workflow as an app. The presets store their instructions here. See [Prompt pre and post text](https://nodaro.ai/docs/concepts/prompt-pre-post-text). |

## The four modes

| Mode | Mask input | What it does |
| --- | --- | --- |
| **Auto — mask the subject** | None | The model finds and masks the foreground subject. It relights the subject and restyles or replaces the background. |
| **Fill — restyle whole frame** | None | The model keeps the whole scene and restyles the entire frame from the reference or the prompt. |
| **Select — keyframe mask** | One mask image | You provide a grayscale mask of one frame, and the model spreads it across the video. |
| **Custom — matte video** | A matte video | You provide a per-frame alpha matte video for frame-accurate control. |

Start with **Auto** for relighting and background swaps. Use **Select** or **Custom** only when you need precise control over what is kept. For **Select**, the easiest mask comes from a [Generate Mask](https://nodaro.ai/docs/nodes/image/generate-mask) node, for example with the description `the person`. You can also paint the mask by hand with [Paint Mask](https://nodaro.ai/docs/nodes/image/paint-mask).

## Presets

The **Relight & Composite** folder in the node's preset menu has one preset for each common job:

| Preset | Mode | What it does |
| --- | --- | --- |
| **Relight Subject** | Auto | Masks the subject and relights it to match the reference. |
| **Swap Background** | Auto | Keeps the subject, replaces the background and relights the subject to fit. |
| **Restyle Whole Scene** | Fill | Restyles the entire frame from the reference or the prompt, with no mask. |
| **Masked Composite** | Select | Gives precise control through a one-frame mask. Wire a Generate Mask node. |
| **Frame-Accurate Matte** | Custom | Gives exact per-frame control through an alpha matte video. |

Each preset stores its instruction in the node's pre and post text, so the prompt stays free for your own additions. Adjust the instruction and the reference to taste. See [Presets](https://nodaro.ai/docs/concepts/presets).

## Limits
- **Length:** up to 240 frames, which is about 8 seconds at 30 fps.
- **Size:** up to 2,770,000 pixels per frame, which is about 1080p.
- **Formats:** MP4 or MOV, encoded as H.264 or HEVC.

A clip slightly over the frame limit, up to about 270 frames, is trimmed to 240 frames automatically and billed at the 240-frame price. A clip well over the limit, or larger than about 2.77 megapixels, shows an orange warning on the node. Trim the clip with [Trim Video](https://nodaro.ai/docs/nodes/video/trim-video) or lower its resolution before you run.

## Credits
The price follows the length of the clip in blocks of 30 frames, about 1 second each, and the output resolution. One block costs 50 credits at `720p` and 150 credits at `1080p`.

| Length | `720p` | `1080p` |
| --- | --- | --- |
| Up to 30 frames (about 1 s) | 50 | 150 |
| Up to 60 frames (about 2 s) | 100 | 300 |
| Up to 90 frames (about 3 s) | 150 | 450 |
| Up to 120 frames (about 4 s) | 200 | 600 |
| Up to 150 frames (about 5 s) | 250 | 750 |
| Up to 180 frames (about 6 s) | 300 | 900 |
| Up to 210 frames (about 7 s) | 350 | 1,050 |
| Up to 240 frames (about 8 s) | 400 | 1,200 |

A clip is billed by the number of blocks it spans. For example, a 144-frame clip spans 5 blocks, so it costs 750 credits at `1080p`. The editor shows an estimate for a typical length, and the exact charge is computed from the clip's real frame count when the run starts.

## Tips
- **Always connect a reference image when you can.** It is the single biggest lever on quality.
- **Keep the source short.** Trim the clip to the moment you need before you relight it.
- **Start from a preset.** The presets give a tuned starting point for each job.
- **Fix the seed to compare.** With a **Seed** set, you can change only the reference or the prompt and compare the results fairly.
- **Your results do not expire.** Results are saved to your library like every other result.

## Frequently asked questions

### Do I need a mask for Relight & Switch?

Not in Auto or Fill mode. Auto masks the foreground subject for you, and Fill keeps the whole scene. Select mode needs one keyframe mask image, and Custom mode needs a full matte video.

### How long can the video be?

Up to 240 frames, which is about 8 seconds at 30 fps, at up to about 1080p. A clip slightly longer, up to about 270 frames, is trimmed automatically and billed as 240 frames.

### How much does Relight & Switch cost?

The price is counted in blocks of 30 frames, about 1 second each. One block costs 50 credits at 720p and 150 credits at 1080p, so a full 240-frame clip at 1080p costs 1,200 credits.

### How do I make the mask for Select mode?

Wire a Generate Mask node with a description such as "the person" into the Mask input. The model spreads that one-frame mask across the whole clip.

### Can I get the same result twice?

Yes. Set a Seed and keep the same inputs. Leave the Seed empty to get a fresh variation on every run.
