← sources

Mind Blowing (genuinely). Claude Code cut a 4-minute movie trailer and hid two single frames in it. Here's the script it used: film subtitles without drawtext, plus one-frame splices. 110 lines, MIT. Oh and the trailer as well; I am open-sourcing the software used make it, details in the clip.

source: reddit (reddit:ClaudeAI)published 2026-09-25 11:49ingested 2026-09-26 02:35

retained text

Please enjoy the clip.

There are **two single frames** hidden in this trailer. Tyler Durden rules: one frame each, no warning. First person to post both timecodes wins absolutely nothing, but will be highly regarded.

The whole film was made by Claude Code: pictures, video, music, voices, edit, titles, credits. No editing software was opened. Everything is a script, and we promised in the end credits to open-source all of them. This is script #1: `burnsubs.py`.

**What it does**

- Burns film-style subtitles into a video **without ffmpeg's `drawtext`** (plenty of builds don't have it). Each line is drawn once as a transparent PNG with Pillow, then overlaid only during its own time window. One encode, any font.
- Splices an image in for **exactly one frame**: `--splice 115.417=bear.png`

**Three things we learned the hard way**

**1. Put every subtitle on one baseline.** Our first cut sat 23 px higher on some shots than others, so the subtitles hopped at every cut. The textbook alternative, centring each line's `textbbox`, is also wrong: descenders pull "jumpy piggy" 7 px above "MOON". Draw on a fixed baseline instead (Pillow anchor `"ls"`), and only the tails of g, p and y go below it.

(Before/after picture in the first comment.)

**2. A one-frame splice wants a keyframe after it.** Snap the time to the frame grid, make the overlay window shorter than one frame, and force a keyframe on the splice **and on the frame after it**. Otherwise the frame after the splice is predicted from a completely different picture. Measured on our clip: that frame came out 3.7 dB cleaner with the forced keyframe (52.1 vs 48.4 dB at CRF 21). The frames before the splice don't care either way.

**3. Dark smoke breaks into blocks.** A viewer spotted blocky smoke around our first hidden frame in one viewing. The real cause wasn't the splice: x264's default gives dark, flat areas too few bits, and our picture went through four lossy encodes before the master. Fixes: `-x264-params aq-mode=3` (more bits for dark areas), and near-lossless intermediates (CRF 12) so the damage doesn't stack.

**The core of the splice:**

```python
f = round(t * fps); t0 = f / fps                      # snap to the frame grid
enable = f"between(t,{t0 - 0.25/fps:.4f},{t0 + 0.5/fps:.4f})"   # less than one frame wide
graph.append(f"[{last}][{k}:v]overlay=0:0:enable='{enable}'[x{k}]")
keys += [f"{t0:.4f}", f"{(f + 1) / fps:.4f}"]          # keyframe on the splice AND the frame after
```

Full script in the first comment. Python 3.8+, Pillow, numpy, and any ffmpeg.

*Pictures, voices and music are AI-generated and labelled as such. Parody, not affiliated with Wendy's, not financial advice. We like the stock.*

document fetched 2026-09-26 00:22 · canonical https://reddit.com/r/ClaudeAI/comments/1wpu8uz/mind_blowing_genuinely_claude_code_cut_a_4minute