---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Fix AI Subtitles Out of Sync, Misspelled Brand Names & Messy Line Wraps"
description: "Extract an aligned 16 kHz mono WAV from your conformed CFR master video, pin fal-ai/elevenlabs/speech-to-text/scribe-v2 ($0.008/min) with keyterms (+30%) and diarize: true, then format word-level timestamps deterministically into ≤38-char SRT lines or 3-word ASS karaoke blocks inside the 9:16 safe zone."
canonical: "https://framesfield.com/fixes/ai-speech-to-text-subtitles-out-of-sync-and-wrong-names-fix"
---

# Fix AI Subtitles Out of Sync, Misspelled Brand Names & Messy Line Wraps

> Extract an aligned 16 kHz mono WAV from your conformed CFR master video, pin fal-ai/elevenlabs/speech-to-text/scribe-v2 ($0.008/min) with keyterms (+30%) and diarize: true, then format word-level timestamps deterministically into ≤38-char SRT lines or 3-word ASS karaoke blocks inside the 9:16 safe zone.

- **Canonical URL:** https://framesfield.com/fixes/ai-speech-to-text-subtitles-out-of-sync-and-wrong-names-fix
- **Category:** API & Batch Pipelines
- **Error Signature:** `Subtitle bug: burned-in captions lag 0.5–1.5s behind speech, product/brand names transcribe phonetically wrong, or lines overflow past 55 characters across phone UI buttons`
- **Last Verified:** 2026-12-01

## Observed Symptom

Your automated caption script transcribes a podcast or short-form video, but captions progressively drift off-beat, brand acronyms turn into gibberish ("Frame Field", "Comfy UI" -> "Comfy you I"), speaker changes merge into one confusing paragraph, or huge 3-line subtitle blocks collide with TikTok/Reels overlays.

## Technical Root Cause

Four common automation shortcuts break production subtitles: transcribing VFR/container-offset MP4 audio directly instead of an aligned 16 kHz mono WAV track, calling older ASR models without domain vocabulary boosting, skipping speaker diarization, and dumping raw ASR phrase segments straight into SRT without enforcing max characters-per-line and characters-per-second (CPS) reading budgets.

## Under the Hood

Progressive caption drift almost always traces back to container edit-list offsets (`start_time > 0`) or variable-frame-rate video timelines. When an ASR tool ingests a trimmed MP4 whose audio stream starts 340ms late—or strips silent intro frames—every returned timestamp shifts linearly away from the video frames. Extracting a clean constant-timing `16 kHz` mono PCM WAV straight from the exact conformed master MP4 (preserving timeline zero with `-af aresample=async=1`) locks audio samples to video timecode.

Misspelled brand names, creator handles, and technical tools happen because generic acoustic models default to common English dictionary homophones. Calling ElevenLabs Scribe v2 on fal.ai (`fal-ai/elevenlabs/speech-to-text/scribe-v2`, `$0.008/min`) with the `keyterms` array (`+30%`, `$0.0104/min`) injects your exact proper nouns straight into beam decoding—fixing spelling before text ever hits disk while also returning `speaker_id` diarization and word-level `start`/`end` floats in one pass.

Finally, raw phrase segments from any STT API ignore broadcast readability rules. For vertical 9:16 Reels/Shorts, active karaoke ASS chunks should hold 2–4 words (~14–22 characters) centered inside the safe middle third; for horizontal 16:9 YouTube SRTs, lines must wrap strictly under 38–42 characters (max 2 lines, ≤18 characters per second) and split cleanly whenever `speaker_id` changes.

## Before vs. After

### Broken (Broken Pipeline (Legacy v1 Endpoint, No Keyterms, Raw Phrase Dump))

```
# Calls legacy v1 ($0.03/min — 3.75x costlier), no keyterms, dumps raw 90-char lines
POST https://fal.run/fal-ai/elevenlabs/speech-to-text
{"audio_url": "https://cdn.example.com/vfr_raw_edit.mp4"}
-> "welcome to frame field where we benchmark comfy you eye and clod code"
```

### Verified Fix (Fixed Pipeline (Aligned 16kHz WAV + Scribe v2 Keyterms + Deterministic Word Wrapper))

```
# Step 1: Extract timeline-aligned 16kHz mono WAV from CFR video
ffmpeg -y -i master_cfr.mp4 -vn -ac 1 -ar 16000 -af "aresample=async=1:first_pts=0" audio_16k.wav

# Step 2: Pin Scribe v2 ($0.008/min · $0.0104/min w/ keyterms) + diarize: true
POST https://fal.run/fal-ai/elevenlabs/speech-to-text/scribe-v2
{
  "audio_url": "<uploaded audio_16k.wav URL>",
  "diarize": true,
  "tag_audio_events": false,
  "keyterms": ["FramesField", "ComfyUI", "Claude Code", "SeedVR2", "FASHN"]
}
-> Exact word timestamps + speaker_id + spelled terms -> deterministic 38-char SRT / ASS
```

Timeline-zero WAV extraction eliminates container sync drift, pinning /scribe-v2 cuts cost 3.75× while enabling keyterms spelling lock, and word-level formatting guarantees readable line lengths and clean speaker turns.

## Copy-Paste Fix (scribe_json_to_srt.py)

