How to add an error dialog pop-up with Claude

Blue-titled "Error" boxes with a red X, a "Dull skin detected." message and an OK button pile up one under another until they bury the top of the shot.

Get this effect

  1. Switch to Code in your Claude Desktop App

  2. Install the skill (once)

    Show the prompt
    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 an error dialog pop-up to input.mp4
    Title: Error
    Message: Dull skin detected.

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 an error dialog pop-up 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.

SettingDefaultWhat it does
TITLEErrorTitle bar text.
MESSAGEDull skin detected.Message next to the red X.
COUNT6How many dialogs stack up.
START0.5Second the first dialog appears.
EVERY0.25Seconds between dialogs.
STEP(0.03, 0.085)How far each next dialog moves right and down, as shares of the frame.

Without the skill

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

Show the prompt
Add stacked error dialogs to input.mp4. Each dialog is 80% of the frame width wide and 0.42 times that tall: a light gray (240, 240, 240) box with a dark gray outline and a soft drop shadow, a blue (0, 84, 227) title bar along the top (20% of the dialog's height) reading "Error" in bold white on the left with a small red close button on the right, a red (220, 30, 30) circle with a white X on the left (diameter 30% of the dialog height), the message "Dull skin detected." in black beside it, and a gray "OK" button with a blue outline centered near the bottom. Six dialogs appear one at a time, the first at 0.5 seconds and then one every 0.25 seconds, each scaling from 85% to full size over 0.08 seconds and staying on to the end. The first dialog's top-left corner is at 5% across and 8% down; each next one sits 3% of the width further right and 8.5% of the height further down, drawn on top of the ones before. Use Python with Pillow to draw the dialogs and their text and ffmpeg to put them 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 error-dialog-popup.py and run:

python3 error-dialog-popup.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Error dialog pop-up: system error boxes with a red X and an OK button stack down the screen one after another.

Usage: python3 error-dialog-popup.py input.mp4 output.mp4
Needs ffmpeg and Pillow (pip install pillow).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

from PIL import Image, ImageDraw, ImageFont

TITLE = "Error"                       # title bar text
MESSAGE = "Dull skin detected."       # message next to the red X
COUNT = 6                             # how many dialogs stack up
START = 0.5                           # second the first dialog appears
EVERY = 0.25                          # seconds between dialogs
WIDTH = 0.80                          # dialog width as a share of the frame width
FIRST = (0.05, 0.08)                  # first dialog's top-left corner (0-1 across and down)
STEP = (0.03, 0.085)                  # how far each next dialog moves right and down
TITLE_BAR = (0, 84, 227)              # title bar blue
X_RED = (220, 30, 30)                 # error icon red
FONTS = ["/System/Library/Fonts/Supplemental/Arial.ttf",          # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",       # Linux
         "C:/Windows/Fonts/arial.ttf"]                            # Windows
BOLD_FONTS = ["/System/Library/Fonts/Supplemental/Arial Bold.ttf",  # macOS
              "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",  # Linux
              "C:/Windows/Fonts/arialbd.ttf"]                          # Windows
FONT_FILE = next((f for f in FONTS if Path(f).exists()), None) or sys.exit("No font found: add one to FONTS")
BOLD_FILE = next((f for f in BOLD_FONTS if Path(f).exists()), None) or sys.exit("No bold font found: add one to BOLD_FONTS")


def dialog():
    """One error box: blue title bar with a close button, red X icon, message and an OK button."""
    dw = round(w * WIDTH)
    dh = round(dw * 0.42)
    bar = round(dh * 0.20)
    img = Image.new("RGBA", (dw + 6, dh + 6))
    draw = ImageDraw.Draw(img)
    draw.rectangle([6, 6, dw + 5, dh + 5], fill=(0, 0, 0, 90))                       # drop shadow
    draw.rectangle([0, 0, dw - 1, dh - 1], fill=(240, 240, 240), outline=(90, 90, 90))
    draw.rectangle([1, 1, dw - 2, bar], fill=TITLE_BAR)
    title_font = ImageFont.truetype(BOLD_FILE, round(bar * 0.55))
    draw.text((bar * 0.4, bar / 2 + 1), TITLE, font=title_font, anchor="lm", fill="white")
    c = round(bar * 0.78)                                                               # close button
    cx0, cy0 = dw - c - round(bar * 0.15), round((bar - c) / 2) + 1
    draw.rectangle([cx0, cy0, cx0 + c, cy0 + c], fill=(200, 60, 40), outline="white")
    draw.text((cx0 + c / 2, cy0 + c / 2), "x", font=title_font, anchor="mm", fill="white")
    r = round(dh * 0.15)                                                                # red X icon
    ix, iy = round(dw * 0.12), round(bar + (dh - bar) * 0.38)
    draw.ellipse([ix - r, iy - r, ix + r, iy + r], fill=X_RED)
    k = r * 0.42
    for a, b in (((ix - k, iy - k), (ix + k, iy + k)), ((ix - k, iy + k), (ix + k, iy - k))):
        draw.line([a, b], fill="white", width=max(3, r // 4))
    draw.text((ix + r * 1.6, iy), MESSAGE, font=ImageFont.truetype(FONT_FILE, round(dh * 0.13)), anchor="lm", fill="black")
    bw, bh = round(dw * 0.24), round(dh * 0.19)                                        # OK button
    bx, by = (dw - bw) // 2, dh - bh - round(dh * 0.09)
    draw.rectangle([bx, by, bx + bw, by + bh], fill=(225, 225, 225), outline=(0, 120, 215), width=2)
    draw.text((bx + bw / 2, by + bh / 2), "OK", font=ImageFont.truetype(FONT_FILE, round(bh * 0.5)), anchor="mm", fill="black")
    return img


def overlay(t):
    """Every dialog whose time has come, each with a quick 0.08s scale-up as it appears."""
    img = Image.new("RGBA", (w, h))
    for i in range(COUNT):
        age = t - (START + i * EVERY)
        if age < 0:
            break
        scale = 0.85 + 0.15 * min(age / 0.08, 1)
        d = box if scale == 1 else box.resize((round(box.width * scale), round(box.height * scale)), Image.LANCZOS)
        x = w * (FIRST[0] + i * STEP[0]) + (box.width - d.width) / 2
        y = h * (FIRST[1] + i * STEP[1]) + (box.height - d.height) / 2
        img.alpha_composite(d, (round(x), round(y)))
    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)
box = dialog()
render(src, out)

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