How to add a zoom pulse on beat with Claude

On every kick drum the whole shot jumps 8% closer to the bottle and eases back to full width within 0.3 seconds, so the picture bounces twice a second with the 120 BPM loop.

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 a zoom pulse on beat to input.mp4
    How big the frame gets on a beat: 1.08
    Seconds to ease back to full size after each beat: 0.3

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 zoom pulse on beat 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
PULSE1.08How big the frame gets on a beat. 1.08 is 8% bigger.
EASE0.3Seconds to ease back to full size after each beat.
BASS_HZ150Beats are found in the sound below this frequency, where the kick drum sits.
RATE22050Audio sample rate the beat tracking uses.
HOP256Audio samples per analysis step. Smaller gives more exact beat times.

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 a zoom pulse on the beat to input.mp4. Find the kick drum beats with librosa: take the onset strength of the audio (mono, 22050 Hz) with hop_length 256, fmax 150 Hz and n_mels 8, run librosa.beat.beat_track on that envelope, move each beat back to where its hit starts with librosa.onset.onset_backtrack, convert to seconds and round each to the nearest video frame. On each beat, scale the frame up to 1.08x about its center (crop the same amount from all four sides, so the middle doesn't move) and ease back to 1.0x over 0.3 seconds with zoom = 1 + 0.08 x (1 - p)^2, where p is the seconds since the beat divided by 0.3. Between pulses the frame stays at 1.0x. No text is needed; if you add any, draw it with Pillow, not ffmpeg's drawtext. Keep the size (540x960), 30fps and the audio, encode H.264 yuv420p, and save it as output.mp4.

Run it without Claude

This is the exact script we tested. Save it as zoom-pulse-on-beat.py and run:

python3 zoom-pulse-on-beat.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Zoom pulse on beat: the frame bumps 8% bigger on every kick drum, then eases back to full size.

Usage: python3 zoom-pulse-on-beat.py input.mp4 output.mp4  (the input needs a music track with a beat)
Needs ffmpeg, librosa, numpy and OpenCV (pip install librosa numpy opencv-python-headless).
"""
import json
import subprocess
import sys

import cv2
import librosa
import numpy as np

PULSE = 1.08          # how big the frame gets on a beat (1.08 = 8% bigger)
EASE = 0.3            # seconds to ease back to full size after each beat
BASS_HZ = 150         # beats are found in the sound below this frequency (the kick drum)
RATE = 22050          # audio sample rate the beat tracking uses
HOP = 256             # audio samples per analysis step (smaller = more exact beat times)


def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate", "-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)


def beat_times(src):
    """Kick drum beats in seconds: track the beat in the bass, then move each one back to where its hit starts."""
    pcm = subprocess.check_output(["ffmpeg", "-v", "error", "-i", src, "-ac", "1", "-ar", str(RATE), "-f", "f32le", "-"])
    audio = np.frombuffer(pcm, np.float32)
    bass = librosa.onset.onset_strength(y=audio, sr=RATE, hop_length=HOP, fmax=BASS_HZ, n_mels=8)
    _, beats = librosa.beat.beat_track(onset_envelope=bass, sr=RATE, hop_length=HOP)
    beats = librosa.onset.onset_backtrack(beats, bass)
    return librosa.frames_to_time(beats, sr=RATE, hop_length=HOP)


def zoom_at(t, beats):
    """PULSE right on a beat, easing out to 1 over EASE seconds."""
    past = beats[beats <= t + 1e-6]
    if not len(past) or t - past[-1] >= EASE:
        return 1.0
    p = (t - past[-1]) / EASE
    return 1 + (PULSE - 1) * (1 - p) ** 2


src, out = sys.argv[1], sys.argv[2]
w, h, rate, fps = probe(src)
beats = np.round(beat_times(src) * fps) / fps   # line each beat up with a video frame

reader = subprocess.Popen(["ffmpeg", "-v", "error", "-i", src, "-f", "rawvideo", "-pix_fmt", "rgb24", "-"],
                          stdout=subprocess.PIPE)
writer = subprocess.Popen(["ffmpeg", "-v", "error", "-y", "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{w}x{h}",
                           "-r", rate, "-i", "-", "-i", src, "-map", "0:v", "-map", "1:a?", "-c:v", "libx264",
                           "-crf", "18", "-pix_fmt", "yuv420p", "-c:a", "copy", "-shortest", out], stdin=subprocess.PIPE)
i = 0
while True:
    raw = reader.stdout.read(w * h * 3)
    if len(raw) < w * h * 3:
        break
    img = np.frombuffer(raw, np.uint8).reshape(h, w, 3)
    z = zoom_at(i / fps, beats)
    scale = np.float32([[z, 0, (1 - z) * w / 2], [0, z, (1 - z) * h / 2]])   # scale up about the center
    writer.stdin.write(cv2.warpAffine(img, scale, (w, h), flags=cv2.INTER_LINEAR).tobytes())
    i += 1
writer.stdin.close()
reader.wait()
sys.exit(writer.wait())

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