Drive Google Flow from Claude, Codex or a local control panel, on Mac or Windows — using your Google AI subscription credits instead of the pay-per-use video API. No browser extension.
Captions: choose normal, CAPS or lowercase letters for any style
GTAI-19e0afb2d1838
diff --git a/CLAUDE.md b/CLAUDE.mdindex d65cdd4..d7e8474 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -456,3 +456,8 @@ The preview tool could not read the project while it lived in ~/Desktop; check twith no word margin it swallowed the space beside it ("EVERYTHINGAFTER"), so words carry a .07em margin.First Ascent's finished film survived the Trash only because it was published in an artifact (film.mp4); it is backat ~/flow-mcp-out/Ascent/ascent-1080.mp4.+- Caption letters (2026-10-09): `letters` as_said | capitals | lowercase, per style in the panel (Bold pop defaults+ to capitals, the rest to as_said). It is a CSS text-transform on the drawn captions only; the .srt keeps the words as+ heard. capitals and lowercase drop trailing commas and full stops (? and ! stay), the short-form convention; capitals+ in a non-bold font take 1.2x the line width, lowercase in Arial Black 0.85x. Panel labels are "Normal / CAPS /+ lower" because "CAPITALS" and "lowercase" were cut off at 375 px wide.diff --git a/OVERVIEW.md b/OVERVIEW.mdindex 75bb586..54e4829 100644--- a/OVERVIEW.md+++ b/OVERVIEW.md@@ -106,7 +106,7 @@ This is a limit in Flow itself, not something we can program around. The exact j|---|---|| **Voiceover Recorder** | Narration for free, at any length. Either Google AI Studio's text-to-speech (the same voices Flow has, and you can tell it *how* to read the line; keep that note short) or a voice already on your computer (macOS voices on a Mac, Windows' own voices on a PC) || **Voice List** | Every narrator available to you |-| **Captions** | Puts the spoken words on screen, the way short-form videos do, on wide or vertical videos. Your computer listens to the video with whisper.cpp, a free speech-to-text program, and times every word itself; nothing is uploaded. Five styles: big capitals where the word being said lights up, a coloured block behind the word being said, words appearing as they're said, classic subtitles, and white words on a dark band. Also writes a subtitle file for YouTube |+| **Captions** | Puts the spoken words on screen, the way short-form videos do, on wide or vertical videos. Your computer listens to the video with whisper.cpp, a free speech-to-text program, and times every word itself; nothing is uploaded. Five styles: big capitals where the word being said lights up, a coloured block behind the word being said, words appearing as they're said, classic subtitles, and white words on a dark band. Each can use normal letters, ALL CAPITALS or all lowercase. Also writes a subtitle file for YouTube || **Film Cutter** | Joins clips into one film using FFmpeg, a free video toolkit: the clips you made, or any video you pick, in the order you choose. Lays the narration on top, adds a looping music bed, and lets you turn the clips' own sound down so it doesn't drown out the voice. Sizes everything to match your best clip, and can hold the last frame if the voice runs longer than the footage |---@@ -124,7 +124,7 @@ Eight tabs, in the order you'd use them:4. **Voice**: record the narration, free. Your saved narrations are listed here, so you can play them back or delete the ones you don't want. This is also where you paste your free Google AI Studio key. It's checked with Google and saved only on your computer, so you never have to put it in a chat5. **Restyle**: change a clip you already have6. **Cut**: join everything into a finished film. Pick the videos you want, in order (ones you made, or any video you upload), then add a narration and music, and turn the clips' own sound down so the voice sits on top-7. **Captions**: put the words on screen. Pick a video and a style, choose where the words sit (bottom, middle, top, or tap the preview to put them exactly where you want), how big they are and the highlight colour, and you see the result on a real frame of your video before making it. If the computer misheard a word, fix it in the text and the timing stays right; press Enter wherever you want a new caption to start. The first time, it asks for a free speech model (one click, 148 MB)+7. **Captions**: put the words on screen. Pick a video and a style, choose where the words sit (bottom, middle, top, or tap the preview to put them exactly where you want), how big they are, normal, capital or lowercase letters, and the highlight colour, and you see the result on a real frame of your video before making it. If the computer misheard a word, fix it in the text and the timing stays right; press Enter wherever you want a new caption to start. The first time, it asks for a free speech model (one click, 148 MB)8. **Library**: browse what Flow is holding, pull it back for free, or move things to Flow's TrashProgress and a gallery of your saved work sit alongside. The gallery shows stills or clips on the tabs where you'd use them, and on a wide screen each side scrolls on its own.diff --git a/README.md b/README.mdindex 8cf10bb..0d2e051 100644--- a/README.md+++ b/README.md@@ -159,9 +159,9 @@ Eight tabs, in the order you would use them:sound down so the narration sits on top.- **Captions**: put the spoken words on screen, the way short-form videos do, on wide or vertical videos.Pick a video, choose a style (Bold pop, Highlight, Word by word, Clean, Boxed), where it sits (bottom,- middle, top, an exact height, or tap the preview), its size and highlight colour, and see it on a real- frame of your video before anything is made. Fix any misheard word in the text box and it keeps its- timing; press Enter to start a new caption. Saves `<name>-captions.mp4` plus an `.srt` for YouTube.+ middle, top, an exact height, or tap the preview), its size, its letters (normal, CAPS or lowercase) and+ highlight colour, and see it on a real frame of your video before anything is made. Fix any misheard+ word in the text box and it keeps its timing; press Enter to start a new caption. Saves `<name>-captions.mp4` plus an `.srt` for YouTube.Everything happens on your computer; nothing is uploaded.- **Library**: everything in your Flow project. Download it again for free (a scene comes down as onefinished film, not loose clips), or move it to Flow's Trash.@@ -203,7 +203,7 @@ agree on what is running. That API listens on 127.0.0.1 only and needs a per-run| `flow_techniques` | 39 film-technique prompt presets (camera moves, product shots, transitions, image commands); pass an id as a scene's `technique` || `flow_narrate` | Free narration audio, any length: `gemini` (Google AI Studio text-to-speech, with the same voices Flow has, plus a `style` note) or `mac` (a voice installed on this computer, no key needed) || `flow_voices` | Narrator voices available, and whether a Google key is set up |-| `flow_captions` | Burn spoken-word captions into any video, landscape or vertical, in one of five styles, at any height; returns the transcript so a misheard word can be fixed and the call repeated (local whisper.cpp, Chrome and FFmpeg, no credits) |+| `flow_captions` | Burn spoken-word captions into any video, landscape or vertical, in one of five styles, at any height, in normal, capital or lowercase letters; returns the transcript so a misheard word can be fixed and the call repeated (local whisper.cpp, Chrome and FFmpeg, no credits) || `flow_assemble` | Join clips into one MP4 (a project's clips, or any you list, in order) with optional music and voiceover, and separate volume for the clips' own sound (local FFmpeg, no credits) |**Continuity between shots:** `chain_previous` (this clip starts on the last frame of the previousdiff --git a/src/captions.ts b/src/captions.tsindex e16f4dd..ef6fc7a 100644--- a/src/captions.ts+++ b/src/captions.ts@@ -43,26 +43,32 @@ export interface Transcript {}export const CAPTION_STYLES = {- bold: { label: "Bold pop", blurb: "Big capitals, a few words at a time; the word being said lights up", maxWords: 3, highlight: true, pop: true, color: "#FFE135" },- highlight: { label: "Highlight", blurb: "The word being said sits on a coloured block", maxWords: 4, highlight: true, pop: false, color: "#7C3AED" },- reveal: { label: "Word by word", blurb: "Each word appears the moment it is said", maxWords: 5, highlight: true, pop: false, color: "#FFFFFF" },- clean: { label: "Clean", blurb: "Classic subtitles: easy to read, nothing moves", maxWords: 8, highlight: false, pop: false, color: "#FFFFFF" },- boxed: { label: "Boxed", blurb: "White words on a dark band, readable over anything", maxWords: 7, highlight: false, pop: false, color: "#FFFFFF" },+ bold: { label: "Bold pop", blurb: "Big capitals, a few words at a time; the word being said lights up", maxWords: 3, highlight: true, pop: true, color: "#FFE135", letters: "capitals" },+ highlight: { label: "Highlight", blurb: "The word being said sits on a coloured block", maxWords: 4, highlight: true, pop: false, color: "#7C3AED", letters: "as_said" },+ reveal: { label: "Word by word", blurb: "Each word appears the moment it is said", maxWords: 5, highlight: true, pop: false, color: "#FFFFFF", letters: "as_said" },+ clean: { label: "Clean", blurb: "Classic subtitles: easy to read, nothing moves", maxWords: 8, highlight: false, pop: false, color: "#FFFFFF", letters: "as_said" },+ boxed: { label: "Boxed", blurb: "White words on a dark band, readable over anything", maxWords: 7, highlight: false, pop: false, color: "#FFFFFF", letters: "as_said" },} as const;export type CaptionStyle = keyof typeof CAPTION_STYLES;// A preset, or how far down the frame the middle of the caption sits: 0 = top edge, 100 = bottom edge.export type CaptionPosition = "bottom" | "middle" | "top" | number;export type CaptionSize = "small" | "medium" | "large";+// as_said keeps whisper's own capitals (sentence starts, names); capitals and lowercase are looks, and both drop+// trailing commas and full stops the way short-form captions do.+export type CaptionLetters = "as_said" | "capitals" | "lowercase";export interface CaptionOptions {style: CaptionStyle;position: CaptionPosition;size: CaptionSize;color?: string;+ letters?: CaptionLetters;text?: string;language?: string;}+const lettersOf = (o: { style: CaptionStyle; letters?: CaptionLetters }): CaptionLetters => o.letters ?? CAPTION_STYLES[o.style].letters;+// Letter size as a share of the frame's short side, so a 9:16 phone video and a 16:9 landscape one read the same.const FONT = { bold: 7.2, highlight: 6.2, reveal: 6.4, clean: 4.6, boxed: 4.6 };const CHAR_EM = { bold: 0.74, highlight: 0.56, reveal: 0.56, clean: 0.52, boxed: 0.52 };@@ -314,13 +320,15 @@ function paginate(words: Word[], maxWords: number, maxChars: number): Word[][] {return pages;}-function layout(words: Word[], style: CaptionStyle, width: number, height: number, size: CaptionSize): { pages: Word[][]; states: State[] } {+function layout(words: Word[], style: CaptionStyle, width: number, height: number, size: CaptionSize, letters: CaptionLetters): { pages: Word[][]; states: State[] } {const s = CAPTION_STYLES[style];const u = (Math.min(width, height) / 100) * SIZE[size];- const perLine = Math.max(8, Math.floor(boxWidth(style, width, height) / (FONT[style] * u * CHAR_EM[style])));+ // Capitals are wider than small letters, so fewer of them fit on a line.+ const wide = CHAR_EM[style] * (letters === "capitals" && style !== "bold" ? 1.2 : letters !== "capitals" && style === "bold" ? 0.85 : 1);+ const perLine = Math.max(8, Math.floor(boxWidth(style, width, height) / (FONT[style] * u * wide)));const pages = paginate(words, s.maxWords, perLine * 2);- // Bold capitals read better without commas and full stops; question and exclamation marks stay.- const shown = (t: string) => (style === "bold" ? t.replace(/[.,;:]+$/, "") : t);+ // Capitals and lowercase read better without commas and full stops; question and exclamation marks stay.+ const shown = (t: string) => (letters === "as_said" ? t : t.replace(/[.,;:]+$/, ""));const states: State[] = [];let clock = 0;const push = (st: State) => {@@ -364,7 +372,7 @@ function textOn(hex: string): string {return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.6 ? "#111111" : "#FFFFFF";}-function pageHtml(style: CaptionStyle, o: { width: number; height: number; position: CaptionPosition; size: CaptionSize; color: string; background?: string }): string {+function pageHtml(style: CaptionStyle, o: { width: number; height: number; position: CaptionPosition; size: CaptionSize; color: string; letters: CaptionLetters; background?: string }): string {const { width: W, height: H } = o;const vertical = H > W;const font = FONT[style] * (Math.min(W, H) / 100) * SIZE[o.size];@@ -393,6 +401,7 @@ html,body{margin:0;width:${W}px;height:${H}px;overflow:hidden;background:${o.bac.cap{position:absolute;left:50%;width:${boxWidth(style, W, H)}px;text-align:center;text-wrap:balance;--hl:${o.color};--on:${textOn(o.color)};${place};-webkit-font-smoothing:antialiased}.inner{display:block;transform-origin:50% 60%}${css}+.cap{text-transform:${{ as_said: "none", capitals: "uppercase", lowercase: "lowercase" }[o.letters]}}</style></head><body><div class="cap"><div class="inner" id="inner"></div></div><script>const esc = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);window.paint = (s) => {@@ -456,7 +465,7 @@ async function timedWords(video: string, o: CaptionOptions): Promise<{ transcripexport async function previewCaptions(video: string, o: CaptionOptions): Promise<{ image: string; at: number }> {const info = await probe(video);const { words } = await timedWords(video, o);- const { pages, states } = layout(words, o.style, info.width, info.height, o.size);+ const { pages, states } = layout(words, o.style, info.width, info.height, o.size, lettersOf(o));// A caption of a few words, about a third of the way in, mid-sentence.const want = (pages[0]?.[0].start ?? 0) + ((pages.at(-1)?.at(-1)?.end ?? 0) - (pages[0]?.[0].start ?? 0)) * 0.33;const page = pages.filter((p) => p.length >= Math.min(2, CAPTION_STYLES[o.style].maxWords)).sort((p, q) => Math.abs(p[0].start - want) - Math.abs(q[0].start - want))[0] ?? pages[0];@@ -470,7 +479,7 @@ export async function previewCaptions(video: string, o: CaptionOptions): Promiseawait run(FFMPEG, ["-v", "error", "-y", "-ss", at.toFixed(3), "-i", video, "-frames:v", "1", "-q:v", "3", frame], BIG);const background = `data:image/jpeg;base64,${readFileSync(frame).toString("base64")}`;const image = join(CACHE_DIR, `preview-${key}.jpg`);- await withPage(info.width, info.height, pageHtml(o.style, { ...info, position: o.position, size: o.size, color: pickColor(o), background }), async (p) => {+ await withPage(info.width, info.height, pageHtml(o.style, { ...info, position: o.position, size: o.size, color: pickColor(o), letters: lettersOf(o), background }), async (p) => {if (state) await p.evaluate((s) => (window as unknown as { paint: (s: unknown) => void }).paint(s), state);await p.screenshot({ path: image, type: "jpeg", quality: 85 });});@@ -497,14 +506,14 @@ export interface CaptionResult {export async function burnCaptions(video: string, o: CaptionOptions, output: string): Promise<CaptionResult> {const info = await probe(video);const { transcript, words } = await timedWords(video, o);- const { pages, states } = layout(words, o.style, info.width, info.height, o.size);+ const { pages, states } = layout(words, o.style, info.width, info.height, o.size, lettersOf(o));if (!states.length) throw new Error("There are no words to put on screen.");const work = mkdtempSync(join(tmpdir(), "flow-captions-"));try {// Draw every distinct caption once, as a transparent picture the size of the video.const files = new Map<string, string>();- await withPage(info.width, info.height, pageHtml(o.style, { ...info, position: o.position, size: o.size, color: pickColor(o) }), async (p) => {+ await withPage(info.width, info.height, pageHtml(o.style, { ...info, position: o.position, size: o.size, color: pickColor(o), letters: lettersOf(o) }), async (p) => {await p.screenshot({ path: join(work, "blank.png"), omitBackground: true });for (const s of states) {const id = JSON.stringify([s.words, s.active, s.scale]);diff --git a/src/core.ts b/src/core.tsindex 41f197c..d7dfd28 100644--- a/src/core.ts+++ b/src/core.ts@@ -65,6 +65,10 @@ const captionFields = {.describe("bottom, middle or top - or a number for an exact height: how far down the frame the middle of the caption sits, 0 = top edge, 100 = bottom edge."),size: z.enum(["small", "medium", "large"]).default("medium"),color: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe("Highlight colour as #RRGGBB, for bold, highlight and reveal."),+ letters: z+ .enum(["as_said", "capitals", "lowercase"])+ .optional()+ .describe("as_said keeps normal capitals (sentence starts, names); capitals is the high-energy short-form look; lowercase is the calm, casual look. Default: capitals for bold, as_said for the rest."),text: z.string().max(50_000).optional().describe("Corrected words, to fix anything misheard. Timings are kept for every word that still matches; a line break starts a new caption."),language: z.string().default("auto").describe("Spoken language code (en, es, de...) or auto."),};diff --git a/studio/index.html b/studio/index.htmlindex 9b59551..c0025cc 100644--- a/studio/index.html+++ b/studio/index.html@@ -375,6 +375,7 @@ audio{width:100%;margin-top:8px;filter:invert(1) hue-rotate(180deg)}<div><label class="f">Position</label><div class="seg" data-seg="cap_pos"></div></div><div><label class="f">Size</label><div class="seg" data-seg="cap_size"></div></div></div>+ <label class="f">Letters</label><div class="seg" data-seg="cap_letters"></div><label class="f">Exact height <span id="cap_yOut" style="text-transform:none;letter-spacing:0"></span></label><input type="range" id="cap_y" min="5" max="95" value="80" aria-label="How far down the screen the captions sit"><p class="empty" style="margin-top:4px">Drag to place the words anywhere, or tap the preview where you want them.</p>@@ -488,6 +489,7 @@ const SEGS = {s_variants: { get: () => S.shots.variants, set: (v) => (S.shots.variants = +v), opts: [1, 2, 3, 4] },cap_pos: { get: () => (typeof S.captions.position === "string" ? S.captions.position : ""), set: (v) => { S.captions.position = v; capPreviewSoon(); }, opts: ["bottom", "middle", "top"], labels: { bottom: "Bottom", middle: "Middle", top: "Top" } },cap_size: { get: () => S.captions.size, set: (v) => { S.captions.size = v; capPreviewSoon(); }, opts: ["small", "medium", "large"], labels: { small: "Small", medium: "Medium", large: "Large" } },+ cap_letters: { get: () => capLetters(S.captions.style), set: (v) => { (S.captions.letters ??= {})[S.captions.style] = v; capPreviewSoon(); }, opts: ["as_said", "capitals", "lowercase"], labels: { as_said: "Normal", capitals: "CAPS", lowercase: "lower" } },n_engine: { get: () => S.narrate.engine, set: (v) => (S.narrate.engine = v), opts: ["gemini", "mac"], labels: { gemini: "Google AI Studio", get mac() { return PLACE.local_engine; } } },};function renderSegs() {@@ -842,9 +844,13 @@ const CAP_COLORS = {};let capHeard = "", capFor = "", capSetup = null, capTimer, capSeq = 0, capVertical = false;const capColor = (style) => S.captions.colors?.[style] ?? CAP_COLORS[style]?.[0];+// Bold pop is capitals unless the user picks otherwise; every other style keeps the words as said.+const capLetters = (style) => S.captions.letters?.[style] ?? (style === "bold" ? "capitals" : "as_said");+const CASE_CSS = { as_said: "none", capitals: "uppercase", lowercase: "lowercase" };function capOpts() {const c = S.captions, o = { video: c.video.path, style: c.style, position: c.position, size: c.size };if (CAP_COLORS[c.style]) o.color = capColor(c.style);+ o.letters = capLetters(c.style);const t = $("#cap_text").value;if (t.trim() && t.trim() !== capHeard.trim()) o.text = t;return o;@@ -852,7 +858,7 @@ function capOpts() {function renderCaptions() {const c = S.captions;$("#cap_video").innerHTML = c.video ? `<div class="cliprow"><b>▶</b><span title="${esc(c.video.path)}">${esc(c.video.name)}</span><button type="button" id="cap_clear" aria-label="Remove ${esc(c.video.name)}">×</button></div>` : "";- $("#cap_styles").innerHTML = CAP_STYLES.map((s) => `<button type="button" class="capstyle${c.style === s.id ? " on" : ""}" data-capstyle="${s.id}"><span class="demo d-${s.id}" style="--hl:${capColor(s.id) ?? "#fff"}"><span>${s.demo}</span></span><b>${s.name}</b><small>${s.blurb}</small></button>`).join("");+ $("#cap_styles").innerHTML = CAP_STYLES.map((s) => `<button type="button" class="capstyle${c.style === s.id ? " on" : ""}" data-capstyle="${s.id}"><span class="demo d-${s.id}" style="--hl:${capColor(s.id) ?? "#fff"};text-transform:${CASE_CSS[capLetters(s.id)]}"><span>${s.demo}</span></span><b>${s.name}</b><small>${s.blurb}</small></button>`).join("");const cols = CAP_COLORS[c.style];$("#cap_colorWrap").hidden = !cols;if (cols) $("#cap_colors").innerHTML = cols.map((h) => `<button type="button" data-capcolor="${h}" class="${h === capColor(c.style) ? "on" : ""}" style="background:${h}" aria-label="Colour ${h}"></button>`).join("");