2026-11-26 15:39 UTC

Fallan publishes Python continuity scripts for a 59-shot AI music video

state: seedheat: lowuncertainty: mediumrelevance: mediumai-video character-consistency creative-toolsAndrew Fallan

What is this?

Andrew Fallan’s GitHub repository offers Python post-production scripts used on a 59-shot, 5:53 AI-generated music video, *Forever, Darling (Auto-Renew)*. The scripts apply face-identity matching across multiple reference frames, smooth and adjust iris appearance, and retime lip-sync clips to word-level timing. Fallan says the workflow used OpenCV, InsightFace, SciPy and FFmpeg, alongside Gemini 4 Neon, Suno and Google Flow (Veo + Omni 1.2 Flash), and required no additional video-generation credits for the stated fixes. The repository links a full video, a making-of breakdown and a raw-versus-processed comparison. Evidence is the author’s repository and a Hacker News submission linking to it; no independent validation or adoption evidence is supplied, so performance claims remain the author’s.

Why it matters

This is a practical example of improving AI-video continuity through conventional post-production code rather than relying solely on better generation models or repeated generation. If the author’s results hold up, these techniques could help individual creators produce longer, more coherent multi-shot videos while spending fewer generation credits. The evidence shows one creator’s workflow, not a broadly tested tool or a general solution to AI-video consistency.

Current assessment

New: Fallan has published a repository of scripts and demonstrations for polishing identity, eye appearance and lip-sync continuity in a specific 59-shot AI music video. The repository describes multi-frame ArcFace embeddings and face swapping, per-shot iris tinting or reconstruction with temporal smoothing, and frame-level clip retiming against a word-timing timeline. Fallan reports that the workflow avoided extra video-generation credits and improved continuity; these are self-reported results, not independently benchmarked. The scripts are presented as post-production tools for a particular production, not as a new video-generation model or turnkey general-purpose product. The supplied sources do not establish licensing details, ease of reuse, outside adoption, or performance across other characters and production conditions. Track as an illustrative creator workflow; broader significance depends on reproducibility and uptake.

Measured heat

now 0 pts/hpeak 2 pts/hcomments 0/hpeers p69momentum: steady2 platformsage 1h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-26 15:23 (minted)⭐ origin echo-reconstructedA repository presents Python scripts using face embeddings, temporal iris smoothing, and word-level lip-sync retiming to polish a 59-shot AI
Andrew Fallan on github (echo) · attributed from hn.story.50655725 · published time unknown
—
11-26 14:33first on hacker news · published · lag ?Python scripts for 59-shot AI video face-lock, iris-lock, and lip-sync
afallan
—
11-26 14:33amplified on hacker news 👑hn.story.50655725
afallan
peak 2 · 0 comments · 103% of case engagement
11-26 15:21our radar first saw it · lag ?discovery anchor: hn.story.50655725—

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnPython scripts for 59-shot AI video face-lock, iris-lock, and lip-sync
Retrieved article excerpt

Open article · Retrieved 2026-11-26T15:22:48.642096+00:00

# Killing AI Slop Across 59 Shots: Multi-Frame Face-Lock, Savitzky-Golay Iris-Lock, and Zero-Freeze Lip-Sync in Python

