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.

Genjutsu: a Motion transfer example, and a pick between a mode's examples

Adarshf2a8e7b5b866
diff --git a/public/examples/genjutsu-motion/1/in-clip.384.webp b/public/examples/genjutsu-motion/1/in-clip.384.webp
new file mode 100644
index 00000000..96cd5053
Binary files /dev/null and b/public/examples/genjutsu-motion/1/in-clip.384.webp differ
diff --git a/public/examples/genjutsu-motion/1/in-clip.jpg b/public/examples/genjutsu-motion/1/in-clip.jpg
new file mode 100644
index 00000000..8bbc02ad
Binary files /dev/null and b/public/examples/genjutsu-motion/1/in-clip.jpg differ
diff --git a/public/examples/genjutsu-motion/1/in-photo1.384.webp b/public/examples/genjutsu-motion/1/in-photo1.384.webp
new file mode 100644
index 00000000..6b44ba0c
Binary files /dev/null and b/public/examples/genjutsu-motion/1/in-photo1.384.webp differ
diff --git a/public/examples/genjutsu-motion/1/in-photo1.jpg b/public/examples/genjutsu-motion/1/in-photo1.jpg
new file mode 100644
index 00000000..5a33aef5
Binary files /dev/null and b/public/examples/genjutsu-motion/1/in-photo1.jpg differ
diff --git a/public/examples/genjutsu-motion/1/show.mp4 b/public/examples/genjutsu-motion/1/show.mp4
new file mode 100644
index 00000000..6974f66f
Binary files /dev/null and b/public/examples/genjutsu-motion/1/show.mp4 differ
diff --git a/public/examples/genjutsu-motion/1/show.peak.webp b/public/examples/genjutsu-motion/1/show.peak.webp
new file mode 100644
index 00000000..f1b57b04
Binary files /dev/null and b/public/examples/genjutsu-motion/1/show.peak.webp differ
diff --git a/public/examples/genjutsu-motion/1/show.poster.webp b/public/examples/genjutsu-motion/1/show.poster.webp
new file mode 100644
index 00000000..97106c07
Binary files /dev/null and b/public/examples/genjutsu-motion/1/show.poster.webp differ
diff --git a/public/previews/fx/genjutsu-motion/after.480.avif b/public/previews/fx/genjutsu-motion/after.480.avif
new file mode 100644
index 00000000..64394fa2
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/after.480.avif differ
diff --git a/public/previews/fx/genjutsu-motion/after.480.webp b/public/previews/fx/genjutsu-motion/after.480.webp
new file mode 100644
index 00000000..c4843a22
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/after.480.webp differ
diff --git a/public/previews/fx/genjutsu-motion/after.960.avif b/public/previews/fx/genjutsu-motion/after.960.avif
new file mode 100644
index 00000000..bfeac522
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/after.960.avif differ
diff --git a/public/previews/fx/genjutsu-motion/after.960.webp b/public/previews/fx/genjutsu-motion/after.960.webp
new file mode 100644
index 00000000..0c39d1f9
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/after.960.webp differ
diff --git a/public/previews/fx/genjutsu-motion/before.480.avif b/public/previews/fx/genjutsu-motion/before.480.avif
new file mode 100644
index 00000000..798557bc
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/before.480.avif differ
diff --git a/public/previews/fx/genjutsu-motion/before.480.webp b/public/previews/fx/genjutsu-motion/before.480.webp
new file mode 100644
index 00000000..e098d908
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/before.480.webp differ
diff --git a/public/previews/fx/genjutsu-motion/before.960.avif b/public/previews/fx/genjutsu-motion/before.960.avif
new file mode 100644
index 00000000..17a11b96
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/before.960.avif differ
diff --git a/public/previews/fx/genjutsu-motion/before.960.webp b/public/previews/fx/genjutsu-motion/before.960.webp
new file mode 100644
index 00000000..54eb62d9
Binary files /dev/null and b/public/previews/fx/genjutsu-motion/before.960.webp differ
diff --git a/scripts/examples/publish-examples.mjs b/scripts/examples/publish-examples.mjs
index a69a99d0..f6bfef8f 100644
--- a/scripts/examples/publish-examples.mjs
+++ b/scripts/examples/publish-examples.mjs
@@ -12,6 +12,8 @@
* 1280 px on its long side at most (never enlarged), plus its inset copy (<name>.384.webp, 40 KB at most)
* frame-in the same from a clip's first frame ("at": "last" for its last)
* mask-in a painted area: a black-and-white PNG, as it is
+ * clip-in a clip a run reads: H.264 mp4, 1280 px on its long side at most ("max"), 2.9 MB at most, no sound unless
+ * "sound": true, plus its inset copy from its first frame (<name>.384.webp)
* still-out a picture shown as an output: JPEG q84, 960 px at most, plus its poster (<name>.512.webp)
* clip-show a before → after loop shown as an output (a Genjutsu mode's example): "before" (the clip that went in)
* and "after" (the result) baked into one muted H.264 mp4, 1024×768, 24 fps, 1.2 MB at most, as "layout":
@@ -19,8 +21,8 @@
* line splits the frame, the result on its left and the clip on its right: it holds in the middle for
* 1.5 s, eases to 3/4, back to 1/4 and to the middle again, so both sides always show, a subtle change
* is easy to see at the line, and the loop has no seam). Plus its first frame
- * (<name>.poster.webp, 1024 px, so the loop starts with no jump) and the result near its end
- * (<name>.peak.webp, 512 px: where a card rests, and what reduced motion shows)
+ * (<name>.poster.webp, 1024 px, so the loop starts with no jump) and the result near its end, or at
+ * "peakAt" seconds (<name>.peak.webp, 512 px: where a card rests, and what reduced motion shows)
* A published file is never replaced or removed (a run may name it): a copy whose file exists with other bytes stops
* the script. A new version gets a new path. A file a run reads sits under /examples/ or /samples/ only: a still from
* elsewhere in public/ (a preset's before/after, which its own script rewrites) is copied in first.
@@ -88,6 +90,32 @@ const stillIn = (src, max = 1280) =>
const inset = (src) => fitting((q) => sharp(src).resize({ width: 384, height: 384, fit: "inside", withoutEnlargement: true }).webp({ quality: q }).toBuffer(), [78, 70, 62], 40_000);
const poster = (src) => sharp(src).resize({ width: 512, height: 512, fit: "inside", withoutEnlargement: true }).webp({ quality: 80 }).toBuffer();
+const CLIP_IN = { maxBytes: 2_900_000 };
+
+function writeTemp(data, ext) {
+ const file = path.join(os.tmpdir(), `fuobe-example-${process.pid}-${Date.now()}${ext}`);
+ fs.writeFileSync(file, data);
+ return file;
+}
+
+/**
+ * A clip a run reads: H.264 (yuv420p, faststart), its own frame rate, "max" px on its long side at most (never enlarged;
+ * 1280 by default), "seconds" long at most, sound kept only with "sound": true; the best quality under 2.9 MB.
+ */
+function clipIn(from, { max = 1280, seconds, sound = false }) {
+ const out = path.join(os.tmpdir(), `fuobe-example-clip-${process.pid}-${Date.now()}.mp4`);
+ const scale = `scale='if(gt(iw,ih),min(${max},iw),-2)':'if(gt(iw,ih),-2,min(${max},ih))':flags=lanczos,setsar=1,format=yuv420p`;
+ let data;
+ for (const crf of [20, 22, 24, 26]) {
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-i", from, ...(seconds ? ["-t", String(seconds)] : []), "-vf", scale, "-c:v", "libx264", "-profile:v", "high", "-preset", "slow", "-crf", String(crf), "-threads", "1", ...(sound ? ["-c:a", "aac", "-b:a", "160k"] : ["-an"]), "-movflags", "+faststart", "-map_metadata", "-1", out]);
+ data = fs.readFileSync(out);
+ if (data.length <= CLIP_IN.maxBytes) break;
+ }
+ fs.rmSync(out, { force: true });
+ if (data.length > CLIP_IN.maxBytes) throw new Error(`${from}: the clip is ${data.length} bytes, over ${CLIP_IN.maxBytes}`);
+ return data;
+}
+
async function make(job, dry) {
const { to, from, op } = job;
if (!/^\/examples\/[a-z0-9-]+\/\d+\/[a-z0-9-]+\.(jpg|png|webp|mp4|m4a)$/.test(to)) throw new Error(`${to}: an example file goes at /examples/<slug>/<n>/<name>.<ext>`);
@@ -97,6 +125,10 @@ async function make(job, dry) {
return [put(to, jpg, dry), put(withExt(to, ".384.webp"), await inset(jpg), dry)];
}
if (op === "mask-in") return [put(to, await sharp(fs.readFileSync(from)).greyscale().png({ compressionLevel: 9 }).toBuffer(), dry)];
+ if (op === "clip-in") {
+ const mp4 = clipIn(from, job);
+ return [put(to, mp4, dry), put(withExt(to, ".384.webp"), await inset(frameOf(writeTemp(mp4, ".mp4"))), dry)];
+ }
if (op === "still-out") {
const jpg = await sharp(fs.readFileSync(from)).resize({ width: 960, height: 960, fit: "inside", withoutEnlargement: true }).toColorspace("srgb").jpeg({ quality: 84, mozjpeg: true }).toBuffer();
return [put(to, jpg, dry), put(withExt(to, ".512.webp"), await poster(jpg), dry)];
@@ -183,7 +215,7 @@ async function clipShow(job, dry) {
const first = frameOf(mp4);
const posterWebp = await fitting((q) => sharp(first).webp({ quality: q }).toBuffer(), [78, 70, 62, 54], 90_000);
const peakPng = path.join(dir, "peak.png");
- execFileSync("ffmpeg", ["-v", "error", "-y", "-ss", ((frames / fps) - 0.45).toFixed(3), "-i", mp4, "-frames:v", "1", peakPng]);
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-ss", (job.peakAt ?? frames / fps - 0.45).toFixed(3), "-i", mp4, "-frames:v", "1", peakPng]);
const peakWebp = await fitting((q) => sharp(fs.readFileSync(peakPng)).resize({ width: 512 }).webp({ quality: q }).toBuffer(), [78, 70, 62], 40_000);
fs.rmSync(dir, { recursive: true, force: true });
console.log(`${to}: ${frames} frames, ${(data.length / 1e6).toFixed(2)} MB`);
diff --git a/src/components/genjutsu/genjutsu-studio.tsx b/src/components/genjutsu/genjutsu-studio.tsx
index 8f9ed36c..46fffc54 100644
--- a/src/components/genjutsu/genjutsu-studio.tsx
+++ b/src/components/genjutsu/genjutsu-studio.tsx
@@ -89,7 +89,7 @@ import { SetupCode } from "./setup-code";
import { useClipCuts } from "./use-cuts";
import { ModeExample, ModeExampleRow } from "./mode-example";
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
-import { exampleFor, MARKED_NOTE, OWN_CHARACTER_FIELDS, partLimits, sameRecipe, toRecipe, type GenjutsuExampleCard, type ModeExamples } from "@/lib/examples/genjutsu";
+import { examplesOf, MARKED_NOTE, OWN_CHARACTER_FIELDS, partLimits, sameRecipe, toRecipe, type GenjutsuExampleCard, type ModeExamples } from "@/lib/examples/genjutsu";
/** The upload box's line: the mode's own window (Character swap: 5–15 s of one shot), and the clip size the viewer may upload. */
const limits = (mode: GenjutsuMode, maxBytes: number) =>
@@ -199,6 +199,8 @@ export function GenjutsuStudio({ examples, modeExamples, live }: { examples?: Ex
// A mode's example in the form: which one, the part's length it asks for until a clip is in, and its words that came
// from its own clip (a note under those fields).
const [exampleIn, setExampleIn] = useState<string | null>(null);
+ // Which of a mode's examples is in view (its first unless the viewer picked another).
+ const [exampleAt, setExampleAt] = useState<Partial<Record<GenjutsuMode, number>>>({});
// The length asks for the mode (and model) it came with: another mode's part limits don't take it.
const [pendingLength, setPendingLength] = useState<{ length: number; mode: GenjutsuMode; model?: string } | null>(null);
// The mode whose seed field a pasted setup or an example filled (only that mode shows and sends it).
@@ -560,6 +562,8 @@ export function GenjutsuStudio({ examples, modeExamples, live }: { examples?: Ex
const exMode = ex ? GENJUTSU_MODES.find((g) => shownExamples?.[g.id]?.some((c) => c.id === ex))?.id : undefined;
if (exMode && modeOpen(exMode, open)) {
setModeState(exMode);
+ const at = examplesOf(shownExamples, exMode, open).findIndex((c) => c.id === ex);
+ if (at >= 0) setExampleAt((was) => ({ ...was, [exMode]: at }));
requestAnimationFrame(() => document.querySelector("[data-mode-example]")?.scrollIntoView({ block: "center" }));
}
const video = fresh("video");
@@ -664,7 +668,9 @@ export function GenjutsuStudio({ examples, modeExamples, live }: { examples?: Ex
const partNow = range ? Math.round((range.endTime - range.startTime) * 1000) / 1000 : (pendingLength?.length ?? undefined);
const fullSetup: GenjutsuSetup = { ...setup, ...(seedNumber !== undefined && !seedProblem(seedNumber) ? { seed: seedNumber } : {}), ...(partNow ? { length: partNow } : {}), originalSound };
// This mode's example for this viewer (none: no card), and whether the form still holds it.
- const example = exampleFor(shownExamples, mode, open);
+ const mine = examplesOf(shownExamples, mode, open);
+ const example = mine[Math.min(exampleAt[mode] ?? 0, Math.max(0, mine.length - 1))];
+ const examplePick = mine.length > 1 ? { count: mine.length, at: mine.indexOf(example!), onPick: (i: number) => setExampleAt((was) => ({ ...was, [mode]: i })) } : undefined;
const exampleInUse = !!example && exampleIn === example.id && sameRecipe(toRecipe(fullSetup), example.load.recipe);
const exampleOnlyYou = !!example && owner && !example.load.needs.every((f) => !!live?.[f]);
const body: GenjutsuBody | null =
@@ -882,7 +888,7 @@ export function GenjutsuStudio({ examples, modeExamples, live }: { examples?: Ex
</ToolHero>
)}
{!clip && example && (
- <ModeExample key={example.id} card={example} owner={owner} canUse inUse={exampleInUse} onlyYou={exampleOnlyYou} onUse={() => pickExample(example)} className="mt-6" />
+ <ModeExample key={example.id} card={example} owner={owner} canUse inUse={exampleInUse} onlyYou={exampleOnlyYou} onUse={() => pickExample(example)} pick={examplePick} className="mt-6" />
)}
<div id="gj-clip-drop" className={cn("mx-auto scroll-mt-24 rounded-2xl transition-shadow", clip ? "pt-4" : "mt-8 max-w-[640px]", dropRing && "ring-2 ring-primary ring-offset-4 ring-offset-background")}>
{!clip ? (
diff --git a/src/components/genjutsu/mode-example.tsx b/src/components/genjutsu/mode-example.tsx
index 1515104e..81f2b957 100644
--- a/src/components/genjutsu/mode-example.tsx
+++ b/src/components/genjutsu/mode-example.tsx
@@ -164,15 +164,42 @@ export interface ModeExampleProps {
/** Some of its features are open only to the owner (the Only you mark). */
onlyYou?: boolean;
onUse: () => void;
+ /** The mode's other examples: how many there are and which one shows (a number to pick each, when there are two or more). */
+ pick?: { count: number; at: number; onPick: (i: number) => void };
className?: string;
}
+/** One button per example of the mode ("1", "2", "3"), the one in view pressed. */
+function ExamplePicker({ pick }: { pick: NonNullable<ModeExampleProps["pick"]> }) {
+ if (pick.count < 2) return null;
+ return (
+ <span role="group" aria-label="Examples" className="ml-auto flex items-center gap-1">
+ {Array.from({ length: pick.count }, (_, i) => (
+ <button
+ key={i}
+ type="button"
+ aria-label={`Example ${i + 1} of ${pick.count}`}
+ aria-pressed={i === pick.at}
+ onClick={() => pick.onPick(i)}
+ data-example-pick={i}
+ className={cn(
+ "relative inline-flex size-6 items-center justify-center rounded-full text-[11px] font-semibold tabular-nums transition-colors before:absolute before:-inset-2.5 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
+ i === pick.at ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-accent hover:text-foreground",
+ )}
+ >
+ {i + 1}
+ </button>
+ ))}
+ </span>
+ );
+}
+
/**
* The example card, as wide as the page's column (640 px): the loop beside its title on a wide screen, above it on a
* phone. What went in and the settings sit behind "How it was made" (on a phone the words too), so the upload box stays
* close.
*/
-export function ModeExample({ card, owner, canUse, inUse, onlyYou, onUse, className }: ModeExampleProps) {
+export function ModeExample({ card, owner, canUse, inUse, onlyYou, onUse, pick, className }: ModeExampleProps) {
const settings = exampleSettings(card.load.recipe, { owner });
const titleId = `gj-example-${card.id.replace(/\W/g, "-")}`;
const words = card.words && <p className="text-[13px] leading-relaxed text-pretty text-muted-foreground">{card.words}</p>;
@@ -192,6 +219,7 @@ export function ModeExample({ card, owner, canUse, inUse, onlyYou, onUse, classN
<p className="flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground">
<span className="tracking-wider uppercase">Example</span>
{onlyYou && <OnlyYou />}
+ {pick && <ExamplePicker pick={pick} />}
</p>
<h3 id={titleId} className="mt-1 text-[16px] leading-snug font-semibold text-balance">
{card.caption}
diff --git a/src/lib/examples/catalog.ts b/src/lib/examples/catalog.ts
index 98a92f68..a8c76de9 100644
--- a/src/lib/examples/catalog.ts
+++ b/src/lib/examples/catalog.ts
@@ -16,10 +16,16 @@ import { PRESET_BEFORE_AFTER } from "@/lib/preset-before-after.generated";
import { STUDIO_EXAMPLES, studioExamples, type ExampleStudio } from "@/lib/studio-examples";
import {
EDIT_STUDIO,
+ FPS_BOOST_STUDIO,
IMAGE_STUDIO,
INPAINT_STUDIO,
+ MOTION_CONTROL_STUDIO,
UPSCALE_STUDIO,
+ VIDEO_COLOR_MATCH_STUDIO,
+ VIDEO_DEPTH_STUDIO,
+ VIDEO_MATTE_STUDIO,
VIDEO_STUDIO,
+ VIDEO_UPSCALE_STUDIO,
} from "@/lib/studios";
import { getMaker, GENJUTSU_MODES, modeOpen, requestFeatures, type FeatureCheck, type GenjutsuMode } from "@/lib/catalog/genjutsu";
import { exampleSettings, genjutsuSurface, recipeProblem, type GenjutsuExampleCard, type ModeExamples } from "./genjutsu";
@@ -50,6 +56,8 @@ export interface PlanRow {
words?: string;
/** "draft" (the default): the composer's own path. "look": a sheet to look at. "genjutsu": a Genjutsu mode's example. */
load?: "draft" | "look" | "genjutsu";
+ /** A "look" example with no inputs on its card: the page that runs it, with it loaded (its own `?example=` link). */
+ href?: string;
/** A Genjutsu mode's example (load "genjutsu"): its loop's layout, what went in, the recipe, and the example's own inputs. */
genjutsu?: {
layout: GenjutsuExampleLoad["layout"];
@@ -80,6 +88,12 @@ const SURFACE_CONFIG: Partial<Record<string, StudioConfig>> = {
"studio:edit": EDIT_STUDIO,
"studio:inpaint": INPAINT_STUDIO,
"hub:upscale": UPSCALE_STUDIO,
+ "hub:upscale/video": VIDEO_UPSCALE_STUDIO,
+ "hub:upscale/fps": FPS_BOOST_STUDIO,
+ "studio:motion-control": MOTION_CONTROL_STUDIO,
+ "hub:video-tools": VIDEO_MATTE_STUDIO,
+ "hub:video-tools/depth": VIDEO_DEPTH_STUDIO,
+ "hub:video-tools/colors": VIDEO_COLOR_MATCH_STUDIO,
};
/** Where each surface's look-only covers come from until it has examples of its own (studio-examples.ts). */
@@ -241,7 +255,7 @@ function buildCard(row: PlanRow): ExampleCard {
// area it was made from stay out of the card (the request still has them).
const shown = inputs.some((i) => i.slot === "sketch") ? inputs.filter((i) => i.slot !== "image" && i.slot !== "mask") : inputs;
if (row.modelId && !getModel(row.modelId)) fail(row, `names model ${row.modelId}, which isn't in the catalog`);
- const load: ExampleCard["load"] = row.load === "genjutsu" ? genjutsuLoad(row) : row.load === "look" ? { via: "look" } : { via: "draft", request: requestOf(row, preset) };
+ const load: ExampleCard["load"] = row.load === "genjutsu" ? genjutsuLoad(row) : row.load === "look" ? { via: "look", ...(row.href && { href: lookHref(row) }) } : { via: "draft", request: requestOf(row, preset) };
const chips = load.via === "genjutsu" ? exampleSettings(load.recipe) : chipsOf(row, preset);
return {
id: row.id,
@@ -254,6 +268,15 @@ function buildCard(row: PlanRow): ExampleCard {
};
}
+/** A look card's link: a page of this site that loads one of its own examples (`?example=<id>`). */
+function lookHref(row: PlanRow): string {
+ const href = row.href!;
+ const id = /[?&]example=([a-z0-9-]+.d+)(?:&|$)/.exec(href)?.[1];
+ if (!href.startsWith("/") || href.startsWith("//") || !id) fail(row, "a look card's link opens a page with one of its examples (/page?example=<id>)");
+ if (Object.keys(row.inputs).length) fail(row, "a look card with a link shows no inputs (the link opens them)");
+ return href;
+}
+
/** What a Genjutsu example's inputs are called on its card ("What went in"). */
const GENJUTSU_INPUT_LABEL: Record<string, string> = { clip: "Clip", photo: "Photo", look: "Look", product: "Product" };
diff --git a/src/lib/examples/genjutsu.ts b/src/lib/examples/genjutsu.ts
index 3b7f52ea..f81b05c2 100644
--- a/src/lib/examples/genjutsu.ts
+++ b/src/lib/examples/genjutsu.ts
@@ -142,6 +142,11 @@ export function exampleSettings(r: GenjutsuRecipe, opts: { owner?: boolean } = {
/** The example a viewer sees for a mode: the best one whose mode and features are open to them (none: no card). */
export function exampleFor(examples: ModeExamples | undefined, mode: GenjutsuMode, open: FeatureCheck): GenjutsuExampleCard | undefined {
- if (!modeOpen(mode, open)) return undefined;
- return examples?.[mode]?.find((c) => c.load.needs.every(open));
+ return examplesOf(examples, mode, open)[0];
+}
+
+/** Every example of a mode this viewer may see, best first. */
+export function examplesOf(examples: ModeExamples | undefined, mode: GenjutsuMode, open: FeatureCheck): GenjutsuExampleCard[] {
+ if (!modeOpen(mode, open)) return [];
+ return examples?.[mode]?.filter((c) => c.load.needs.every(open)) ?? [];
}
diff --git a/src/lib/examples/media.generated.ts b/src/lib/examples/media.generated.ts
index 432d044d..d0d1bc83 100644
--- a/src/lib/examples/media.generated.ts
+++ b/src/lib/examples/media.generated.ts
@@ -6269,6 +6269,70 @@ export const EXAMPLE_MEDIA: Record<string, ExampleMediaFile> = {
"w": 1024,
"h": 768
},
+ "/examples/genjutsu-motion/1/in-clip.384.webp": {
+ "role": "show",
+ "type": "image/webp",
+ "bytes": 7242,
+ "sha256": "e6182cfe61fd499851b85763bc17c8ba7c6e6a23daeb66440aeb5810be9fcb1f",
+ "v": "e6182cfe",
+ "w": 384,
+ "h": 288
+ },
+ "/examples/genjutsu-motion/1/in-clip.jpg": {
+ "role": "in",
+ "type": "image/jpeg",
+ "bytes": 71596,
+ "sha256": "681b14afb97c6d2bcd4a57c7aa4a8212604a44db41d71f2293b1593d3d2f3fb3",
+ "v": "681b14af",
+ "w": 1024,
+ "h": 768,
+ "thumb": "/examples/genjutsu-motion/1/in-clip.384.webp?v=e6182cfe"
+ },
+ "/examples/genjutsu-motion/1/in-photo1.384.webp": {
+ "role": "show",
+ "type": "image/webp",
+ "bytes": 15458,
+ "sha256": "79be4958f4c863ebf4c85db20d655d2e14f63efb229ed092365f108cac8b3f54",
+ "v": "79be4958",
+ "w": 384,
+ "h": 288
+ },
+ "/examples/genjutsu-motion/1/in-photo1.jpg": {
+ "role": "in",
+ "type": "image/jpeg",
+ "bytes": 163303,
+ "sha256": "7ea8e509661a6f80a79ca23a5ff4d60945816f7008f5c6ff70af296a4396eb5c",
+ "v": "7ea8e509",
+ "w": 1280,
+ "h": 960,
+ "thumb": "/examples/genjutsu-motion/1/in-photo1.384.webp?v=79be4958"
+ },
+ "/examples/genjutsu-motion/1/show.mp4": {
+ "role": "show",
+ "type": "video/mp4",
+ "bytes": 560760,
+ "sha256": "629263fe9b522df3a2c0a72572a49d2e42cc9685d4e76e7e84d8ac53fe6befd7",
+ "v": "629263fe",
+ "poster": "/examples/genjutsu-motion/1/show.poster.webp?v=dfb8a7ee"
+ },
+ "/examples/genjutsu-motion/1/show.peak.webp": {
+ "role": "show",
+ "type": "image/webp",
+ "bytes": 19982,
+ "sha256": "a221762a58b1bc055747300627d5004b94a463b2397e6ac80c3a4ce66f415009",
+ "v": "a221762a",
+ "w": 512,
+ "h": 384
+ },
+ "/examples/genjutsu-motion/1/show.poster.webp": {
+ "role": "show",
+ "type": "image/webp",
+ "bytes": 47476,
+ "sha256": "dfb8a7ee29dd85e3dad279447fa8511e4531dff5cff3b5f79732387c285e1c1a",
+ "v": "dfb8a7ee",
+ "w": 1024,
+ "h": 768
+ },
"/examples/image/1/out.512.webp": {
"role": "show",
"type": "image/webp",
diff --git a/src/lib/examples/plan.json b/src/lib/examples/plan.json
index 3f4069f7..532d4eec 100644
--- a/src/lib/examples/plan.json
+++ b/src/lib/examples/plan.json
@@ -4784,5 +4784,37 @@
"at": 4.717,
"from": 0
}
+ },
+ {
+ "id": "genjutsu-motion.1",
+ "surface": "tool:genjutsu/motion",
+ "rank": 1,
+ "caption": "Every smile, copied by a new face",
+ "words": "A talk to camera, performed by a new character at a Paris café: every smile, glance and tilt of the head comes from the clip.",
+ "load": "genjutsu",
+ "genjutsu": {
+ "layout": "inset",
+ "went": "A 5 s clip and a photo",
+ "recipe": {
+ "mode": "motion",
+ "engine": "open",
+ "model": "fuobe-genjutsu-motion",
+ "tier": "high",
+ "quality": "720p",
+ "seed": 1002,
+ "length": 5.166,
+ "originalSound": "everything"
+ }
+ },
+ "inputs": {
+ "clip": "/examples/genjutsu-motion/1/in-clip.jpg",
+ "photo1": "/examples/genjutsu-motion/1/in-photo1.jpg"
+ },
+ "output": "/examples/genjutsu-motion/1/show.mp4",
+ "rest": {
+ "src": "/examples/genjutsu-motion/1/show.peak.webp",
+ "at": 1.5,
+ "from": 0
+ }
}
]
diff --git a/src/lib/fx-pairs.generated.ts b/src/lib/fx-pairs.generated.ts
index 2e0fe04c..6afd7c18 100644
--- a/src/lib/fx-pairs.generated.ts
+++ b/src/lib/fx-pairs.generated.ts
@@ -43,6 +43,10 @@ export const FX_PAIRS: Record<string, FxPair> = {
"v": "c7f487bc",
"kind": "pair"
},
+ "genjutsu-motion": {
+ "v": "7f2683ea",
+ "kind": "pair"
+ },
"genjutsu-restyle": {
"v": "b00f8501",
"kind": "pair"
diff --git a/tests/examples-catalog.test.ts b/tests/examples-catalog.test.ts
index 7155cba1..a4372f54 100644
--- a/tests/examples-catalog.test.ts
+++ b/tests/examples-catalog.test.ts
@@ -6,7 +6,20 @@ import type { StudioConfig } from "@/components/studio/studio-context";
import { HOME_CAPTION_MAX } from "@/lib/home-showcase";
import { HUB_MODES, type HubKind } from "@/lib/hubs";
import { GENJUTSU_MODES } from "@/lib/catalog/genjutsu";
-import { appStudio, EDIT_STUDIO, IMAGE_STUDIO, INPAINT_STUDIO, UPSCALE_STUDIO, VIDEO_STUDIO } from "@/lib/studios";
+import {
+ appStudio,
+ EDIT_STUDIO,
+ FPS_BOOST_STUDIO,
+ IMAGE_STUDIO,
+ INPAINT_STUDIO,
+ MOTION_CONTROL_STUDIO,
+ UPSCALE_STUDIO,
+ VIDEO_COLOR_MATCH_STUDIO,
+ VIDEO_DEPTH_STUDIO,
+ VIDEO_MATTE_STUDIO,
+ VIDEO_STUDIO,
+ VIDEO_UPSCALE_STUDIO,
+} from "@/lib/studios";
import { EXAMPLE_MEDIA } from "@/lib/examples/media.generated";
import { STUDIO_COVERS, isStudioCover } from "@/lib/studio-covers";
import { EXAMPLE_CAPTION_MAX, EXAMPLE_WORDS_MAX, EXAMPLES_HEADING, MORE_HEADING, exampleFits, type ExampleCard, type ExampleMedia } from "@/lib/examples/types";
@@ -53,6 +66,12 @@ const STUDIO_OF: Record<string, StudioConfig> = {
"studio:edit": EDIT_STUDIO,
"studio:inpaint": INPAINT_STUDIO,
"hub:upscale": UPSCALE_STUDIO,
+ "hub:upscale/video": VIDEO_UPSCALE_STUDIO,
+ "hub:upscale/fps": FPS_BOOST_STUDIO,
+ "studio:motion-control": MOTION_CONTROL_STUDIO,
+ "hub:video-tools": VIDEO_MATTE_STUDIO,
+ "hub:video-tools/depth": VIDEO_DEPTH_STUDIO,
+ "hub:video-tools/colors": VIDEO_COLOR_MATCH_STUDIO,
};
function configOf(surface: string): StudioConfig {
const [kind, name] = splitSurface(surface);
diff --git a/tests/fixtures/genjutsu-examples/genjutsu-motion.1.json b/tests/fixtures/genjutsu-examples/genjutsu-motion.1.json
new file mode 100644
index 00000000..cdcbc2cc
--- /dev/null
+++ b/tests/fixtures/genjutsu-examples/genjutsu-motion.1.json
@@ -0,0 +1,29 @@
+{
+ "id": "genjutsu-motion.1",
+ "note": "The request body of the run that made this example (file addresses replaced by neutral ones).",
+ "body": {
+ "engine": "open",
+ "mode": "motion",
+ "modelId": "fuobe-genjutsu-motion",
+ "tier": "high",
+ "quality": "720p",
+ "references": [
+ "/api/files/example-photo1.png"
+ ],
+ "source": {
+ "url": "/api/files/example-clip.mp4",
+ "name": "clip.mp4",
+ "duration": 5.166,
+ "fps": 24,
+ "width": 1024,
+ "height": 768,
+ "hasAudio": true
+ },
+ "range": {
+ "start": 0,
+ "end": 5.166
+ },
+ "seed": 1002,
+ "originalSound": "everything"
+ }
+}
diff --git a/tests/genjutsu-examples.test.ts b/tests/genjutsu-examples.test.ts
index a5590bf9..514d63c2 100644
--- a/tests/genjutsu-examples.test.ts
+++ b/tests/genjutsu-examples.test.ts
@@ -169,7 +169,8 @@ describe("Genjutsu mode examples", () => {
});
it("a page sends only the examples open to everyone; the Finish recipe writes its settings out", () => {
- expect(Object.keys(genjutsuExamples(() => false))).toEqual([]);
+ // Nothing open: only examples that need no feature of their own (a mode open to everyone, on a model with no gate).
+ for (const [mode, cards] of Object.entries(genjutsuExamples(() => false))) for (const c of cards!) expect(c.load.needs, `${mode}: ${c.id}`).toEqual([]);
const live = genjutsuLive();
const open = genjutsuExamples((f) => live[f]);
for (const [mode, cards] of Object.entries(genjutsuExamples())) {