Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Blockout to film: a browser check of the builder and the composer, and the builder's timeline on phones

Claude119351e118e0
diff --git a/src/components/cinema/blockout-builder.tsx b/src/components/cinema/blockout-builder.tsx
index 32b2b2a1..10b11967 100644
--- a/src/components/cinema/blockout-builder.tsx
+++ b/src/components/cinema/blockout-builder.tsx
@@ -284,7 +284,7 @@ export default function BlockoutBuilder({ initial, onClose, onDone }: BlockoutBu
<DialogContent showCloseButton={false} className="flex h-[100svh] w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:max-w-none md:flex-row" onOpenAutoFocus={(e) => e.preventDefault()}>
<DialogTitle className="sr-only">Blockout builder</DialogTitle>
<DialogDescription className="sr-only">Place grey boxes, a mannequin and the camera, key their moves and the beats, then render the blockout.</DialogDescription>
- <div className="relative flex min-h-0 min-w-0 flex-1 flex-col bg-[#161617]">
+ <div className="relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[#161617]">
<div className="flex items-center gap-2 px-3 py-2 text-white">
<Clapperboard className="size-4 shrink-0" aria-hidden />
<div className="min-w-0 flex-1">
@@ -314,7 +314,7 @@ export default function BlockoutBuilder({ initial, onClose, onDone }: BlockoutBu
<X className="size-[18px]" />
</button>
</div>
- <div ref={setStageEl} className="relative min-h-[38svh] flex-1 overflow-hidden">
+ <div ref={setStageEl} className="relative min-h-[26svh] flex-1 overflow-hidden">
<canvas ref={setCanvasEl} tabIndex={0} aria-label="Blockout 3D view: drag to orbit, scroll to zoom, click a piece to select it" className="absolute inset-0 size-full touch-none outline-none" />
{mode === "shot" && (
<span className="pointer-events-none absolute top-2 left-2 rounded bg-black/55 px-1.5 py-0.5 font-mono text-[11px] text-white/90">
@@ -350,14 +350,14 @@ export default function BlockoutBuilder({ initial, onClose, onDone }: BlockoutBu
</div>
<span className="w-14 shrink-0 text-right font-mono text-[12px] tabular-nums">{fmt(t)}</span>
</div>
- <div className="flex flex-wrap items-center gap-1.5">
+ <div className="flex items-center gap-1.5 overflow-x-auto [scrollbar-width:none]">
{scene.markers.map((m) => (
- <button key={m.id} type="button" onClick={() => setT(m.t)} className="h-7 rounded-full bg-sky-500/20 px-2.5 text-[12px] text-sky-100 hover:bg-sky-500/30">
+ <button key={m.id} type="button" onClick={() => setT(m.t)} className="h-7 shrink-0 rounded-full bg-sky-500/20 px-2.5 text-[12px] whitespace-nowrap text-sky-100 hover:bg-sky-500/30">
<Flag className="mr-1 inline size-3" />
{fmt(m.t)} · {m.label}
</button>
))}
- <button type="button" onClick={addMarker} className="inline-flex h-7 items-center gap-1 rounded-full border border-dashed border-white/30 px-2.5 text-[12px] hover:bg-white/10">
+ <button type="button" onClick={addMarker} className="inline-flex h-7 shrink-0 items-center gap-1 rounded-full border border-dashed border-white/30 px-2.5 text-[12px] whitespace-nowrap hover:bg-white/10">
<Plus className="size-3" /> Marker at {fmt(t)}
</button>
</div>
diff --git a/src/lib/catalog/cinema.ts b/src/lib/catalog/cinema.ts
index 796b1552..2ff82b07 100644
--- a/src/lib/catalog/cinema.ts
+++ b/src/lib/catalog/cinema.ts
@@ -2278,7 +2278,7 @@ function planBlockout(input: CinemaGenerateInput, ctx: CinemaContext): CinemaPla
if (refs.length > used.length) notes.push(`${model.name} takes ${keep} reference still${keep === 1 ? "" : "s"}${many ? " beside the hand-over frame" : ""}: the first ${keep} go`);
notes.push(
seedance
- ? `${model.name} follows the blockout as its reference video (@Video1) with your stills as @Image1–${Math.max(1, used.length)}${sound ? ", sound on" : ""}`
+ ? `${model.name} follows the blockout as its reference video (@Video1)${used.length ? ` with your still${used.length > 1 ? `s as @Image1–@Image${used.length}` : " as @Image1"}` : ""}${sound ? ", sound on" : ""}`
: `${model.name} renders the blockout from your stills; camera, blocking and timing come from the video. It makes no sound: add it afterwards with Sound for video`,
);
if (many) {
diff --git a/tests/e2e/cinema-blockout.mjs b/tests/e2e/cinema-blockout.mjs
new file mode 100644
index 00000000..2bef7ac3
--- /dev/null
+++ b/tests/e2e/cinema-blockout.mjs
@@ -0,0 +1,209 @@
+// Blockout to film (package blockout-film) in a real browser (the app must be running in demo mode; WebGL runs on
+// SwiftShader). Usage: node tests/e2e/cinema-blockout.mjs [appUrl] [--shots=dir]. Exits 1 on the first failure.
+//
+// 1. 1440 px, light, cloud: the composer's Blockout chip opens the panel; "Build it here" opens the builder on the
+// corridor example; Shot shows the camera's view; "Use this blockout" renders the grey box (24 fps) and its depth
+// (16 fps) in the browser and hands them back; the beats carry the example's words, a still gets a role, the prompt
+// reads in the workflow's sections with @Video1 / @Image1, Seedance 2.5 is priced, and Film queues a take that
+// remembers the blockout. The renders are real videos with the right frame counts.
+// 2. 1440 px, dark, open engine: an uploaded grey-box clip, beats added by hand, "Free", the GPU's words, Film queues
+// the first frame, the cut and the window on Wan 2.2 Fun VACE.
+// 3. 390 px, light and dark: the panel and the builder fit with nothing scrolling sideways.
+import assert from "node:assert/strict";
+import { execFileSync } from "node:child_process";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { DESKTOP, PHONE, chromiumPath, loadPlaywright } from "./_browser.mjs";
+
+const args = process.argv.slice(2);
+const app = (args.find((a) => !a.startsWith("--")) ?? "http://localhost:3000").replace(/\/$/, "");
+const shots = args.find((a) => a.startsWith("--shots="))?.slice(8);
+if (shots) fs.mkdirSync(shots, { recursive: true });
+const { chromium } = loadPlaywright();
+const browser = await chromium.launch({ executablePath: chromiumPath(), args: ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--ignore-gpu-blocklist"] });
+const step = (name) => console.log(`- ${name}`);
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const api = browser.newContext().then((c) => c.request);
+async function call(url, method = "GET", data) {
+ const res = await (await api).fetch(app + url, { method, headers: { "Content-Type": "application/json" }, data: data === undefined ? undefined : JSON.stringify(data) });
+ return res.json();
+}
+async function until(fn, what, ms = 90_000) {
+ const t = Date.now();
+ for (;;) {
+ const v = await fn();
+ if (v) return v;
+ if (Date.now() - t > ms) throw new Error(`Timed out waiting for ${what}`);
+ await sleep(700);
+ }
+}
+const shoot = (page, name) => shots && page.screenshot({ path: path.join(shots, `${name}.png`) });
+const hideDevBadge = (ctx) =>
+ ctx.addInitScript(() =>
+ document.addEventListener("DOMContentLoaded", () => {
+ const s = document.createElement("style");
+ s.textContent = "nextjs-portal{display:none!important}";
+ document.head.append(s);
+ }),
+ );
+const noSideScroll = async (page, what) => assert.equal(await page.evaluate(() => document.documentElement.scrollWidth - window.innerWidth), 0, `${what}: nothing scrolls sideways`);
+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-blockout-e2e-"));
+/** Frames and codec of a stored file, read with ffprobe. */
+async function probe(url) {
+ const res = await (await api).fetch(app + url);
+ const file = path.join(tmp, path.basename(url));
+ fs.writeFileSync(file, Buffer.from(await res.body()));
+ const out = JSON.parse(execFileSync("ffprobe", ["-v", "error", "-count_frames", "-select_streams", "v:0", "-show_entries", "stream=codec_name,width,height,nb_read_frames", "-of", "json", file]).toString());
+ return out.streams[0];
+}
+
+const status = await call("/api/status");
+assert.notEqual(status.demoMode, "off", "run the app in demo mode (FUOBE_DEMO_MODE=on)");
+const project = await call("/api/cinema/projects", "POST", { name: "Blockout check" });
+const items = async () => (await call(`/api/cinema/projects/${project.id}/items`)).items;
+const errors = [];
+let failed = false;
+
+async function open(ctx, engine, query = "") {
+ await ctx.addInitScript((e) => localStorage.setItem("fuobe.engine", e), engine);
+ await hideDevBadge(ctx);
+ const page = await ctx.newPage();
+ // The app sidebar's hydration mismatch on the open engine at desktop width is the base branch's (it shows on /cinema
+ // with no blockout at all, 2026-11-01); everything else counts.
+ page.on("pageerror", (e) => !/^Hydration failed/.test(e.message) && errors.push(e.message));
+ await page.goto(`${app}/cinema/${project.id}${query}`, { waitUntil: "load", timeout: 120_000 });
+ return page;
+}
+
+try {
+ {
+ step("1440 light, cloud: build the corridor example, render it, add a still, film it on Seedance 2.5");
+ const ctx = await browser.newContext({ ...DESKTOP, colorScheme: "light" });
+ const page = await open(ctx, "cloud");
+ await page.getByRole("button", { name: "Blockout: film a grey-box blockout" }).click({ timeout: 90_000 });
+ const panel = page.getByRole("dialog", { name: "Blockout to film" });
+ await panel.waitFor();
+ await shoot(page, "1-panel-empty-1440-light");
+ await noSideScroll(page, "the empty panel");
+ await panel.getByRole("button", { name: /Build it here/ }).click();
+ const builder = page.getByRole("dialog", { name: "Blockout builder" });
+ await builder.waitFor({ timeout: 60_000 });
+ await sleep(1500);
+ await shoot(page, "1-builder-1440-light");
+ await builder.getByRole("radio", { name: "Shot" }).click();
+ await builder.getByRole("slider", { name: "Playhead" }).focus();
+ for (let i = 0; i < 30; i++) await page.keyboard.press("ArrowRight");
+ await sleep(500);
+ await shoot(page, "1-builder-shot-1440-light");
+ assert.ok(await builder.getByText(/Through the shot camera/).isVisible());
+ await builder.getByRole("tab", { name: "Camera" }).click();
+ assert.equal(await builder.getByRole("list", { name: "Camera keys" }).getByRole("listitem").count(), 3, "the example's three camera keys");
+ await builder.getByRole("tab", { name: "Build" }).click();
+ await builder.getByRole("button", { name: "Box", exact: true }).click();
+ await builder.getByRole("tab", { name: "Piece" }).click();
+ assert.equal(await builder.getByRole("textbox", { name: "Name" }).inputValue(), "Box");
+ await builder.getByRole("button", { name: "Remove", exact: true }).click();
+ await noSideScroll(page, "the builder");
+ step("render the grey box and its depth in the browser");
+ await builder.getByRole("button", { name: "Use this blockout" }).click();
+ await panel.getByText("Built in your browser").waitFor({ timeout: 600_000 });
+ const video = await panel.locator("video").getAttribute("src");
+ const grey = await probe(video);
+ assert.equal(grey.nb_read_frames, "192", "8 s at 24 fps");
+ assert.deepEqual([grey.width, grey.height], [1280, 720]);
+ console.log(` grey box: ${grey.codec_name} ${grey.width}x${grey.height}, ${grey.nb_read_frames} frames`);
+ assert.equal(await panel.getByLabel("Beat 2 name").inputValue(), "The door opens");
+ assert.match(await panel.getByLabel("What happens in beat 1").inputValue(), /walks slowly down the narrow corridor/);
+ step("a still with a role, the look and sound, the compiled prompt and the price");
+ const png = path.join(tmp, "interior.png");
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "color=c=0x334455:s=320x240", "-frames:v", "1", png]);
+ await panel.locator('input[type=file][accept^="image/"]').setInputFiles(png);
+ await panel.getByLabel("Reference 1 is the").waitFor();
+ await panel.getByLabel("Reference 1 is the").selectOption("interior");
+ await panel.getByLabel("Style").fill("Low-key horror, cold torchlight");
+ await panel.getByLabel("Sounds").fill("Footsteps on concrete, a long door creak");
+ const prompt = await until(async () => {
+ const v = await panel.getByLabel("Compiled prompt").inputValue();
+ return /@Image1 is the interior/.test(v) && v;
+ }, "the compiled prompt");
+ for (const h of ["Subject:", "Action:", "Camera:", "Style:", "Constraints:", "Audio:"]) assert.ok(prompt.includes(h), h);
+ assert.match(prompt, /0\.0–4\.5s — Arrival: A woman walks slowly/);
+ assert.match(await panel.getByText(/^≈ \$|Placeholder/).first().innerText(), /\$|Placeholder/);
+ await shoot(page, "1-panel-ready-1440-light");
+ await noSideScroll(page, "the ready panel");
+ await panel.getByRole("button", { name: "Film it" }).click();
+ await until(async () => (await items()).find((g) => g.take?.action === "blockout"), "the blockout take");
+ const take = (await items()).find((g) => g.take?.action === "blockout");
+ assert.equal(take.feature, "cinema-blockout");
+ assert.equal(take.request.modelId, "seedance-2-5");
+ assert.deepEqual(take.take.blockout.beats, ["Arrival", "The door opens", "Into the dark"]);
+ assert.equal(take.request.inputs.videos[0], video);
+ step("the depth render: 8 s at 16 fps, and the first frame");
+ const uploads = (await call("/api/assets?source=upload")).items ?? [];
+ const depthAsset = uploads.find((a) => /blockout-depth/.test(a.name ?? ""));
+ assert.ok(depthAsset, "the depth render was uploaded");
+ const depth = await probe(depthAsset.url);
+ assert.equal(depth.nb_read_frames, "128", "8 s at 16 fps");
+ assert.deepEqual([depth.width, depth.height], [832, 464]);
+ assert.ok(uploads.some((a) => /blockout-first-frame/.test(a.name ?? "")), "the first frame was uploaded");
+ await ctx.close();
+ }
+ {
+ step("1440 dark, open engine: an uploaded grey box, hand-made beats, free on your GPU");
+ const ctx = await browser.newContext({ ...DESKTOP, colorScheme: "dark" });
+ const page = await open(ctx, "open", "?blockout=1");
+ const panel = page.getByRole("dialog", { name: "Blockout to film" });
+ await panel.waitFor({ timeout: 90_000 });
+ const clip = path.join(tmp, "greybox.mp4");
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "testsrc=size=640x360:rate=24", "-t", "6", "-pix_fmt", "yuv420p", "-c:v", "libx264", clip]);
+ await panel.locator('input[type=file][accept^="video/"]').first().setInputFiles(clip);
+ await panel.getByText("greybox.mp4").waitFor({ timeout: 60_000 });
+ await panel.getByText(/no depth pass: Depth Anything 3 reads it on your GPU/).waitFor();
+ await panel.getByLabel("What happens in beat 1").fill("A man creeps along the wall.");
+ await panel.getByRole("button", { name: "Beat", exact: true }).click();
+ await panel.getByLabel("Beat 2 name").fill("Lights out");
+ await panel.getByLabel("What happens in beat 2").fill("The lights die.");
+ await panel.getByText(/^(Free|Placeholder · free)$/).first().waitFor();
+ assert.ok(await panel.getByText(/not the dialogue or sound/).first().isVisible());
+ await shoot(page, "2-panel-open-1440-dark");
+ await noSideScroll(page, "the open panel");
+ await panel.getByRole("button", { name: "Film it" }).click();
+ const runs = await until(async () => {
+ const list = (await items()).filter((g) => g.feature === "cinema-blockout" && g.engine !== "cloud" && g.request.modelId !== "seedance-2-5");
+ return list.length >= 4 && list;
+ }, "the open engine's steps");
+ const models = runs.map((g) => g.request.modelId);
+ for (const m of ["oss-extract-frame", "oss-qwen-edit", "oss-segment", "oss-wan22-vace-restyle"]) assert.ok(models.includes(m), m);
+ await ctx.close();
+ }
+ for (const scheme of ["light", "dark"]) {
+ step(`390 ${scheme}: the panel and the builder fit`);
+ const ctx = await browser.newContext({ ...PHONE, colorScheme: scheme });
+ const page = await open(ctx, "cloud", "?blockout=1");
+ const panel = page.getByRole("dialog", { name: "Blockout to film" });
+ await panel.waitFor({ timeout: 90_000 });
+ await noSideScroll(page, `the panel at 390 (${scheme})`);
+ await shoot(page, `3-panel-390-${scheme}`);
+ await panel.getByRole("button", { name: /Build it here/ }).click();
+ const builder = page.getByRole("dialog", { name: "Blockout builder" });
+ await builder.waitFor({ timeout: 60_000 });
+ await sleep(1500);
+ await noSideScroll(page, `the builder at 390 (${scheme})`);
+ assert.ok(await builder.getByRole("button", { name: "Use this blockout" }).isVisible());
+ await shoot(page, `3-builder-390-${scheme}`);
+ await builder.getByRole("button", { name: "Close the builder" }).click();
+ await panel.waitFor();
+ await ctx.close();
+ }
+ if (errors.length) console.log("PAGE ERRORS:\n" + errors.map((e) => e.slice(0, 600)).join("\n---\n"));
+ assert.deepEqual(errors, [], "no page errors");
+ console.log("ok");
+} catch (e) {
+ failed = true;
+ console.error(e);
+} finally {
+ await browser.close();
+ fs.rmSync(tmp, { recursive: true, force: true });
+ process.exit(failed ? 1 : 0);
+}