---
title: "How to add a confetti with Claude (tested prompt and script)"
description: "Two cannons in the bottom corners shoot tumbling yellow, red, pink, blue and green paper up past the product, which then flutters slowly back down. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/confetti
---

# How to add a confetti with Claude

Two cannons in the bottom corners shoot tumbling yellow, red, pink, blue and green paper up past the product, which then flutters slowly back down.

Made by the script on this page, from our own test clip.

## Get this effect

1. ### Switch to Code in your [Claude Desktop App](https://claude.com/download)

2. ### Install the skill (once)

   ```
   Install the Recharm video effects skill: download https://recharm-growth-staging.s3.us-east-2.amazonaws.com/website/downloads/recharm-video-effects.zip and unzip it into ~/.claude/skills
   ```

3. ### Ask for the effect

   ```
   Add a confetti to input.mp4
   Colors: yellow, red, pink, blue, green
   ```

## Several videos, several effects, one ask

Put your clips in the folder, mention them with @, and ask for everything at once. Claude runs one tested script after another on each clip, then joins them.

Add a confetti to **@clip1.mp4**, put a sale badge on **@clip2.mp4**, give **@clip3.mp4** a VHS look, then join all three with crossfades.

## Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

| Setting  | Default                          | What it does                                                 |
| -------- | -------------------------------- | ------------------------------------------------------------ |
| `START`  | `0.5`                            | Second the cannons fire.                                     |
| `PIECES` | `240`                            | Pieces of confetti, half from each corner.                   |
| `PIECE`  | `(0.028, 0.016)`                 | Piece length and width as a share of the frame width.        |
| `COLORS` | `yellow, red, pink, blue, green` | The confetti colors, picked at random per piece.             |
| `LAUNCH` | `(2.6, 4.0)`                     | Launch speed range, in frame heights per second.             |
| `DRAG`   | `3.5`                            | How fast the air slows the pieces.                           |
| `FALL`   | `(0.07, 0.16)`                   | Speed the pieces drift down at, in frame heights per second. |
| `SWAY`   | `0.03`                           | Side-to-side flutter as a share of the frame width.          |

## Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

```
Add a confetti burst to input.mp4. At 0.5 seconds, fire 240 pieces of confetti from two points just below the bottom corners (4% and 96% across, 102% down), half from each, released over 0.15 seconds. Each piece is a rectangle 2.8% by 1.6% of the frame width, colored at random from yellow (255, 205, 0), red (235, 35, 55), pink (255, 70, 170), blue (30, 130, 255) and green (30, 200, 110). Launch them up and toward the middle at 52 to 88 degrees from horizontal, at 2.6 to 4 frame heights per second, and slow them with air drag (velocity decays at a rate of 3.5 per second) so within about a second they reach the top half and then drift down at 0.07 to 0.16 frame heights per second, swaying side to side by 3% of the frame width. Spin each piece and squash its width with a cosine so it looks like it's tumbling. Nothing shows before 0.5 seconds, and the confetti stays on screen to the end. Use Python with numpy and Pillow to draw it and ffmpeg to put it on the video (don't rely on ffmpeg's drawtext filter), keep the audio, and save it as output.mp4.
```

## Run it without Claude

This is the exact script we tested. Save it as `confetti.py` and run:

