How to add a VU meter with Claude

Two LED level meters marked L and R sit in a dark panel along the bottom, filling green into yellow on the kicks and into red on the loudest hits, then draining between beats under a white peak marker.

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 VU meter to input.mp4
    LEDs per meter: 20
    First yellow and first red LED, counting from 0: 14, 18

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 vu meter 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
SEGMENTS20LEDs per meter.
YELLOW_FROM, RED_FROM14, 18First yellow and first red LED, counting from 0.
RANGE_DB36Loudness range the meter shows, in dB below the track's loudest moments.
FALL0.06Share of the meter that drains each frame when the sound drops.
HOLD0.4Seconds the white peak marker stays at the highest level.

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 VU meter to input.mp4 that follows its audio. Draw a dark panel, RGB (16, 16, 20) at 82% opacity with rounded corners, from 8% to 92% across and 80% to 93% down the frame. Inside it put two rows of 20 rounded LED segments, labeled "L" and "R" in white bold on the left, one row per audio channel: LEDs 1-14 green (40, 220, 100), 15-18 yellow (255, 200, 0) and 19-20 red (255, 40, 50); unlit LEDs show their color at 22% brightness over the panel. For each frame, take the peak level of the audio in a 0.05-second window centered on that frame, in dB, and map the range from 36 dB below the track's 99th-percentile frame peak up to that peak onto 0-20 lit LEDs. The meter jumps up at once and drains by at most 6% of its length per frame. A white (245, 245, 245) peak marker sits on the highest LED reached in the last 0.4 seconds. Draw the meters with Python and Pillow (not ffmpeg's drawtext filter), composite them onto every frame with ffmpeg, keep the audio, and save it as output.mp4.

Run it without Claude

This is the exact script we tested. Save it as vu-meter.py and run:

python3 vu-meter.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""VU meter: two LED level meters at the bottom, L and R, rise green to yellow to red with the loudness of each channel.

Usage: python3 vu-meter.py input.mp4 output.mp4
Needs ffmpeg, numpy and Pillow (pip install numpy pillow).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

import numpy as np
from PIL import Image, ImageDraw, ImageFont

SEGMENTS = 20                  # LEDs per meter
GREEN, YELLOW, RED = (40, 220, 100), (255, 200, 0), (255, 40, 50)  # LED colors, low to high
YELLOW_FROM, RED_FROM = 14, 18  # first yellow and first red LED (counting from 0)
LEFT, RIGHT = 0.08, 0.92       # panel's left and right edges (0-1 across the frame)
TOP, BOTTOM = 0.80, 0.93       # panel's top and bottom (0-1 down the frame)
PANEL = (16, 16, 20, 210)      # panel color and opacity
UNLIT = 0.22                   # brightness of an LED that is off, as a share of lit
RANGE_DB = 36                  # loudness range the meter shows, below the track's loudest moments
FALL = 0.06                    # share of the meter that drains each frame when the sound drops
HOLD = 0.4                     # seconds the white peak marker stays at the highest level
WINDOW = 0.05                  # seconds of audio measured around each frame
RATE = 48000                   # audio sample rate used for the analysis
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 bold font found: add one to FONTS")


def levels(src):
    """Meter level (0-1) of the left and right channel on every frame, from the peak of the audio around it."""
    pcm = subprocess.check_output(["ffmpeg", "-v", "error", "-i", src, "-vn", "-ac", "2", "-ar", str(RATE),
                                   "-f", "f32le", "-"])
    audio = np.abs(np.frombuffer(pcm, np.float32).reshape(-1, 2))
    half = round(WINDOW / 2 * RATE)
    centers = [round(i / fps * RATE) for i in range(frames)]
    db = 20 * np.log10(np.array([audio[max(0, m - half):m + half].max(axis=0, initial=0) for m in centers]) + 1e-9)
    top = np.percentile(db, 99)
    meter = np.clip((db - (top - RANGE_DB)) / RANGE_DB, 0, 1)
    for i in range(1, frames):  # jump up at once, drain gently
        meter[i] = np.maximum(meter[i], meter[i - 1] - FALL)
    return meter


def led_color(i):
    return RED if i >= RED_FROM else YELLOW if i >= YELLOW_FROM else GREEN


def overlay(i):
    img = Image.new("RGBA", (w, h))
    draw = ImageDraw.Draw(img)
    x0, x1, y0, y1 = LEFT * w, RIGHT * w, TOP * h, BOTTOM * h
    pad = (y1 - y0) * 0.16
    draw.rounded_rectangle([x0, y0, x1, y1], radius=pad, fill=PANEL)
    row_h = (y1 - y0 - 3 * pad) / 2
    label_w = row_h * 1.1
    slot = (x1 - x0 - 2 * pad - label_w) / SEGMENTS
    hold = round(HOLD * fps)
    for c, name in enumerate("LR"):
        top = y0 + pad + c * (row_h + pad)
        draw.text((x0 + pad + label_w / 2, top + row_h / 2), name, font=font, anchor="mm", fill="white")
        lit = math.ceil(meter[i, c] * SEGMENTS)
        peak = math.ceil(meter[max(0, i - hold):i + 1, c].max() * SEGMENTS) - 1
        for s in range(SEGMENTS):
            left = x0 + pad + label_w + s * slot
            box = [left + slot * 0.12, top, left + slot * 0.88, top + row_h]
            if s < lit:
                fill = led_color(s)
            elif s == peak:
                fill = (245, 245, 245)
            else:
                fill = tuple(round(v * UNLIT + p * (1 - UNLIT)) for v, p in zip(led_color(s), PANEL[:3])) + (PANEL[3],)
            draw.rounded_rectangle(box, radius=slot * 0.15, fill=fill)
    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 the meters 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(frames):
        ff.stdin.write(overlay(i).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")


src, out = sys.argv[1:3]
w, h, rate, fps, duration = probe(src)
frames = math.ceil(duration * fps)
font = ImageFont.truetype(FONT_FILE, round(h * (BOTTOM - TOP) * 0.26))
meter = levels(src)
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