*Demo outputs:* **[3:42 End-to-End Making-Of Breakdown](https://www.youtube.com/watch?v=-bNBXyDF0Hk)** · **[14s Raw vs. Locked Split-Screen](https://www.youtube.com/watch?v=9jEY6fKMBF0)** · **[Full 5:53 Music Video (59 shots, 1080p24)](https://www.youtube.com/watch?v=EY9qd_obnRE)**

Most AI music videos look unmistakably like "AI slop" after about four seconds—not because the base image or video models lack resolution, but because **temporal continuity breaks down across cuts**:

1. **Identity drift:** Your protagonist's bone structure subtly shifts every time you switch from a wide establishing shot to a singing close-up.
2. **Iris collapse & drift:** Lip-sync models routinely either drift stylized eyes back to generic blue-grey, or blow bright eyes out into featureless white flashlights.
3. **Frozen lip-sync tails:** Audio-driven lip-sync outputs rarely align cleanly to exact song beat boundaries, leaving dead frozen frames at clip leads/tails or 120 ms mouth-to-vocal skew.

While producing *Forever, Darling (Auto-Renew)*—a 5:53, 59-shot music video built with **Gemini 4 Neon** (concept, lyrics, storyboarding, post-production code), **Suno** (136 BPM F# minor dark-pop × symphonic rock-opera), and **Google Flow (Veo + Omni 1.2 Flash)**—we solved all three problems deterministically in Python (`OpenCV`, `InsightFace`, `SciPy`, `FFmpeg`) using **zero additional video-generation credits**.

---

## 1. Multi-Frame Golden Embedding Face-Lock (`apply_facelock_v3.py`)

Single-image face swapping fails across drastic lighting and expression shifts (e.g., soft morning clinic light vs. golden-hour operatic belting). Instead of anchoring to a single portrait, we extract **three approved hero frames** across distinct lighting conditions (`S47` close-up, `S29` chorus singing, `S13` sunlit mid-shot) and compute a **weighted normalized ArcFace embedding** via InsightFace's `buffalo_l`:

```
f47 = app.get(grab_frame("S47_lipsync.mp4", 0.55))[0]
f29 = app.get(grab_frame("S29_lipsync.mp4", 0.25))[0]
f13 = app.get(grab_frame("S13_raw.mp4", 0.60))[0]

emb = 0.45 * f47.normed_embedding + 0.35 * f29.normed_embedding + 0.20 * f13.normed_embedding
emb = emb / np.linalg.norm(emb)

golden = f29
golden.embedding = emb * np.linalg.norm(f29.embedding)
```

Running `inswapper_128.onnx` across `ProcessPoolExecutor` CPU workers with that blended golden identity—combined with 106-point landmark masking—locked facial geometry across all 30+ character shots without burning a single extra video-gen credit.

---

## 2. Dual-Mode Iris Physics + Temporal Smoothing (`fix_xena_eyes.py`)

Xena's signature visual cue is bioluminescent xenon-lavender irises with crisp dark pupils. Across 59 raw shots, video and lip-sync generators failed in **two opposite ways**, so we built two deterministic per-shot modes:

- **`tint` mode (color drift):** Shifts drifted blue-grey irises (`S04`, `S29`, `S55`) cleanly into xenon-lavender in HSV/LAB space while strictly masking out pupils, specular catchlights, lashes, sclera, and blink frames.
- **`tame` mode (glow blowout):** Reconstructs crisp dark pupils and defined iris rings on shots where bright lighting washed the eyes into blank white circles (`S18`, `S45`, `S47`, `S51`), again respecting natural blinks.

To stop frame-to-frame jitter from per-frame eye detection, pupil/iris coordinates are smoothed temporally across each clip using `scipy.signal.savgol_filter` before rendering back via piped `ffmpeg` (`-crf 15`).

*(14-second raw-vs-locked visual comparison: [Before vs. After Python Split-Screen](https://www.youtube.com/watch?v=9jEY6fKMBF0))*

---

## 3. Zero-Frozen-Frame Word-Level Lip-Sync Retiming (`align_xena_lipsync.py`)

Audio-driven lip-sync models frequently introduce slight drift or padded lead/tail frames. Rather than manually nudging 11 singing takes in an NLE:

1. We transcribed the isolated vocal stem (`Demucs` → word-level onsets) and wrote a canonical `xena_timeline.json` across all 59 shots with six surgical editorial boundary overrides (`S17/S18`, `S29/S30`, `S32/S33`, `S45/S46`, `S51/S52`, `S53/S54`).
2. Each Omni 1.2 Flash clip is retimed directly to its exact frame window (`round(start_s * 24)` to `round(end_s * 24)`) with zero frozen lead/tail frames.
3. All HUD graphics (`BIOLOGICAL AGE: 48.2 → 25.0 (LOCKED) → AUTO-RENEW: ∞`) and word-synced karaoke captions are kept 100% out of video prompts (eliminating garbled AI text) and burned cleanly in post-production via ASS subtitles + a 10-panel `ffmpeg` split-screen montage grid (`build_xena_montage.py`).

---

## Lessons Learned

- **Never put readable text or HUDs inside video prompts.** Keeping typography 100% in post-production ASS overlays eliminated 90% of wasted video retries.
- **Post-production beats re-rolling.** Spending 2 hours writing deterministic OpenCV/InsightFace/SciPy polish scripts saved dozens of video generations and produced noticeably tighter continuity than prompt-engineering alone.
- **Vertical framing matters for short-form:** Repurposing 16:9 music videos into letterboxed vertical strips triggered ~85% instant swipe-away on Shorts; cropping out bottom horizontal captions first and rendering true edge-to-edge full-bleed 9:16 with re-timed vertical ASS captions immediately became our highest-performing clip format.

Full 5:53 output: [Forever, Darling (Auto-Renew) on YouTube](https://www.youtube.com/watch?v=EY9qd_obnRE) · Before/After split-screen: [YouTube Short](https://www.youtube.com/watch?v=9jEY6fKMBF0)
afallan20
🟧 echo.github ⭐A repository presents Python scripts using face embeddings, temporal iris smoothing, and word-level lip-sync retiming to polish a 59-shot AIAndrew Fallan——

Interpretation history

Decision trace