---
name: video-fx
description: "Add code-built video effects to a talking-head clip with Remotion: background cut-out, new backdrop, icon orbit, break out, punch zoom, phone mock-up, checklist, headline wall, chart, pull-back reveal, background swap, doodles, magazine cover, glass type. Use when the user says \"add effects to this clip\", \"video effects\", \"edit this video with code\", \"remove the background and add…\", names any of the effects below, or asks for an effects showcase reel."
---

# video-fx

Turn one short clip of a person into an effects reel. Nothing is edited by hand: a Python script cuts the person out, and every effect is a React component rendered by Remotion.

The user describes what they want in plain words ("clean cut, new backdrop, then break out and cover star"). You map those words to the step names below, write them into `plan.json`, and render.

## Requirements

- Node.js 18 or newer
- Python 3.10 or newer
- ffmpeg on PATH
- Python packages: `mediapipe`, `opencv-python`, `numpy`

Check them first (`node -v`, `python3 --version`, `ffmpeg -version`). If one is missing, tell the user which one and how to install it, then stop.

## Files in this skill

- `tools/prep.py`: tracks the person, crops tight on the upper body, removes the background.
- `template/`: a small Remotion project.
  - `src/Effects.tsx`: all effects and the editor "canvas" they play in.
  - `src/Reel.tsx`: the 1080×1920 layout (title, progress bar, canvas window, effect name).
  - `src/plan.json`: the list of steps to play. This is the file you edit.

## Workflow

1. **Copy the template** into the user's working folder (for example `./video-fx-project`). Never render inside the skill folder.
2. **Install once:** `npm install` in the project. Set up Python: `python3 -m venv .venv && .venv/bin/pip install mediapipe opencv-python numpy`.
3. **Prepare the clip:** `.venv/bin/python <skill>/tools/prep.py <clip.mp4> <project>`
   It writes `public/clip/o_###.jpg` (cropped original), `c_###.png` (person only) and `meta.json`. The first run downloads a small segmentation model next to `prep.py`.
4. **Look at the result** before going on: open `public/clip/c_000.png` and one frame from the middle. If the cut-out is bad, see "When the cut-out looks wrong".
5. **Write `src/plan.json`** from what the user asked for (see "plan.json").
6. **Check stills:** `npx remotion still src/index.ts FxReel out/check.png --frame=<n>` for a frame inside each step. Look at them. Fix anything that covers the face or runs off the canvas.
7. **Render:** `npm run render` → `out/fx-reel.mp4`. Tell the user the path and the length.

## plan.json

```json
{
  "title": ["12 Video Effects", "Claude code se"],
  "handle": "@yourhandle",
  "intro": 2.0,
  "steps": [
    { "fx": "Clean Cut", "seconds": 1.6 },
    { "fx": "New Backdrop", "seconds": 1.6 },
    { "fx": "Break Out", "seconds": 1.4 }
  ]
}
```

- `intro`: seconds the untouched clip plays before the first step.
- `steps`: played in order. `fx` must be one of the names below (case does not matter). Keep each step between 1.2 and 2.5 seconds.
- Start with `Clean Cut` and then `New Backdrop` unless the user says otherwise: later effects are drawn on the cut-out person and expect a backdrop.
- The reel has no sound. If the user has a voiceover, set each step's `seconds` so the effect lands when its name is spoken, then add the audio with ffmpeg after rendering.

## Steps

Prep (run these first):

| Name | What it does |
|---|---|
| Clean Cut | A scan line sweeps down and the background disappears, leaving the person on a transparency checkerboard. |
| New Backdrop | A swatch tray opens, a cursor picks a colour, and the new background spreads out from it. |

Effects:

| Name | What it does |
|---|---|
| Icon Orbit | App-style icons circle the person on a dashed ring, passing behind and in front. |
| Break Out | A framed copy of the clip appears and the person pops out over its top edge. |
| Punch Zoom | A hard zoom on the face with a camera overlay: face box, REC light, zoom readout. |
| Pocket Screen | The clip plays inside a tilted phone with social buttons. |
| Tick List | A to-do card slides in over the chest and ticks three lines. |
| News Wall | Newspaper clippings get pinned to a wall behind the person. |
| Rocket Chart | A views chart grows in front, with a counter and a rocket on the line. |
| Big Reveal | The view pulls back to show the clip sitting in a video editor with a timeline. |
| Swap World | The backdrop wipes to a sunset city skyline with a sea bridge. |
| Doodle Dance | A wobbly white outline around the person plus hand-drawn crown, heart, star and arrow. |
| Cover Star | A magazine cover with the person as the cover star. |
| Glass Type | Big frosted-glass letters and panels behind the person. |

## Changing text and colours

- Palette: the constants at the top of `Effects.tsx` (`ACCENT`, `HOT`, `POP`, `OK`, `INK`) and `GRAD` (the backdrop).
- On-screen words live inside each effect component: the Tick List rows, the News Wall headlines (`CLIPS`), the Cover Star masthead, the Swap World place label, the Glass Type letters. Change them to fit the user's topic and language.
- The effects assume the head sits near the top centre of the 960×840 frame, which is where `prep.py` puts it. If a face-based overlay is off (Punch Zoom box, Doodle Dance crown), move that overlay's `left`/`top` in its component rather than re-cropping.

## Adding a new effect

1. Write a component in `Effects.tsx` with the signature `React.FC<{ f: number; lf: number }>`. `f` is the reel frame (pass it to `<Subj f={f} />`), `lf` is frames since this effect started (use it for the entrance animation).
2. Draw in the 960×840 frame: background first, then things behind the person, then `<Subj f={f} />`, then things in front.
3. Add its name to `FX_NAMES` and the component to `INSIDE`, at the same position in both lists.
4. Use it in `plan.json` and check a still.

Keep everything inside the canvas. Do not draw outside the 960×840 frame.

## When the cut-out looks wrong

- **Person is tiny or half out of frame:** the clip is too wide or the person moves a lot. Ask for a clip where they stay roughly in place, upper body visible.
- **Edges flicker around fast hands:** expected with this model. Pick effects that keep the hands low in frame, or trim the clip to a calmer section.
- **Background bleeds through:** the person and background are similar in colour or very dark. Ask for a clip with more contrast.
- A clip of 5 to 8 seconds is enough. The effects loop it forward then backward.

## Rules

- Use only clips the user has the right to use: their own footage or properly licensed stock.
- Never add a voice or captions that make a real person appear to say something they did not say. If the clip shows someone other than the user, keep it muted, label it as demo footage on screen, and do not imply they endorse anything.
- Do not use real brand logos in the effects. The icons and mastheads in this skill are generic on purpose.
- Never write absolute paths, API keys or account details into the project files.
- Say plainly what you checked (stills, render length) and what you did not (you cannot watch motion or hear audio).