```
python3 confetti.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Confetti: two cannons in the bottom corners fire colored paper up the frame, and it flutters back down.

Usage: python3 confetti.py input.mp4 output.mp4
Needs ffmpeg, numpy and Pillow (pip install numpy pillow).
"""
import json
import math
import subprocess
import sys

import numpy as np
from PIL import Image, ImageDraw

START = 0.5                     # second the cannons fire
PIECES = 240                    # pieces of confetti (half from each corner)
PIECE = (0.028, 0.016)          # piece length and width as a share of the frame width
COLORS = [(255, 205, 0), (235, 35, 55), (255, 70, 170), (30, 130, 255), (30, 200, 110)]  # yellow, red, pink, blue, green
LAUNCH = (2.6, 4.0)             # launch speed range, in frame heights per second
DRAG = 3.5                      # how fast the air slows the pieces (per second)
FALL = (0.07, 0.16)             # range of speeds the pieces drift down at, in frame heights per second
SWAY = 0.03                     # side-to-side flutter as a share of the frame width
SEED = 7                        # change for a different scatter

def launch():
    """Start position, velocity, color, spin and flutter phase for every piece."""
    rng = np.random.default_rng(SEED)
    side = np.where(np.arange(PIECES) % 2 == 0, -1.0, 1.0)            # -1 = left cannon, 1 = right cannon
    angle = np.radians(rng.uniform(52, 88, PIECES))                    # up and in from each corner
    speed = rng.uniform(*LAUNCH, PIECES) * h
    return {
        "x0": np.where(side < 0, 0.04 * w, 0.96 * w), "y0": np.full(PIECES, 1.02 * h),
        "vx": -side * np.cos(angle) * speed, "vy": -np.sin(angle) * speed,
        "fall": rng.uniform(*FALL, PIECES) * h,
        "delay": rng.uniform(0, 0.15, PIECES),                         # pieces leave the cannon over 0.15s
        "color": rng.integers(0, len(COLORS), PIECES),
        "spin": rng.uniform(-6, 6, PIECES), "flip": rng.uniform(4, 10, PIECES), "phase": rng.uniform(0, 6.3, PIECES),
    }

def positions(t):
    """Where every piece is t seconds after it left the cannon: air drag slows the launch to a gentle fall."""
    decay = (1 - np.exp(-DRAG * t)) / DRAG
    x = p["x0"] + p["vx"] * decay + SWAY * w * np.sin(2.2 * t + p["phase"]) * (1 - np.exp(-2 * t))
    y = p["y0"] + p["vy"] * decay + p["fall"] * (t - decay)
    return x, y

def overlay(t):
    img = Image.new("RGBA", (w, h))
    age = t - START - p["delay"]
    if (age <= 0).all():
        return img
    draw = ImageDraw.Draw(img)
    x, y = positions(np.maximum(age, 0))
    half_l, half_w = PIECE[0] * w / 2, PIECE[1] * w / 2
    for i in np.nonzero(age > 0)[0]:
        a = p["spin"][i] * age[i] + p["phase"][i]
        width = half_w * max(abs(math.cos(p["flip"][i] * age[i] + p["phase"][i])), 0.15)  # tumbling: edge-on now and then
        ca, sa = math.cos(a), math.sin(a)
        corners = [(x[i] + dx * ca - dy * sa, y[i] + dx * sa + dy * ca)
                   for dx, dy in ((-half_l, -width), (half_l, -width), (half_l, width), (-half_l, width))]
        draw.polygon(corners, fill=COLORS[p["color"][i]])
    return img

def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate:format=duration", "-of", "json", path]))
    s = info["streams"][0]
    num, den = s["r_frame_rate"].split("/")
    return s["width"], s["height"], s["r_frame_rate"], float(num) / float(den), float(info["format"]["duration"])

def render(src, out):
    """Draw overlay(t) on every frame of src and save to out, keeping the audio."""
    ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", src,
                           "-f", "rawvideo", "-pix_fmt", "rgba", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                           "-filter_complex", "[0:v][1:v]overlay=shortest=1,format=yuv420p[v]",
                           "-map", "[v]", "-map", "0:a?", "-c:v", "libx264", "-crf", "18", "-c:a", "copy", out],
                          stdin=subprocess.PIPE)
    for i in range(math.ceil(duration * fps)):
        ff.stdin.write(overlay(i / fps).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")

src, out = sys.argv[1:3]
w, h, rate, fps, duration = probe(src)
p = launch()
render(src, out)
```

## More overlays and light

- [Anamorphic streak **Anamorphic streak**](https://www.recharm.com/effects/anamorphic-streak)
- [Aurora **Aurora**](https://www.recharm.com/effects/aurora)
- [Blood splatter **Blood splatter**](https://www.recharm.com/effects/blood-splatter)
- [Bokeh lights **Bokeh lights**](https://www.recharm.com/effects/bokeh-lights)
- [Camera flash **Camera flash**](https://www.recharm.com/effects/camera-flash)

## Find 3x _winning ads_

Recharm cuts your ad footage into tagged, searchable clips: hooks, testimonials, product shots. Find the shots that win, add the effect with Claude, and ship 3x more ad edits.

[Start 14-day free trial](https://www.recharm.com/get-started)