```bash
cat <<'PY' > scribe_json_to_srt.py
import json, sys

def fmt_ts(sec: float) -> str:
    ms = max(0, int(round(sec * 1000)))
    h, ms = divmod(ms, 3600000)
    m, ms = divmod(ms, 60000)
    s, ms = divmod(ms, 1000)
    return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"

data = json.load(open(sys.argv[1], "r", encoding="utf-8"))
words = [w for w in data.get("words", []) if w.get("type") == "word"]

MAX_CHARS = 38
MAX_DUR = 3.2
cues, buf = [], []

def flush():
    if not buf:
        return
    cues.append((buf[0]["start"], buf[-1]["end"], " ".join(w["text"] for w in buf)))
    buf.clear()

for w in words:
    if buf:
        spk_changed = w.get("speaker_id") != buf[-1].get("speaker_id")
        gap = w["start"] - buf[-1]["end"] > 0.65
        proj_len = len(" ".join(x["text"] for x in buf)) + 1 + len(w["text"])
        proj_dur = w["end"] - buf[0]["start"]
        if spk_changed or gap or proj_len > MAX_CHARS or proj_dur > MAX_DUR:
            flush()
    buf.append(w)
flush()

with open(sys.argv[2], "w", encoding="utf-8") as out:
    for idx, (st, en, txt) in enumerate(cues, 1):
        out.write(f"{idx}\n{fmt_ts(st)} --> {fmt_ts(en)}\n{txt}\n\n")
print(f"Wrote {len(cues)} synced SRT cues to {sys.argv[2]}")
PY
```

## Step-by-Step Resolution

1. **Extract timeline-aligned 16 kHz mono WAV from the master video:** Use FFmpeg with -af "aresample=async=1:first_pts=0" on your final CFR video edit so audio timestamp 0.000 matches video frame 0 exactly.
2. **Call ElevenLabs Scribe v2 with domain keyterms and diarization enabled:** Pin fal-ai/elevenlabs/speech-to-text/scribe-v2 ($0.008/min, or $0.0104/min with keyterms), list all product names, brand terms, and people inside keyterms, and set diarize: true for interviews.
3. **Wrap word-level timestamps deterministically on speaker/pause/length bounds:** Run scribe_json_to_srt.py (or our ASS karaoke formatter in Skill 67) so every cue respects ≤38 characters per line, splits cleanly on speaker changes, and stays ≤3.2 seconds.
4. **Burn captions inside platform safe zones using FFmpeg libass:** For vertical 9:16 Reels/Shorts, place ASS Alignment=2 with MarginV between 460 and 540 (on 1920px height) so bottom buttons and descriptions never cover your captions.

## Verification Check (Test Local Word-JSON to Synced SRT Conversion & Check Max Line Length)

```bash
python3 -c 'import json; json.dump({"words":[{"type":"word","text":"FramesField","start":0.12,"end":0.64,"speaker_id":"speaker_0"},{"type":"word","text":"benchmarks","start":0.68,"end":1.15,"speaker_id":"speaker_0"},{"type":"word","text":"SeedVR2","start":1.18,"end":1.75,"speaker_id":"speaker_0"},{"type":"word","text":"and","start":1.78,"end":1.92,"speaker_id":"speaker_0"},{"type":"word","text":"FASHN.","start":1.95,"end":2.40,"speaker_id":"speaker_0"}]}, open("/tmp/test_scribe.json","w"))'
python3 scribe_json_to_srt.py /tmp/test_scribe.json /tmp/test_out.srt
cat /tmp/test_out.srt
```

**Expected healthy output:**

```text
1
00:00:00,120 --> 00:00:01,920
FramesField benchmarks SeedVR2 and

2
00:00:01,950 --> 00:00:02,400
FASHN.
```

## Prevention Guardrails

1. **Always lock editorial picture cuts BEFORE generating final subtitles:** Trimming 1.2 seconds off the intro after transcription shifts every cue off-sync unless you regenerate or apply a uniform SRT offset.
2. **Keep a reusable brand keyterms JSON array per client workspace:** Loading the client’s glossary of product SKUs, executive names, and acronyms into Scribe v2 keyterms prevents manual find-and-replace QA on every video.
3. **Verify subtitles at the very last 10 seconds of the video, not only the first 5 seconds:** VFR drift is invisible at 00:00:03 and painfully obvious at 00:08:45—always spot-check sync near the end of long edits.

## FAQs

### Why do my automated SRT subtitles start synced and drift late by the end of a 10-minute video?

Variable-frame-rate (VFR) source footage or container edit-list offsets cause audio clock drift relative to rendered video frames. Re-encode your video to constant frame rate (CFR) and extract a 16 kHz WAV with -af "aresample=async=1:first_pts=0" before running Scribe v2.

### How much does keyterm boosting cost on ElevenLabs Scribe v2?

Standard Scribe v2 on fal.ai costs $0.008 per input audio minute, and enabling keyterms adds a 30% surcharge ($0.0104/min—still roughly 96 minutes per $1.00 and nearly 3× cheaper than legacy Scribe v1 at $0.03/min).

### What is the ideal character limit per caption line for YouTube vs. TikTok/Reels?

For horizontal 16:9 YouTube SRTs, target 36–42 characters per line (maximum 2 lines). For vertical 9:16 Reels/TikTok/Shorts burn-in ASS captions, use punchy 2–4 word chunks (14–22 characters) centered inside the middle safe zone.

### Should I set tag_audio_events to true or false for Reels captions?

Set tag_audio_events: false for stylized social karaoke captions so "(laughter)" or "(music)" tokens do not break fast word highlighting; set tag_audio_events: true for full YouTube accessibility (SDH) subtitle tracks.
