hyperframes 0.2.2-alpha.4 → 0.2.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7926 -7426
- package/dist/skills/gsap/SKILL.md +222 -0
- package/dist/skills/gsap/references/effects.md +304 -0
- package/dist/skills/gsap/references/frameworks.md +56 -0
- package/dist/skills/gsap/references/plugins.md +194 -0
- package/dist/skills/gsap/references/react.md +80 -0
- package/dist/skills/gsap/references/scrolltrigger.md +147 -0
- package/dist/skills/gsap/references/utils.md +91 -0
- package/dist/skills/gsap/scripts/extract-audio-data.py +188 -0
- package/dist/skills/{hyperframes-compose → hyperframes}/SKILL.md +43 -43
- package/dist/skills/hyperframes/references/audio-reactive.md +76 -0
- package/dist/skills/hyperframes/references/captions.md +132 -0
- package/dist/skills/hyperframes/references/css-patterns.md +371 -0
- package/dist/skills/hyperframes/references/examples.md +146 -0
- package/dist/skills/hyperframes/references/marker-highlight.md +158 -0
- package/dist/skills/hyperframes/references/transitions/catalog.md +132 -0
- package/dist/skills/hyperframes/references/transitions/css-3d.md +12 -0
- package/dist/skills/hyperframes/references/transitions/css-blur.md +51 -0
- package/dist/skills/hyperframes/references/transitions/css-cover.md +43 -0
- package/dist/skills/hyperframes/references/transitions/css-destruction.md +95 -0
- package/dist/skills/hyperframes/references/transitions/css-dissolve.md +66 -0
- package/dist/skills/hyperframes/references/transitions/css-distortion.md +45 -0
- package/dist/skills/hyperframes/references/transitions/css-grid.md +10 -0
- package/dist/skills/hyperframes/references/transitions/css-light.md +49 -0
- package/dist/skills/hyperframes/references/transitions/css-mechanical.md +30 -0
- package/dist/skills/hyperframes/references/transitions/css-other.md +36 -0
- package/dist/skills/hyperframes/references/transitions/css-push.md +41 -0
- package/dist/skills/hyperframes/references/transitions/css-radial.md +37 -0
- package/dist/skills/hyperframes/references/transitions/css-scale.md +24 -0
- package/dist/skills/hyperframes/references/transitions/shader-setup.md +463 -0
- package/dist/skills/hyperframes/references/transitions/shader-transitions.md +329 -0
- package/dist/skills/hyperframes/references/transitions.md +96 -0
- package/dist/skills/hyperframes/references/tts.md +56 -0
- package/dist/skills/hyperframes-cli/SKILL.md +114 -0
- package/dist/templates/_shared/CLAUDE.md +5 -7
- package/dist/templates/blank/index.html +8 -10
- package/package.json +2 -4
- package/dist/skills/hyperframes-captions/SKILL.md +0 -212
- package/dist/skills/hyperframes-tts/SKILL.md +0 -79
- package/dist/templates/blank/compositions/captions.html +0 -95
- /package/dist/skills/{hyperframes-compose → hyperframes}/data-in-motion.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/house-style.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/bold-energetic.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/clean-corporate.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/dark-premium.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/jewel-rich.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/monochrome.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/nature-earth.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/neon-electric.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/pastel-soft.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/warm-editorial.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/patterns.md +0 -0
- /package/dist/skills/{hyperframes-captions → hyperframes/references}/dynamic-techniques.md +0 -0
- /package/dist/skills/{hyperframes-captions → hyperframes/references}/transcript-guide.md +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperframes",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3-alpha.1",
|
|
4
4
|
"description": "HyperFrames CLI — create, preview, and render HTML video compositions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
"build:fonts": "cd ../producer && tsx scripts/generate-font-data.ts",
|
|
22
22
|
"build:studio": "cd ../studio && bun run build",
|
|
23
23
|
"build:runtime": "tsx scripts/build-runtime.ts",
|
|
24
|
-
"build:copy": "mkdir -p dist/studio dist/docs dist/templates dist/skills && cp -r ../studio/dist/* dist/studio/ && cp -r src/templates/blank src/templates/_shared dist/templates/ && cp -r ../../skills/hyperframes
|
|
24
|
+
"build:copy": "mkdir -p dist/studio dist/docs dist/templates dist/skills && cp -r ../studio/dist/* dist/studio/ && cp -r src/templates/blank src/templates/_shared dist/templates/ && cp -r ../../skills/hyperframes ../../skills/hyperframes-cli ../../skills/gsap dist/skills/ && (cp src/docs/*.md dist/docs/ 2>/dev/null || true)",
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hono/node-server": "^1.8.0",
|
|
29
29
|
"@puppeteer/browsers": "^2.13.0",
|
|
30
30
|
"adm-zip": "^0.5.16",
|
|
31
|
-
"cheerio": "^1.2.0",
|
|
32
31
|
"citty": "^0.2.1",
|
|
33
32
|
"compare-versions": "^6.1.1",
|
|
34
33
|
"esbuild": "^0.25.0",
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"@types/mime-types": "^3.0.1",
|
|
50
49
|
"@types/node": "^22.0.0",
|
|
51
50
|
"adm-zip": "^0.5.16",
|
|
52
|
-
"cheerio": "^1.2.0",
|
|
53
51
|
"hono": "^4.0.0",
|
|
54
52
|
"linkedom": "^0.18.12",
|
|
55
53
|
"mime-types": "^3.0.2",
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hyperframes-captions
|
|
3
|
-
description: Captions, subtitles, lyrics, and karaoke synced to audio in HyperFrames. Tone-adaptive — detects script energy and applies matching typography, color, and animation with per-word styling.
|
|
4
|
-
trigger: Syncing text to audio timing — captions, subtitles, lyrics, karaoke, transcription overlays, word-level or phrase-level text timed to speech or music.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Captions
|
|
8
|
-
|
|
9
|
-
## Language Rule (Non-Negotiable)
|
|
10
|
-
|
|
11
|
-
**Never use `.en` models unless the user explicitly states the audio is English.** `.en` models (small.en, medium.en) TRANSLATE non-English audio into English instead of transcribing it. This silently destroys the original language.
|
|
12
|
-
|
|
13
|
-
When transcribing:
|
|
14
|
-
|
|
15
|
-
1. If the user says the language → use `--model small --language <code>` (no `.en` suffix)
|
|
16
|
-
2. If the user says it's English → use `--model small.en`
|
|
17
|
-
3. If the language is unknown → use `--model small` (no `.en`, no `--language`) — whisper auto-detects
|
|
18
|
-
|
|
19
|
-
**Default model is `small` (not `small.en`).** Only add `.en` when explicitly told the audio is English.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
Analyze the spoken content to determine caption style. If the user specifies a style, use that. Otherwise, detect tone from the transcript.
|
|
24
|
-
|
|
25
|
-
## Transcript Source
|
|
26
|
-
|
|
27
|
-
The project's `transcript.json` contains a normalized word array with word-level timestamps:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
[
|
|
31
|
-
{ "text": "Hello", "start": 0.0, "end": 0.5 },
|
|
32
|
-
{ "text": "world.", "start": 0.6, "end": 1.2 }
|
|
33
|
-
]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This is the only format the captions composition consumes. Use it directly:
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const words = JSON.parse(transcriptJson); // [{ text, start, end }]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
For transcription commands, whisper model selection, external APIs (OpenAI, Groq), and supported input formats, see [transcript-guide.md](./transcript-guide.md).
|
|
43
|
-
|
|
44
|
-
## Style Detection (Default — When No Style Is Specified)
|
|
45
|
-
|
|
46
|
-
Read the full transcript before choosing a style. The style comes from the content, not a template.
|
|
47
|
-
|
|
48
|
-
### Four Dimensions
|
|
49
|
-
|
|
50
|
-
**1. Visual feel** — the overall aesthetic personality:
|
|
51
|
-
|
|
52
|
-
- Corporate/professional scripts → clean, minimal, restrained
|
|
53
|
-
- Energetic/marketing scripts → bold, punchy, high-impact
|
|
54
|
-
- Storytelling/narrative scripts → elegant, warm, cinematic
|
|
55
|
-
- Technical/educational scripts → precise, high-contrast, structured
|
|
56
|
-
- Social media/casual scripts → playful, dynamic, friendly
|
|
57
|
-
|
|
58
|
-
**2. Color palette** — driven by the content's mood:
|
|
59
|
-
|
|
60
|
-
- Dark backgrounds with bright accents for high energy
|
|
61
|
-
- Muted/neutral tones for professional or calm content
|
|
62
|
-
- High contrast (white on black, black on white) for clarity
|
|
63
|
-
- One accent color for emphasis — not multiple
|
|
64
|
-
|
|
65
|
-
**3. Font mood** — typography character, not specific font names:
|
|
66
|
-
|
|
67
|
-
- Heavy/condensed for impact and energy
|
|
68
|
-
- Clean sans-serif for modern and professional
|
|
69
|
-
- Rounded for friendly and approachable
|
|
70
|
-
- Serif for elegance and storytelling
|
|
71
|
-
|
|
72
|
-
**4. Animation character** — how words enter and exit:
|
|
73
|
-
|
|
74
|
-
- Scale-pop/slam for punchy energy
|
|
75
|
-
- Gentle fade/slide for calm or professional
|
|
76
|
-
- Word-by-word reveal for emphasis
|
|
77
|
-
- Typewriter for technical or narrative pacing
|
|
78
|
-
|
|
79
|
-
## Per-Word Styling
|
|
80
|
-
|
|
81
|
-
Scan the script for words that deserve distinct visual treatment. Not every word is equal — some carry the message.
|
|
82
|
-
|
|
83
|
-
### What to Detect
|
|
84
|
-
|
|
85
|
-
- **Brand names / product names** — larger size, unique color, distinct entrance
|
|
86
|
-
- **ALL CAPS words** — the author emphasized them intentionally. Scale boost, flash, or accent color.
|
|
87
|
-
- **Numbers / statistics** — bold weight, accent color. Numbers are the payload in data-driven content.
|
|
88
|
-
- **Emotional keywords** — "incredible", "insane", "amazing", "revolutionary" → exaggerated animation (overshoot, bounce)
|
|
89
|
-
- **Proper nouns** — names of people, places, events → distinct accent or italic
|
|
90
|
-
- **Call-to-action phrases** — "sign up", "get started", "try it now" → highlight, underline, or color pop
|
|
91
|
-
|
|
92
|
-
### How to Apply
|
|
93
|
-
|
|
94
|
-
For each detected word, specify:
|
|
95
|
-
|
|
96
|
-
- Font size multiplier (e.g., 1.3x for emphasis, 1.5x for hero moments)
|
|
97
|
-
- Color override (specific hex value)
|
|
98
|
-
- Weight/style change (bolder, italic)
|
|
99
|
-
- Animation variant (overshoot entrance, glow pulse, scale pop)
|
|
100
|
-
- **Marker highlight mode** — for visual emphasis beyond color/scale, add a marker-style effect: highlight sweep behind the word, hand-drawn circle around it, burst lines radiating from it, or scribble underline beneath it. See the `/marker-highlight` skill for patterns and the energy-to-mode mapping table.
|
|
101
|
-
|
|
102
|
-
## Script-to-Style Mapping
|
|
103
|
-
|
|
104
|
-
| Script tone | Font mood | Animation | Color | Size |
|
|
105
|
-
| -------------------- | ------------------------------------- | --------------------------------------- | -------------------------------------------- | -------------------- |
|
|
106
|
-
| Hype/launch | Heavy condensed, 800-900 weight | Scale-pop, back.out(1.7), fast 0.1-0.2s | Bright accent on dark (cyan, yellow, lime) | Large 72-96px |
|
|
107
|
-
| Corporate/pitch | Clean sans-serif, 600-700 weight | Fade + slide-up, power3.out, 0.3s | White/neutral on dark, single muted accent | Medium 56-72px |
|
|
108
|
-
| Tutorial/educational | Mono or clean sans, 500-600 weight | Typewriter or gentle fade, 0.4-0.5s | High contrast, minimal color | Medium 48-64px |
|
|
109
|
-
| Storytelling/brand | Serif or elegant sans, 400-500 weight | Slow fade, power2.out, 0.5-0.6s | Warm muted tones, low opacity (0.85-0.9) | Smaller 44-56px |
|
|
110
|
-
| Social/casual | Rounded sans, 700-800 weight | Bounce, elastic.out, word-by-word | Playful colors, colored backgrounds on pills | Medium-large 56-80px |
|
|
111
|
-
|
|
112
|
-
## Word Grouping by Tone
|
|
113
|
-
|
|
114
|
-
Group size affects pacing. Fast content needs fast caption turnover.
|
|
115
|
-
|
|
116
|
-
- **High energy:** 2-3 words per group. Quick turnover matches rapid delivery.
|
|
117
|
-
- **Conversational:** 3-5 words per group. Natural phrase length.
|
|
118
|
-
- **Measured/calm:** 4-6 words per group. Longer groups match slower pace.
|
|
119
|
-
|
|
120
|
-
Break groups on sentence boundaries (period, question mark, exclamation), pauses (150ms+ gap), or max word count — whichever comes first.
|
|
121
|
-
|
|
122
|
-
## Positioning
|
|
123
|
-
|
|
124
|
-
- **Landscape (1920x1080):** Bottom 80-120px, centered
|
|
125
|
-
- **Portrait (1080x1920):** Lower middle ~600-700px from bottom, centered
|
|
126
|
-
- Never cover the subject's face
|
|
127
|
-
- Use `position: absolute` — never relative (causes overflow)
|
|
128
|
-
- One caption group visible at a time
|
|
129
|
-
|
|
130
|
-
## Text Overflow Prevention
|
|
131
|
-
|
|
132
|
-
Use `window.__hyperframes.fitTextFontSize()` to measure actual rendered text width and compute the correct font size. This replaces character-count heuristics with pixel-accurate measurement powered by [pretext](https://github.com/chenglou/pretext).
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
GROUPS.forEach(function (group, gi) {
|
|
136
|
-
var result = window.__hyperframes.fitTextFontSize(group.text.toUpperCase(), {
|
|
137
|
-
fontFamily: "Outfit",
|
|
138
|
-
fontWeight: 900,
|
|
139
|
-
maxWidth: 1600,
|
|
140
|
-
});
|
|
141
|
-
wordEls.forEach(function (el) {
|
|
142
|
-
el.style.fontSize = result.fontSize + "px";
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
| Option | Default | Description |
|
|
148
|
-
| -------------- | ---------- | ---------------------------------------------------- |
|
|
149
|
-
| `maxWidth` | `1600` | Container width in px (1600 landscape, 900 portrait) |
|
|
150
|
-
| `baseFontSize` | `78` | Starting font size — used when text fits |
|
|
151
|
-
| `minFontSize` | `42` | Floor — never shrink below this |
|
|
152
|
-
| `fontWeight` | `900` | Must match the CSS font-weight |
|
|
153
|
-
| `fontFamily` | `"Outfit"` | Must match the CSS font-family |
|
|
154
|
-
| `step` | `2` | Decrement step in px per iteration |
|
|
155
|
-
|
|
156
|
-
`fontWeight` and `fontFamily` must match the CSS applied to the text elements exactly, or measurements will be inaccurate.
|
|
157
|
-
|
|
158
|
-
**Safety nets (still required in CSS):**
|
|
159
|
-
|
|
160
|
-
- `max-width: 1600px` (landscape) or `max-width: 900px` (portrait) on caption container
|
|
161
|
-
- `overflow: hidden` as a fallback for `fits: false` edge cases
|
|
162
|
-
- `position: absolute` on all caption elements
|
|
163
|
-
- Explicit `height` on caption container (e.g., `200px`)
|
|
164
|
-
|
|
165
|
-
## Caption Exit Guarantee
|
|
166
|
-
|
|
167
|
-
Captions that stick on screen are the most common caption bug. Every caption group **must** have a hard kill after its exit animation.
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
// Animate exit (soft — can fail if tweens conflict)
|
|
171
|
-
tl.to(groupEl, { opacity: 0, scale: 0.95, duration: 0.12, ease: "power2.in" }, group.end - 0.12);
|
|
172
|
-
|
|
173
|
-
// Hard kill at group.end (deterministic — guarantees invisible)
|
|
174
|
-
tl.set(groupEl, { opacity: 0, visibility: "hidden" }, group.end);
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Why both?** The `tl.to` exit can fail to fully hide a group when karaoke word-level tweens conflict with the parent exit tween, `fromTo` entrance tweens lock values that override later tweens, or timeline scrubbing lands between the exit start and end. The `tl.set` at `group.end` is a deterministic kill — it fires at an exact time, doesn't animate, and can't be overridden.
|
|
178
|
-
|
|
179
|
-
**Self-lint rule:** After building the timeline, verify every caption group has a hard kill:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
GROUPS.forEach(function (group, gi) {
|
|
183
|
-
var el = document.getElementById("cg-" + gi);
|
|
184
|
-
if (!el) return;
|
|
185
|
-
tl.seek(group.end + 0.01);
|
|
186
|
-
var computed = window.getComputedStyle(el);
|
|
187
|
-
if (computed.opacity !== "0" && computed.visibility !== "hidden") {
|
|
188
|
-
console.warn(
|
|
189
|
-
"[caption-lint] group " + gi + " still visible at t=" + (group.end + 0.01).toFixed(2) + "s",
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
tl.seek(0);
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Place this **before** `window.__timelines[id] = tl` so it runs at composition init.
|
|
197
|
-
|
|
198
|
-
## References
|
|
199
|
-
|
|
200
|
-
For dynamic animation techniques (karaoke, clip-path reveals, slam words, scatter exits, elastic entrances, 3D rotation, audio-reactive captions, pretext-based positioning and grouping), see [dynamic-techniques.md](./dynamic-techniques.md).
|
|
201
|
-
|
|
202
|
-
For animated text emphasis (highlight sweeps, hand-drawn circles, burst lines, scribble underlines, sketchout effects) that pairs with per-word styling, see the `/marker-highlight` skill.
|
|
203
|
-
|
|
204
|
-
For transcription commands, whisper models, external APIs, and troubleshooting, see [transcript-guide.md](./transcript-guide.md).
|
|
205
|
-
|
|
206
|
-
## Constraints
|
|
207
|
-
|
|
208
|
-
- **Deterministic.** No `Math.random()`, no `Date.now()`.
|
|
209
|
-
- **Sync to transcript timestamps.** Words appear when spoken.
|
|
210
|
-
- **One group visible at a time.** No overlapping caption groups.
|
|
211
|
-
- **Every caption group must have a hard `tl.set` kill at `group.end`.** Exit animations alone are not sufficient.
|
|
212
|
-
- **Check project root** for font files before defaulting to Google Fonts.
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hyperframes-tts
|
|
3
|
-
description: Generate speech audio locally using Kokoro-82M (no API key). Use when asked to create narration, voiceover, or text-to-speech audio for compositions, or when a user needs spoken audio from text. Covers voice selection, speed tuning, and integrating TTS output with compositions and captions.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Text-to-Speech
|
|
7
|
-
|
|
8
|
-
## Voice Selection
|
|
9
|
-
|
|
10
|
-
Match voice to content. Default is `af_heart`.
|
|
11
|
-
|
|
12
|
-
| Content type | Voice | Why |
|
|
13
|
-
| ----------------- | --------------------- | ----------------------------- |
|
|
14
|
-
| Product demo | `af_heart`/`af_nova` | Warm, professional |
|
|
15
|
-
| Tutorial / how-to | `am_adam`/`bf_emma` | Neutral, easy to follow |
|
|
16
|
-
| Marketing / promo | `af_sky`/`am_michael` | Energetic or authoritative |
|
|
17
|
-
| Documentation | `bf_emma`/`bm_george` | Clear British English, formal |
|
|
18
|
-
| Casual / social | `af_heart`/`af_sky` | Approachable, natural |
|
|
19
|
-
|
|
20
|
-
Run `npx hyperframes tts --list` for all 54 voices (8 languages: EN, JP, ZH, KO, FR, DE, IT, PT).
|
|
21
|
-
|
|
22
|
-
## Speed Tuning
|
|
23
|
-
|
|
24
|
-
- **0.7-0.8** — Tutorial, complex content, accessibility
|
|
25
|
-
- **1.0** — Natural pace (default)
|
|
26
|
-
- **1.1-1.2** — Intros, transitions, upbeat content
|
|
27
|
-
- **1.5+** — Rarely appropriate; test carefully
|
|
28
|
-
|
|
29
|
-
## Composing with TTS Audio
|
|
30
|
-
|
|
31
|
-
Generate a voiceover and use it as the audio track:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx hyperframes tts "Your script here" --voice af_nova --output narration.wav
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then reference it in the composition as a standard `<audio>` element:
|
|
38
|
-
|
|
39
|
-
```html
|
|
40
|
-
<audio
|
|
41
|
-
id="narration"
|
|
42
|
-
data-start="0"
|
|
43
|
-
data-duration="auto"
|
|
44
|
-
data-track-index="2"
|
|
45
|
-
src="narration.wav"
|
|
46
|
-
data-volume="1"
|
|
47
|
-
></audio>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## TTS + Captions Workflow
|
|
51
|
-
|
|
52
|
-
Generate speech, then transcribe it back for word-level caption timestamps:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
# 1. Generate speech
|
|
56
|
-
npx hyperframes tts script.txt --voice af_heart --output narration.wav
|
|
57
|
-
|
|
58
|
-
# 2. Transcribe for word-level timestamps
|
|
59
|
-
npx hyperframes transcribe narration.wav
|
|
60
|
-
|
|
61
|
-
# 3. Result: narration.wav + transcript.json ready for captions
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This avoids manually timing captions — whisper extracts precise word boundaries from the generated audio.
|
|
65
|
-
|
|
66
|
-
## Long Scripts
|
|
67
|
-
|
|
68
|
-
For scripts longer than a few paragraphs, write the text to a `.txt` file and pass the path:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npx hyperframes tts script.txt --voice bf_emma --output narration.wav
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The model handles long text well but very long inputs (>5 minutes of speech) may benefit from splitting into segments.
|
|
75
|
-
|
|
76
|
-
## Requirements
|
|
77
|
-
|
|
78
|
-
- Python 3.8+ with `kokoro-onnx` and `soundfile` installed (`pip install kokoro-onnx soundfile`)
|
|
79
|
-
- Model downloads automatically on first use (~311 MB + ~27 MB voices, cached in `~/.cache/hyperframes/tts/`)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<template id="captions-template">
|
|
2
|
-
<div
|
|
3
|
-
data-composition-id="captions"
|
|
4
|
-
data-width="1920"
|
|
5
|
-
data-height="1080"
|
|
6
|
-
data-duration="__VIDEO_DURATION__"
|
|
7
|
-
>
|
|
8
|
-
<div id="captions-container"></div>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
[data-composition-id="captions"] {
|
|
12
|
-
width: 1920px;
|
|
13
|
-
height: 1080px;
|
|
14
|
-
pointer-events: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
[data-composition-id="captions"] #captions-container {
|
|
18
|
-
position: absolute;
|
|
19
|
-
bottom: 100px;
|
|
20
|
-
left: 50%;
|
|
21
|
-
transform: translateX(-50%);
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 150px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.caption-group {
|
|
30
|
-
position: absolute;
|
|
31
|
-
opacity: 0;
|
|
32
|
-
font-family: "Inter", sans-serif;
|
|
33
|
-
font-size: 48px;
|
|
34
|
-
font-weight: 700;
|
|
35
|
-
color: #ffffff;
|
|
36
|
-
text-shadow:
|
|
37
|
-
0 2px 8px rgba(0, 0, 0, 0.8),
|
|
38
|
-
0 0 2px rgba(0, 0, 0, 0.9);
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
max-width: 1600px;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
44
|
-
|
|
45
|
-
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
46
|
-
<script>
|
|
47
|
-
(function () {
|
|
48
|
-
window.__timelines = window.__timelines || {};
|
|
49
|
-
const tl = gsap.timeline({ paused: true });
|
|
50
|
-
|
|
51
|
-
const script = [];
|
|
52
|
-
|
|
53
|
-
if (script.length === 0) {
|
|
54
|
-
window.__timelines["captions"] = tl;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const container = document.getElementById("captions-container");
|
|
59
|
-
|
|
60
|
-
// Group words into lines (max 5 words per line)
|
|
61
|
-
const lines = [];
|
|
62
|
-
for (let i = 0; i < script.length; i += 5) {
|
|
63
|
-
const lineWords = script.slice(i, i + 5);
|
|
64
|
-
lines.push({
|
|
65
|
-
text: lineWords.map((w) => w.text).join(" "),
|
|
66
|
-
start: lineWords[0].start,
|
|
67
|
-
end: lineWords[lineWords.length - 1].end,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
lines.forEach((line, index) => {
|
|
72
|
-
const el = document.createElement("div");
|
|
73
|
-
el.className = "caption-group";
|
|
74
|
-
el.textContent = line.text;
|
|
75
|
-
container.appendChild(el);
|
|
76
|
-
|
|
77
|
-
tl.fromTo(
|
|
78
|
-
el,
|
|
79
|
-
{ opacity: 0, y: 20 },
|
|
80
|
-
{ opacity: 1, y: 0, duration: 0.3, ease: "power3.out" },
|
|
81
|
-
line.start,
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const hideTime =
|
|
85
|
-
index < lines.length - 1 ? Math.min(line.end, lines[index + 1].start) : line.end;
|
|
86
|
-
|
|
87
|
-
tl.to(el, { opacity: 0, y: -10, duration: 0.25, ease: "power2.in" }, hideTime - 0.25);
|
|
88
|
-
tl.set(el, { opacity: 0, visibility: "hidden" }, hideTime);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
window.__timelines["captions"] = tl;
|
|
92
|
-
})();
|
|
93
|
-
</script>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|