---
name: video-editing
description: Edits a vertical talking-head reel (for example a HeyGen avatar video) with a hook title, word-by-word captions, keyword highlights, punch-in zooms and an end card, using code inside Claude. Use when the user asks to edit a reel or add captions and motion graphics to a talking-head video.
---

# Reel video editing

> Free skill from Clone Labs · clonelabs.in/guides/ai-video-autopilot/
> Needs **Code execution and file creation** turned on in Claude (Settings → Capabilities).
> ✏️ Change the brand style in section 2 to your own colours and fonts.

## Job
Take a vertical talking-head video and its script, and return one edited, ready-to-post MP4: hook text in the first seconds, word-by-word captions, a few keyword highlights, subtle punch-in zooms and a short end card. Keep it clean: one idea on screen at a time.

## 1. Inputs
- **Video:** the HeyGen video (download it from its video URL into the workspace) or a video the user uploads. If the download is blocked, tell the user to check that **Allow network egress** is on in Settings → Capabilities; if it still fails, ask them to upload the video into the chat.
- **Script:** the script .md file (it holds the spoken words and the on-screen hook text). The script is the transcript: don't try to run speech-to-text.
- Optional: a logo file, font files (.otf/.ttf) and a call to action, if the user uploaded them to the project.

## 2. Brand style ✏️ (change this)
| Item | Value |
|---|---|
| Accent colour (pills, active word) | `#661AFF` |
| Light accent | `#C9B8FF` |
| Text colour | `#FFFFFF` with a soft dark shadow or outline |
| Heading font | Uploaded brand font if any, otherwise a bold sans such as Montserrat, Poppins or DejaVu Sans Bold |
| Caption font | Same family, bold |
| End card text | `Follow @[yourhandle] for more` |

## 3. Layout (1080 × 1920)
- **Top band (0–330 px) stays empty**, so a logo can be added later. Never put text at the very top.
- **Middle band** holds the hook and keyword highlights, placed just below the speaker's chin (check a frame to find it; usually y ≈ 1000–1250).
- **Captions** sit lower, around y ≈ 1350–1500, 2–4 words at a time.
- Keep the bottom ~250 px clear of important text (Instagram's buttons cover it).
- One idea on screen at a time: an element leaves before the next one arrives.

## 4. What to add
1. **Hook (0–3 s):** the on-screen hook from the script. Line 1 in white, line 2 inside an accent-coloured pill. Slide up in, fade out.
2. **Captions:** word-by-word, 2–4 words per chunk, the word being spoken in the accent colour with a tiny scale bump. Break chunks at punctuation and pauses.
3. **Keyword highlights:** 3–6 short phrases (1–4 words) from the script at key moments, shown in a pill for 1–2 seconds. Hide the captions while one is on screen if they would overlap.
4. **Punch-in zooms:** every 4–7 seconds on an emphasised line, scale 1.08–1.15, quick in and hold or ease back. Never constant zooming.
5. **End card (last 2–3 s):** the end card text from section 2, centred, with a gentle slide-up.
No sound effects or music unless the user asks.

## 5. Word timings
You can't transcribe audio here, so estimate timings from the script:
1. Get the speech pauses with FFmpeg: `ffmpeg -i in.mp4 -af silencedetect=noise=-32dB:d=0.18 -f null -`
2. Split the script into sentences and match them, in order, to the speech segments between pauses.
3. Spread the words of each sentence across its segment by syllable count (or character length).
Tell the user the timings are estimated and easy to nudge.

## 6. How to render
First check what the workspace has: `ffmpeg -version`, `ffmpeg -filters | grep -E " (ass|subtitles|drawtext) "`, and whether Python Playwright with Chromium works.

**Route A – HTML overlay (best looking, if Playwright works):**
1. Build one `overlay.html` (1080×1920, transparent background) with a `seek(t)` function that sets every element's state from time t.
2. Screenshot frames with `omitBackground: true` at the video's frame rate, only where graphics are on screen.
3. Composite with FFmpeg: `[0:v][1:v]overlay=eof_action=pass` (shift the PNG sequence with `setpts` to its start time), keep the original audio.

**Route B – FFmpeg only (always available):**
1. Write the hook, keyword pills and captions as an ASS subtitle file (PlayResX 1080, PlayResY 1920; `\pos`, `\fad`, `\t` scale pops; BorderStyle 3 for pills). Use the `ass=` filter. If `ass` isn't available, render each element as a transparent PNG with Pillow and overlay it with `enable='between(t,start,end)'`.
2. Zooms: `zoompan=z='1+between(it,S,E)*0.12':x='iw/2-(iw/zoom/2)':y='ih*0.38-(ih/zoom)*0.38':d=1:s=1080x1920:fps=30` (one term per zoom, added together).

**Encoding (both routes):** H.264, `-preset veryfast -crf 21`, AAC 160k, `-movflags +faststart`, same length as the source. **Keep the file under 28 MB** (Claude's file limit is 30 MB): raise the CRF if it's bigger.

## 7. Check before delivering
- Extract 4–6 frames (hook, a caption, a highlight, a zoom, the end card) and look at them.
- Fix anything that overlaps, sits in the top band, is cut off or is hard to read on a phone.
- Watch for a caption that drifts out of sync; adjust that sentence's timing.

## 8. Deliver
Save as `final-<topic-slug>.mp4` and send it with one line of caption. In the reply, list what's on screen with timestamps and anything you guessed (timings, wording). For revisions, change only what the user asks and name files v2, v3…
