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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Home: 1536 and 2048 px copies of the video and 3D tiles
Adarsh71bf6b5b32b5
diff --git a/public/previews/home/catwalk-1024.jpg b/public/previews/home/catwalk-1024.jpgnew file mode 100644index 00000000..81d2ea6cBinary files /dev/null and b/public/previews/home/catwalk-1024.jpg differdiff --git a/public/previews/home/catwalk-1536.avif b/public/previews/home/catwalk-1536.avifnew file mode 100644index 00000000..6e17f5b2Binary files /dev/null and b/public/previews/home/catwalk-1536.avif differdiff --git a/public/previews/home/catwalk-1536.mp4 b/public/previews/home/catwalk-1536.mp4new file mode 100644index 00000000..cfc6a715Binary files /dev/null and b/public/previews/home/catwalk-1536.mp4 differdiff --git a/public/previews/home/catwalk-2048.avif b/public/previews/home/catwalk-2048.avifnew file mode 100644index 00000000..69e4dc98Binary files /dev/null and b/public/previews/home/catwalk-2048.avif differdiff --git a/public/previews/home/catwalk-2048.mp4 b/public/previews/home/catwalk-2048.mp4new file mode 100644index 00000000..cd26b637Binary files /dev/null and b/public/previews/home/catwalk-2048.mp4 differdiff --git a/public/previews/home/rotation-1024.jpg b/public/previews/home/rotation-1024.jpgnew file mode 100644index 00000000..63720376Binary files /dev/null and b/public/previews/home/rotation-1024.jpg differdiff --git a/public/previews/home/rotation-1536.avif b/public/previews/home/rotation-1536.avifnew file mode 100644index 00000000..f917c4f1Binary files /dev/null and b/public/previews/home/rotation-1536.avif differdiff --git a/public/previews/home/rotation-1536.mp4 b/public/previews/home/rotation-1536.mp4new file mode 100644index 00000000..edcf5087Binary files /dev/null and b/public/previews/home/rotation-1536.mp4 differdiff --git a/public/previews/home/rotation-2048.avif b/public/previews/home/rotation-2048.avifnew file mode 100644index 00000000..54041072Binary files /dev/null and b/public/previews/home/rotation-2048.avif differdiff --git a/public/previews/home/rotation-2048.mp4 b/public/previews/home/rotation-2048.mp4new file mode 100644index 00000000..ff37bd09Binary files /dev/null and b/public/previews/home/rotation-2048.mp4 differdiff --git a/scripts/gen-home-bento.mjs b/scripts/gen-home-bento.mjsindex 8269941c..0cfea686 100644--- a/scripts/gen-home-bento.mjs+++ b/scripts/gen-home-bento.mjs@@ -6,8 +6,9 @@* published clip was cut from, so the tiles show exactly what the studios show, only sharper.** Output (public/previews/home/):- * catwalk-{640,1024}.{mp4,avif} the catwalk clip at two widths, and each one's first frame as its poster- * rotation-{640,1024}.{mp4,avif} the turning gown (the 3D tile), the same way+ * catwalk-{640,1024,1536,2048}.{mp4,avif} the catwalk clip at four widths, and each one's first frame as its poster+ * rotation-{640,1024,1536,2048}.{mp4,avif} the turning gown (the 3D tile), the same way+ * catwalk-1024.jpg, rotation-1024.jpg the 1024 px clips' first frames, for a browser without AVIF* image-4-{480,768}.avif the Image studio's example 4* ba-{before,after}-{640,960,1280}.avif Colorize's before and after (4:3)* ba-{before,after}-tall-{432,691}.avif the same pair, a 3:5 crop for the tall tile@@ -26,6 +27,9 @@* Masters: the full-size renders are not in the repo. With --masters <dir> (or FUOBE_HOME_MASTERS) the clips, their* posters and the before/after copies are made from the files in it:* <dir>/motion-catwalk.mp4, <dir>/app-3d-rotation.mp4 the renders the published clips were cut from+ * <dir>/motion-catwalk-2048.mkv, <dir>/app-3d-rotation-2048.mkv the same renders upscaled to 2048 x 1536, every frame+ * (SeedVR2 7B, lossless FFV1, BT.709), for the 1536 and+ * 2048 px copies* <dir>/app-colorize-before.png, <dir>/app-colorize-after.png Colorize's pair at full size (1536 x 1152)* Without it those files are kept as they are (and versioned), the posters are made again from the clips kept, and so* is the rest.@@ -66,13 +70,20 @@ const BA_APP = "app-colorize";* in the frame.*/const BA_TALL = { left: 422, top: 0, width: 691, height: 1152 };-/** The two clips: their published preset, the name of their copies here, and the CRF each is encoded at. */+/**+ * The two clips: their published preset, the name of their copies here, and the CRF each width is encoded at (the+ * wider copies, made from the 2048 px master, at a higher CRF: their pixels are smaller on the screen).+ */const CLIPS = [- { key: "motion-catwalk", name: "catwalk", crf: 24 },- { key: "app-3d-rotation", name: "rotation", crf: 23 },+ { key: "motion-catwalk", name: "catwalk", crf: { 640: 24, 1024: 24, 1536: 28, 2048: 29 } },+ { key: "app-3d-rotation", name: "rotation", crf: { 640: 23, 1024: 23, 1536: 27, 2048: 28 } },];/** The widths each clip and its poster are made at: a tile takes the first at least as wide as its box needs. */-const CLIP_WIDTHS = [640, 1024];+const CLIP_WIDTHS = [640, 1024, 1536, 2048];+/** From this width up, a clip is made from its 2048 px master (`<key>-2048.mkv`) instead of the render itself. */+const HD_FROM = 1536;+/** The width of each clip's first frame as a JPEG, the poster for a browser without AVIF (BENTO_CLIP_FALLBACK). */+const FALLBACK_WIDTH = 1024;/** The Canvas board's two pictures (src/lib/home-bento.ts, BENTO_BOARD): the photo going in and a frame of the film. */const BOARD_THUMBS = [{ name: "board-photo.webp", from: "/examples/effect-pearl-earring/1/in-image.jpg" },@@ -166,7 +177,11 @@ async function main() {// Made from the masters when there are any; without them the files already here are kept (and versioned).const fromMasters = [...CLIPS.flatMap((c) =>- CLIP_WIDTHS.map((w) => ({ name: `${c.name}-${w}.mp4`, clip: true, make: () => encodeClipBuffer(loopAt(master(`${c.key}.mp4`), w).all, c.crf) })),+ CLIP_WIDTHS.map((w) => ({+ name: `${c.name}-${w}.mp4`,+ clip: true,+ make: () => encodeClipBuffer(loopAt(master(w >= HD_FROM ? `${c.key}-2048.mkv` : `${c.key}.mp4`), w).all, c.crf[w]),+ })),),...MASTER_STILLS.map((s) => ({...s,@@ -200,6 +215,11 @@ async function main() {return sharp(firstFrame(path.join(OUT_DIR, p.clip))).avif({ quality: POSTER_QUALITY, effort: 6 }).toBuffer();},})),+ // For a browser without AVIF: the FALLBACK_WIDTH clip's first frame as a JPEG.+ ...CLIPS.map((c) => ({+ name: `${c.name}-${FALLBACK_WIDTH}.jpg`,+ make: () => sharp(firstFrame(path.join(OUT_DIR, `${c.name}-${FALLBACK_WIDTH}.mp4`))).jpeg({ quality: 85, mozjpeg: true }).toBuffer(),+ })),...STILLS.map((s) => ({...s,make: () => {@@ -220,7 +240,7 @@ async function main() {versions[`/previews/home/${s.name}`] = contentVersion([out]);}const { wave, seconds } = readWave();- console.log(`stills ${(total / 1024).toFixed(1)} KB (clips aside) · waveform ${wave.length} bars over ${seconds.toFixed(2)} s`);+ console.log(`stills ${(total / 1024).toFixed(1)} KB (clips aside) · waveform ${wave.length} bars over ${seconds.toFixed(2)} s`);if (DRY) return;const source = contentVersion([path.join(PUBLIC, WAVE_SOURCE)]);const body = `/**diff --git a/src/components/home/bento-islands.tsx b/src/components/home/bento-islands.tsxindex 41ae18d6..3c95882b 100644--- a/src/components/home/bento-islands.tsx+++ b/src/components/home/bento-islands.tsx@@ -109,6 +109,13 @@ export function BentoMotion({ target }: { target: string }) {/** The clips' shape (width / height): both tiles play 4:3 renders (scripts/gen-home-bento.mjs). */const CLIP_ASPECT = 4 / 3;+/** The width of the copy the tile's still shows (its file is named `<name>-<width>.avif` or `.jpg`), or 0. */+function stillWidth(el: HTMLElement): number {+ const src = el.parentElement?.querySelector<HTMLImageElement>("picture img")?.currentSrc ?? "";+ const m = /-(\d+)\.(?:avif|jpg)(?:\?|$)/.exec(src);+ return m ? Number(m[1]) : 0;+}+/*** Calls `cb` once the tile's own still (the picture before `el` in its tile) has loaded and been painted, and the* browser has a moment: the still is the first thing the tile shows, and the clip never holds it up.@@ -142,18 +149,25 @@ function afterStill(el: HTMLElement, cb: () => void): () => void {* on screen (not only once the whole page has loaded), so it plays in view, at most a few at once, never under reduced* motion, Save-Data or Pause previews, and a hover or keyboard focus on its tile still plays it. Its source is set only* when it first plays: the narrowest of `clips` at least as wide as the tile shows it on this screen (its box under- * `object-fit: cover`, times the pixel ratio), and that one stays. The still is that clip's own first frame+ * `object-fit: cover`, times the pixel ratio) and at least as wide as the copy of the still the browser chose, and that+ * one stays. The still is that clip's own first frame* (scripts/gen-home-bento.mjs), and the clip shows only once it has that frame, so the change from one to the other* can't be seen: no sign, no flash, nothing moves. Once started it stays mounted and pauses on its frame. `progress`: a* line along the bottom follows the clip.*/export function BentoClip({ id, clips, progress }: { id: string; clips: Sized[]; progress?: boolean }) {const [armed, setArmed] = useState(false);+ // The width of the still the browser chose (its srcset), once it is up: the clip is at least that copy, so the still+ // and the clip's first frame are the same picture.+ const [stillW, setStillW] = useState(0);const { ref, playing, handlers } = usePreviewPlayback<HTMLSpanElement>(id, armed ? { video: clips[0].src } : {});useEffect(() => {const el = ref.current;if (!el) return;- return afterStill(el, () => setArmed(true));+ return afterStill(el, () => {+ setStillW(stillWidth(el));+ setArmed(true);+ });}, [ref]);// The pixels of width the tile needs, kept up to date with its size until the clip starts.const [need, setNeed] = useState(0);@@ -165,7 +179,7 @@ export function BentoClip({ id, clips, progress }: { id: string; clips: Sized[];return () => ro.disconnect();}, [ref]);const [clip, setClip] = useState<string | null>(null);- if (playing && !clip) setClip(pickWidth(clips, need).src);+ if (playing && !clip) setClip(pickWidth(clips, Math.max(need, stillW)).src);const started = clip !== null;const [ready, setReady] = useState(false);const video = useRef<HTMLVideoElement>(null);diff --git a/src/lib/home-bento.generated.ts b/src/lib/home-bento.generated.tsindex 57842d16..aafec290 100644--- a/src/lib/home-bento.generated.ts+++ b/src/lib/home-bento.generated.ts@@ -6,8 +6,12 @@export const HOME_BENTO_MEDIA: Record<string, string> = {"/previews/home/catwalk-640.mp4": "195683c9","/previews/home/catwalk-1024.mp4": "0cfc2824",+ "/previews/home/catwalk-1536.mp4": "526f61cc",+ "/previews/home/catwalk-2048.mp4": "8f301b8a","/previews/home/rotation-640.mp4": "3efbab2a","/previews/home/rotation-1024.mp4": "3f5507ab",+ "/previews/home/rotation-1536.mp4": "87d3d4f1",+ "/previews/home/rotation-2048.mp4": "5804eda4","/previews/home/ba-before-640.avif": "8adbdbd7","/previews/home/ba-before-960.avif": "7f7f2735","/previews/home/ba-before-1280.avif": "7b757bc9",@@ -20,8 +24,14 @@ export const HOME_BENTO_MEDIA: Record<string, string> = {"/previews/home/ba-after-tall-691.avif": "46271396","/previews/home/catwalk-640.avif": "a5c7089b","/previews/home/catwalk-1024.avif": "be920778",+ "/previews/home/catwalk-1536.avif": "c71cd3dd",+ "/previews/home/catwalk-2048.avif": "86ddcec3","/previews/home/rotation-640.avif": "c69b0d7b","/previews/home/rotation-1024.avif": "23d2a89b",+ "/previews/home/rotation-1536.avif": "b3df3778",+ "/previews/home/rotation-2048.avif": "bcc9ccc5",+ "/previews/home/catwalk-1024.jpg": "11e790b3",+ "/previews/home/rotation-1024.jpg": "61a2cbc9","/previews/home/image-4-480.avif": "5a6d07a1","/previews/home/image-4-768.avif": "ef9d1b4d","/previews/home/board-photo.webp": "47432641",diff --git a/src/lib/home-bento.ts b/src/lib/home-bento.tsindex d517322c..975174ec 100644--- a/src/lib/home-bento.ts+++ b/src/lib/home-bento.ts@@ -21,7 +21,9 @@ import { templateCover } from "@/lib/template-covers";export const BENTO_CLIPS = { video: "motion-catwalk", threeD: "app-3d-rotation" } as const;/** Each clip's copies here (scripts/gen-home-bento.mjs): its name, and the widths it and its poster come in. */export const BENTO_CLIP_FILES = { video: "catwalk", threeD: "rotation" } as const;-export const BENTO_CLIP_WIDTHS = [640, 1024] as const;+export const BENTO_CLIP_WIDTHS = [640, 1024, 1536, 2048] as const;+/** The width of the JPEG copy of each clip's first frame, for a browser without AVIF. */+export const BENTO_CLIP_FALLBACK = 1024;/** The Image studio's example the image tile shows and opens with (src/lib/examples/plan.json). */export const BENTO_IMAGE_EXAMPLE = { id: "image.4", out: "/examples/image/4/out.jpg" };/** The app the before/after tile shows and opens: black and white to colour reads at a glance. */@@ -167,13 +169,16 @@ export async function homeBento(f: BentoFacts) {tall: [432, 691].map((w) => ({ src: made(`/previews/home/ba-${side}-tall-${w}.avif`), w })),fallback: `/previews/presets/ba/960/${BENTO_BEFORE_AFTER}-${side}.jpg?v=${baV}`,});- // A moving tile: its poster (the clip's first frame) and its clip, each in every width; the published JPEG poster is- // the fallback for a browser without AVIF.- const moving = (key: keyof typeof BENTO_CLIPS, fallback: string): BentoMovingTile => {+ // A moving tile: its poster (the clip's first frame) and its clip, each in every width; for a browser without AVIF, the+ // 1024 px clip's first frame as a JPEG.+ const moving = (key: keyof typeof BENTO_CLIPS): BentoMovingTile => {const name = BENTO_CLIP_FILES[key];return {id: BENTO_CLIPS[key],- poster: { avif: BENTO_CLIP_WIDTHS.map((w) => ({ src: made(`/previews/home/${name}-${w}.avif`), w })), fallback },+ poster: {+ avif: BENTO_CLIP_WIDTHS.map((w) => ({ src: made(`/previews/home/${name}-${w}.avif`), w })),+ fallback: made(`/previews/home/${name}-${BENTO_CLIP_FALLBACK}.jpg`),+ },clips: BENTO_CLIP_WIDTHS.map((w) => ({ src: made(`/previews/home/${name}-${w}.mp4`), w })),};};@@ -201,12 +206,12 @@ export async function homeBento(f: BentoFacts) {live: tile("live", "Live edit", "Live edit", "Type it, watch it change", "Open Live edit"),canvas: tile("canvas", "Canvas", "Canvas", "Chain any step, end to end", "Open Canvas"),},- video: moving("video", video.poster),+ video: moving("video"),image: {avif: [480, 768].map((w) => ({ src: made(`/previews/home/image-4-${w}.avif`), w })),fallback: example(BENTO_IMAGE_EXAMPLE.out),} satisfies BentoPicture,- threeD: moving("threeD", threeD.poster),+ threeD: moving("threeD"),restore: { before: restoreSide("before"), after: restoreSide("after") },wave: { bars: HOME_BENTO_WAVE.bars, seconds: HOME_BENTO_WAVE.seconds },live: { frames: BENTO_LIVE_STEPS.map(frame), phrases: livePhrases(demo) },diff --git a/tests/e2e/home-bento.mjs b/tests/e2e/home-bento.mjsindex ed4a3e52..ee05e0b6 100644--- a/tests/e2e/home-bento.mjs+++ b/tests/e2e/home-bento.mjs@@ -2,6 +2,7 @@// (`next build`, then `next start -p <port>`): the weight and layout-shift numbers mean little on a dev server.//// Usage: node tests/e2e/home-bento.mjs [appUrl] [--shots <dir>] [--weight-only] (pnpm test:e2e:home)+// E2E_BROWSER=webkit or firefox: run it in that engine (tests/e2e/_browser.mjs).// E2E_OWNER_PASSWORD: the studio's password, when it has one; the owner's pass signs in with it. Without one the// studio is the owner's, and the guest's pass is skipped.// --weight-only: only measure what the first screen downloads (to compare another build, such as main's).@@ -23,8 +24,8 @@// split rests at 50 %, the live words stay), and the tiles keep their stills.// 5. Pause previews stops the catwalk and freezes every animation; pressed again, they go on.// 6. Weight: what the page downloads before `load` (clips aside), at 390 and 1440, reported; the first screen's own-// stills stay under 340 KB (the clips' posters are encoded close to their clips' first frames). The clips are-// reported on their own.+// stills stay under 420 KB (the clips' posters are encoded close to their clips' first frames, and a 3x phone or a+// 2x laptop gets the catwalk's 1536 px still). The clips are reported on their own.// 7. The composer: /?new=1 brings it into view with the focus; a plain visit stays at the top (no autofocus jump).// 8. Every tile is a named link, and Tab reaches them in the grid's reading order with a visible ring.import assert from "node:assert/strict";@@ -56,6 +57,8 @@ const WIDTHS = [{ w: 1920, h: 1080 },];const TILES = ["video", "image", "audio", "threeD", "restore", "numbers", "live", "canvas"];+/** The widest copy of each clip (scripts/gen-home-bento.mjs). */+const CLIP_MAX = 2048;const HEADLINE = "Make anything: From an idea to a finished film, in one place.";/** A context as `who`; null when that viewer can't be had here (a guest needs a studio with a password). */@@ -126,7 +129,7 @@ const layout = (page) =>* page offers for it.*/const sharpness = (page) =>- page.evaluate(() => {+ page.evaluate((CLIP_MAX) => {const dpr = devicePixelRatio;// The copies the browser could choose from for an img: its <picture>'s matching source, or its own srcset, each as// its URL and its width. (naturalWidth is no help here: under a w-descriptor it is scaled by the pixel ratio.)@@ -157,10 +160,10 @@ const sharpness = (page) =>const r = v.getBoundingClientRect();const need = Math.ceil(Math.max(r.width, (r.height * v.videoWidth) / v.videoHeight) * dpr);const what = new URL(v.currentSrc).pathname.split("/").pop();- out.push({ what, tile: v.closest("[data-tile]").dataset.tile, has: v.videoWidth, need, max: 1024, ok: v.videoWidth >= Math.min(need, 1024) * 0.98 });+ out.push({ what, tile: v.closest("[data-tile]").dataset.tile, has: v.videoWidth, need, max: CLIP_MAX, ok: v.videoWidth >= Math.min(need, CLIP_MAX) * 0.98 });}return out;- });+ }, CLIP_MAX);// ------------------------------------------------------------------------------------------- 1. every widthconst shots = [];@@ -527,7 +530,7 @@ for (const v of [WIDTHS[0], WIDTHS[3], WIDTHS[4], WIDTHS[5]]) {const r = await weight(v);// The whole page's total is reported (main's own script and fonts are most of it: compare with --weight-only on// main's build); the first screen's own stills have a budget of their own.- check(`weight before load, clips aside: ${r.line}`, weightOnly || r.own < 340 * 1024);+ check(`weight before load, clips aside: ${r.line}`, weightOnly || r.own < 420 * 1024);notes.push(`weight ${r.line}`);notes.push(` first screen's stills: ${r.media.join(" · ")}`);}diff --git a/tests/home-bento.test.ts b/tests/home-bento.test.tsindex 931ff713..5038b93d 100644--- a/tests/home-bento.test.ts+++ b/tests/home-bento.test.ts@@ -64,7 +64,7 @@ describe("Home's first screen", () => {for (const m of html.matchAll(/(?:src|srcSet)="([^"]+)"/g)) for (const part of m[1].split(", ")) expect(part.split(" ")[0], part).toMatch(versioned);});- it("plays the catwalk and the turning gown in two widths, at the length of their published clips", () => {+ it("plays the catwalk and the turning gown in four widths, at the length of their published clips", () => {const tiles = [{ tile: bento.video, name: "catwalk", published: "motion-catwalk", seconds: 4 },{ tile: bento.threeD, name: "rotation", published: "app-3d-rotation", seconds: 3.04 },@@ -79,10 +79,11 @@ describe("Home's first screen", () => {expect(mp4Seconds(file(c.src))).toBeCloseTo(seconds, 1);expect(mp4Seconds(file(`/previews/presets/${published}.mp4`))).toBeCloseTo(seconds, 1);}- // Its poster comes in the same widths (the clip's first frame); the published JPEG for a browser without AVIF.+ // Its poster comes in the same widths (the clip's first frame); for a browser without AVIF, the 1024 px clip's+ // first frame as a JPEG.expect(tile.poster.avif.map((a) => a.w)).toEqual([...BENTO_CLIP_WIDTHS]);for (const a of tile.poster.avif) expect(a.src).toMatch(new RegExp(`^/previews/home/${name}-${a.w}\\.avif\\?v=`));- expect(tile.poster.fallback).toMatch(new RegExp(`^/previews/presets/${published}\\.jpg\\?v=`));+ expect(tile.poster.fallback).toMatch(new RegExp(`^/previews/home/${name}-1024\\.jpg\\?v=`));}});@@ -109,10 +110,13 @@ describe("Home's first screen", () => {expect(pickWidth(clips, 300).w).toBe(640);expect(pickWidth(clips, 640).w).toBe(640);expect(pickWidth(clips, 641).w).toBe(1024);- // Past the widest copy (the render's own size): the widest, never stretched further.- expect(pickWidth(clips, 1339).w).toBe(1024);- // The widest of each is its master's own width: the clips are 1024 x 768 renders, the before/after pair 1536.- for (const t of [bento.video, bento.threeD]) expect(Math.max(...t.clips.map((c) => c.w))).toBe(1024);+ // A 3x phone (358 px box: 1074) and a 2x laptop (567 px box: 1134) get the 1536 px copy, a 3x tablet the 2048.+ expect(pickWidth(clips, 1074).w).toBe(1536);+ expect(pickWidth(clips, 1134).w).toBe(1536);+ expect(pickWidth(clips, 1728).w).toBe(2048);+ // Past the widest copy (its 2048 px master): the widest, never stretched further.+ expect(pickWidth(clips, 2400).w).toBe(2048);+ for (const t of [bento.video, bento.threeD]) expect(Math.max(...t.clips.map((c) => c.w))).toBe(2048);// The before/after pair covers a 3x phone (358 px wide) and the tall tile on a 2x 1920 screen.expect(Math.max(...bento.restore.after.avif.map((a) => a.w))).toBeGreaterThanOrEqual(358 * 3);expect(Math.max(...(bento.restore.after.tall ?? []).map((a) => a.w))).toBeGreaterThanOrEqual(602);