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.

Originals O9: Mixed Media and Shorts plans on the Originals, Smooth, and DoP's Mixed Media effects

Claudefae40d11f374
diff --git a/src/lib/catalog/dop.ts b/src/lib/catalog/dop.ts
index 9cd877ab..a55a86af 100644
--- a/src/lib/catalog/dop.ts
+++ b/src/lib/catalog/dop.ts
@@ -14,12 +14,15 @@
* - Licences are information: a LoRA licensed for the user's GPU only (civitai "RentCivit") goes to the cloud route
* too, unless Settings → Models & licences keeps such LoRAs on the GPU (fitLoras then leaves it out, saying so); a
* non-commercial LoRA or one whose licence the research holds is used and said in the preset's line.
+ * - The Mixed Media looks (32 effects, build plan O9) draw the start frame in the Mixed Media studio's look first
+ * (Fuobe Mixed Media: Z-Image Turbo + ControlNet with the look's LoRA, one seed), then animate it on the words.
* - A preset with nothing of the Original's own in the cloud (no hostable LoRA, camera LoRA, hosted move, grade or
* relight) keeps its partner route there, Kling 2.5 Turbo on the preset's words: Fuobe DoP on the words alone
* becomes its cloud default only when the evaluation harness (scripts/eval, O8) promotes it. On the user's GPU it
* is Fuobe DoP (Wan 2.2 on the words, as before).
*/
import { gpuOnlyLicence, libraryEntry, loraName, loraRef, triggerOf } from "./loras";
+import { defaultValues, getMixedPreset, originalFrameRequest } from "./mixed-media";
import { DOP_RECIPES, OSS_LORAS, type DopRecipe, type OssLora } from "./oss-loras.generated";
import type { LoraRef, Operation, Preset, PresetRoute } from "./types";
@@ -108,6 +111,25 @@ const RELIGHT_LIGHT: Record<string, string> = {
const bare = (id: string) => id.replace(/^(motion|effect|app)-/, "");
+/** The Mixed Media studio look a DoP Mixed Media effect is ("effect-two-color" → "mixed-two-color"). */
+export const mixedLookOf = (presetId: string) => getMixedPreset(`mixed-${bare(presetId)}`);
+
+/**
+ * A Mixed Media effect's step before the clip (O9): the still drawn in the studio look's default settings by Fuobe Mixed
+ * Media on the engine the clip runs on (its LoRA, its seed; about 1 megapixel on fal, the still's own shape).
+ */
+function mixedPrestep(presetId: string): Preset["prestep"] {
+ const look = mixedLookOf(presetId);
+ if (!look) return undefined;
+ const values = defaultValues(look);
+ const labels = { step: `Start frame as ${look.name}`, clip: `${look.name} clip` };
+ const step = (engine: "open" | "cloud") => {
+ const { modelId, prompt, loras, params } = originalFrameRequest({ engine, preset: look, values, resolution: "1K" });
+ return { modelId, op: "edit" as const, prompt: prompt ?? "", ...(loras?.length && { loras }), ...(params && { params }), labels };
+ };
+ return { open: step("open"), cloud: step("cloud") };
+}
+
/** A map LoRA as a recipe's LoRA: the library's pinned download and licence when it is a library file. */
function asRef(l: OssLora): LoraRef {
const e = libraryEntry(l);
@@ -190,6 +212,9 @@ export function dopPreset(p: Preset): Preset {
cloud: { modelId: RELIGHT_CLOUD, op: "edit", prompt: `${RELIGHT_TRIGGER}, ${light}`, loras: [relightLora] },
};
}
+ // The Mixed Media looks: the still in the look first (Fuobe Mixed Media), then Wan 2.2 animates it on the words.
+ const mixedLook = status === "mixed-media-route" ? mixedLookOf(p.id) : undefined;
+ if (mixedLook) extras.prestep = mixedPrestep(p.id);
// In the cloud: LTX-2.5's own move, LTX-2.3's camera LoRA, the Wan or LTX LoRAs a host runs, a grade or a relight on
// Wan. A LoRA licensed for the GPU only rides along on Fuobe DoP (said below; the admin can keep such LoRAs on the
@@ -226,7 +251,10 @@ export function dopPreset(p: Preset): Preset {
const held = status === "licence-hold" ? presetLoras(p.id).map((l) => l.ref) : [];
let parity: string;
if (grade) parity = "Fuobe DoP animates your still without a LoRA, then your browser grades the clip";
- else if (extras.prestep) parity = "Fuobe DoP relights your still first (Qwen-Image-Edit 2509 + its Relight LoRA), then animates it";
+ else if (mixedLook && extras.prestep) {
+ const lora = extras.prestep.cloud.loras?.length ? ` with ${names(extras.prestep.cloud.loras)}` : "";
+ parity = `Fuobe DoP draws your still as ${mixedLook.name} first (Fuobe Mixed Media: Z-Image Turbo + ControlNet${lora}), then animates it, on your GPU and in the cloud. For a whole clip restyled frame by frame, use Mixed Media`;
+ } else if (extras.prestep) parity = "Fuobe DoP relights your still first (Qwen-Image-Edit 2509 + its Relight LoRA), then animates it";
else if (status === "mixed-media-route") parity = `${p.parity ?? ""}${p.parity ? ". " : ""}For a whole clip restyled frame by frame, use Mixed Media`;
else if (openSays === cloudSays) parity = `Fuobe DoP: ${openSays}, on your GPU and in the cloud`;
else parity = `Fuobe DoP on your GPU: ${openSays}. In the cloud: ${cloudSays}`;
diff --git a/src/lib/catalog/genjutsu.ts b/src/lib/catalog/genjutsu.ts
index 963e56fe..207af1ea 100644
--- a/src/lib/catalog/genjutsu.ts
+++ b/src/lib/catalog/genjutsu.ts
@@ -1320,10 +1320,13 @@ function planCharacterSwap(input: GenjutsuPlanInput): GenjutsuPlan {
// ---------------------------------------------------------------------------
// Restyle
-/** The first frame's restyle: a Soul look's LoRAs on Z-Image (Fuobe Soul's edit), else Qwen-Image-Edit with the look's images. */
-function lookFrameRequest(engine: Engine, look: GenjutsuLook, sl: ShortsLook, refs: string[], seed: object): Pick<GenerationRequest, "modelId" | "op" | "prompt" | "presetId" | "inputs" | "params"> {
+/**
+ * The first frame's restyle: a Soul look's LoRAs on Z-Image (Fuobe Soul's edit, an Original: it runs on the engine the
+ * restyle does, never on whichever one is connected first), else Qwen-Image-Edit with the look's images.
+ */
+function lookFrameRequest(engine: Engine, look: GenjutsuLook, sl: ShortsLook, refs: string[], seed: object): Pick<GenerationRequest, "modelId" | "op" | "prompt" | "presetId" | "inputs" | "params" | "engine"> {
if (look.kind === "soul") {
- return { modelId: "fuobe-soul", op: "edit", presetId: look.id, prompt: "The same frame: every person, face, pose and object in place", params: { ...seed } };
+ return { modelId: "fuobe-soul", engine, op: "edit", presetId: look.id, prompt: "The same frame: every person, face, pose and object in place", params: { ...seed } };
}
return {
modelId: engine === "open" ? "oss-qwen-edit" : "qwen-image-edit-2511-cloud",
@@ -1358,6 +1361,8 @@ function planFuobeRestyle(input: GenjutsuPlanInput): GenjutsuPlan {
const seed = input.seed !== undefined ? { seed: input.seed } : {};
const steps = plan.steps.map((s) => {
let request: GenerationRequest = s.key === final ? { ...s.request, feature: GENJUTSU.feature, title: input.title } : { ...s.request, feature: GENJUTSU.stepFeature };
+ // The Original runs on the engine it was picked for (a model on both engines would otherwise take the first one connected).
+ if (request.modelId === m.id && m.source === "original") request = { ...request, engine: m.engine };
// A Soul look restyles the first frame with its own LoRAs (Fuobe Soul's edit) instead of the Qwen edit.
if (input.look?.kind === "soul" && /^frame\d/.test(s.key)) request = { ...request, ...lookFrameRequest(m.engine, input.look, look, [], seed), inputs: undefined };
return { ...s, request };
@@ -1395,6 +1400,7 @@ function planCloudRestyle(input: GenjutsuPlanInput): GenjutsuPlan {
key: `restyle${i}`,
request: {
...(own ? { ...base, title: input.title } : helper),
+ engine: "cloud",
modelId: m.id,
op: "v2v",
prompt: segmentPrompt(look),
diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts
index f2c89281..41a0f232 100644
--- a/src/lib/catalog/index.ts
+++ b/src/lib/catalog/index.ts
@@ -27,12 +27,15 @@ function withOssLoras(p: Preset): Preset {
};
}
-/** A relight effect's step before the clip, priced on its model (a 1-megapixel picture; free on the user's GPU). */
+/**
+ * A relight or Mixed Media effect's step before the clip, priced on its model as it runs in the cloud (a 1-megapixel
+ * picture; free on the user's GPU).
+ */
function withPrestepPrice(p: Preset): Preset {
if (!p.prestep) return p;
const price = (s: NonNullable<Preset["prestep"]>["open"]) => {
const m = modelIndex.get(s.modelId);
- return m ? (estimateCost(m, { aspectRatio: "1:1", resolution: "1K", numOutputs: 1 }, 1, s.op, !!s.loras?.length) ?? undefined) : undefined;
+ return m ? (estimateCost(onEngine(m, "cloud"), { aspectRatio: "1:1", resolution: "1K", numOutputs: 1 }, 1, s.op, !!s.loras?.length) ?? undefined) : undefined;
};
return { ...p, prestep: { open: { ...p.prestep.open, usd: 0 }, cloud: { ...p.prestep.cloud, usd: price(p.prestep.cloud) } } };
}
diff --git a/src/lib/catalog/mixed-media.ts b/src/lib/catalog/mixed-media.ts
index 5cceab76..06ce846b 100644
--- a/src/lib/catalog/mixed-media.ts
+++ b/src/lib/catalog/mixed-media.ts
@@ -1,18 +1,24 @@
/**
* Mixed Media (Higgsfield's /mixed-media): turn a 1–10 s clip into mixed-media art (sketch, comic,
* paper, neon…) with per-preset settings. Higgsfield samples frames at 4–24 fps and stylises each
- * one, priced per output frame; the open engine does the same (Z-Image per frame, oss-mixed-media).
- * The cloud engine does it too by default ("Per frame": cut → frames → an image edit per frame, each
- * looking at the frame styled before it → frames back to video → the cut's own sound); "Fast" runs a
- * video-to-video restyle model on the trimmed clip instead, anchored on the preview frame when the
- * model takes one (LTX 2.3 reference restyle).
+ * one, priced per output frame. Fuobe Mixed Media (build plan O9) does the same on both engines:
+ * every frame drawn again in the look by Z-Image Turbo under the frame's own outlines (its Fun
+ * ControlNet), with the look's LoRA and one fixed seed — one per-frame job on your GPU, or on fal
+ * cut → every Nth frame → one controlled frame each → frames back to video (clips of up to 200 frames,
+ * joined) → the cut's own sound. Its "Smooth" option draws only the first frame in the look and lets
+ * Wan 2.2 Fun VACE carry it through the clip by depth (Fuobe Shorts' pass). Partner choices stay: on
+ * the cloud, Per frame with Nano Banana 2 or Seedream 5.0 Flash (each frame looking at the frame styled
+ * before it), and "Fast", one video-to-video restyle model on the trimmed clip, anchored on the preview
+ * frame when the model takes one (LTX 2.3 reference restyle).
*
* Pure module, shared by the page, src/server/mixed-media.ts and the tests.
- * Research: docs/research/higgsfield-studios.md §3.
+ * Research: docs/research/higgsfield-studios.md §3, docs/research/fuobe-originals-recipes-5.md §8 mixed-media.
*/
import { scenePoster, type PresetPreview, type PreviewFx, type PreviewScene } from "../preset-cards";
-import type { PlanStep } from "./shorts";
-import type { Engine } from "./types";
+import { MIXED_MEDIA_LOOK_LORAS } from "./lora-library.generated";
+import { loraEntry, loraRef, triggerOf } from "./loras";
+import { planShorts, SHORTS_ORIGINAL, type PlanStep, type ShortsLook } from "./shorts";
+import type { Engine, GenerationRequest, LoraRef } from "./types";
export const MIXED = {
minSeconds: 1,
@@ -36,20 +42,36 @@ export const MIXED_PREVIEW_FEATURE = "mixed-media-preview";
/** Cloud Per frame: one edit per frame. A helper step too ("-step"), kept apart so History and the render view don't load hundreds of them. */
export const MIXED_FRAME_FEATURE = "mixed-media-frame-step";
-/** Cloud restyle models (the first is the default) and the open per-frame model. */
+/** Mixed Media's Original (O9): every frame drawn again in the look on Z-Image Turbo + ControlNet, on both engines. */
+export const MIXED_ORIGINAL = "fuobe-mixed-media";
+/** Smooth's pass after the first frame: Fuobe Shorts' Wan 2.2 Fun VACE by depth (both engines). */
+export const MIXED_SMOOTH_MODEL = SHORTS_ORIGINAL;
+/** The per-frame model Mixed Media ran on the open engine before the Original (API callers that name it keep it). */
+export const MIXED_OPEN_LEGACY = "oss-mixed-media";
+
+/** Fast's video-to-video restyle models (cloud; the first is Fast's default) and the open per-frame model. */
export const MIXED_MODELS: Record<Engine, string[]> = {
cloud: ["ltx-2-3-restyle", "lucy-edit-pro", "gemini-omni-flash", "kling-o3-4k-edit", "happy-horse-video-edit", "wan-2-7", "runway-aleph-2"],
- open: ["oss-mixed-media"],
+ open: [MIXED_ORIGINAL],
};
export const MIXED_TOOLS = {
cloud: { cut: "trim-video", mux: "merge-audio-video", preview: "nano-banana-2", frames: "extract-frames", assemble: "images-to-video", join: "join-clips" },
- open: { preview: "oss-mixed-media" },
+ open: { preview: MIXED_ORIGINAL },
} as const;
-/** How the cloud engine restyles: frame by frame like Higgsfield (the default), or one video-to-video pass. */
-export type MixedMode = "frames" | "fast";
-/** Cloud image editors that redraw each frame (the first is the default): Nano Banana 2 takes a seed, Seedream 5.0 Flash is the cheapest. */
-export const MIXED_FRAME_MODELS = ["nano-banana-2", "seedream-5-flash"] as const;
+/**
+ * How a render restyles: frame by frame like Higgsfield (the default, both engines), Smooth (the Original's first frame,
+ * then Wan 2.2 Fun VACE by depth: no flicker), or Fast (cloud: one partner video-to-video pass).
+ */
+export type MixedMode = "frames" | "smooth" | "fast";
+/** The modes each engine offers. */
+export const MIXED_MODES: Record<Engine, MixedMode[]> = { cloud: ["frames", "smooth", "fast"], open: ["frames", "smooth"] };
+/**
+ * Cloud models that draw each frame (the first is the default): Fuobe Mixed Media (Z-Image Turbo + ControlNet with the
+ * look's LoRA, one seed, every frame on its own), then the partner image editors, Nano Banana 2 (it takes a seed) and
+ * Seedream 5.0 Flash, which redraw each frame looking at the one styled before it.
+ */
+export const MIXED_FRAME_MODELS = [MIXED_ORIGINAL, "nano-banana-2", "seedream-5-flash"] as const;
/**
* Cloud per-frame limits: fal's extract-nth-frame returns up to 500 frames a call and images-to-video
@@ -85,7 +107,7 @@ const select = (key: string, label: string, options: [label: string, prompt: str
};
const text = (key: string, label: string, def: string, placeholder: string): MixedSetting => ({ key, label, type: "text", default: def, placeholder, max: 40 });
-/** Every preset ends with how strongly the look takes over (also the open engine's denoise). */
+/** Every preset ends with how strongly the look takes over (the open engine's denoise, the Original's control scale in the cloud). */
export const INTENSITY = {
key: "intensity",
label: "Intensity",
@@ -98,6 +120,8 @@ export const INTENSITY = {
default: "balanced",
} as const satisfies MixedSetting;
const DENOISE: Record<string, number> = { subtle: 0.55, balanced: 0.7, bold: 0.82 };
+/** The Original in the cloud draws each frame anew under its outlines: a subtle look holds them tighter. */
+const CONTROL: Record<string, number> = { subtle: 0.85, balanced: 0.75, bold: 0.6 };
export interface MixedPreset {
id: string;
@@ -446,6 +470,25 @@ export function mixedPrompts(p: Pick<MixedPreset, "look" | "settings">, values:
}
export const denoiseFor = (values: MixedValues) => DENOISE[values.intensity] ?? DENOISE.balanced;
+/** How closely the Original's cloud frames follow the source's outlines (fal's control_scale). */
+export const controlFor = (values: MixedValues) => CONTROL[values.intensity] ?? CONTROL.balanced;
+
+/**
+ * The look's LoRAs (research studios[mixed-media].original.looks, through the LoRA library: pinned downloads, licences).
+ * 14 of the 33 looks have one; the rest run on their words. Unverified until the evaluation harness measures each.
+ */
+export function mixedLoras(presetId: string): LoraRef[] {
+ return (MIXED_MEDIA_LOOK_LORAS[presetId] ?? []).flatMap((l) => {
+ const e = loraEntry(l.key);
+ return e ? [loraRef(e, l.strength)] : [];
+ });
+}
+
+/** A prompt led by its LoRAs' trigger words ("drkrm style, …"), as the Soul looks are. */
+export function withTrigger(prompt: string, loras: LoraRef[]): string {
+ const t = triggerOf(loras);
+ return t ? `${t}, ${prompt}` : prompt;
+}
/** "#c1121f" from a typed "#C1121F", "c1121f" or "#c12" (shorthand), else null. */
export function parseHex(raw: string): string | null {
@@ -553,6 +596,49 @@ export function frameResolution(frames: number, resolution: MixedResolution): Mi
return frames > FRAME_LIMITS.perClip && resolution === "4K" ? "2K" : resolution;
}
+/** The Original's frame tiers: about 1 (1K) or 4 (2K) megapixels; it draws up to 2K (Z-Image Turbo's range). */
+const ORIGINAL_TIER: Record<MixedResolution, number> = { "1K": 1024, "2K": 2048, "4K": 2048 };
+
+/**
+ * The size the Original draws a frame at in the cloud (fal's image_size): the clip's shape with the area of the tier's
+ * square, on the 16-pixel grid. Undefined without the clip's size (fal then keeps the frame's own size).
+ */
+export function originalFrameSize(source: { width?: number; height?: number } | undefined, resolution: MixedResolution): { width: number; height: number } | undefined {
+ const w = source?.width;
+ const h = source?.height;
+ if (!w || !h) return undefined;
+ const side = ORIGINAL_TIER[resolution];
+ const k = Math.sqrt((side * side) / (w * h));
+ const grid = (v: number) => Math.max(256, 16 * Math.round(v / 16));
+ return { width: grid(w * k), height: grid(h * k) };
+}
+
+/** What the Original's cloud frame route is asked for: one picture, the render's seed, the look's control scale and the frame size. */
+export function originalFrameParams(values: MixedValues, resolution: MixedResolution, seed: number, source?: { width?: number; height?: number }) {
+ const size = originalFrameSize(source, resolution);
+ return { seed, numOutputs: 1, extra: { control_scale: controlFor(values), ...(size && { image_size: size }) } };
+}
+
+/** One frame in the look by the Original on an engine: the preview, Smooth's first frame and DoP's Mixed Media effects. */
+export function originalFrameRequest(
+ input: Pick<MixedPlanInput, "engine" | "preset" | "values" | "resolution" | "sourceSize" | "seed" | "loras">,
+): Pick<GenerationRequest, "engine" | "modelId" | "op" | "prompt" | "loras" | "params"> {
+ const loras = input.loras ?? mixedLoras(input.preset.id);
+ const seed = input.seed ?? FRAME_SEED;
+ return {
+ engine: input.engine,
+ modelId: MIXED_ORIGINAL,
+ op: "edit",
+ prompt: withTrigger(mixedPrompts(input.preset, input.values).frame, loras),
+ ...(loras.length && { loras }),
+ // On your GPU: Z-Image img2img at about 1 megapixel, as strongly as the intensity asks.
+ params:
+ input.engine === "cloud"
+ ? originalFrameParams(input.values, input.resolution, seed, input.sourceSize)
+ : { seed, numOutputs: 1, extra: { strength: denoiseFor(input.values), megapixels: 1 } },
+ };
+}
+
// ---------------------------------------------------------------------------
// Pipelines
@@ -565,9 +651,9 @@ export interface MixedPlanInput {
range: { start: number; end: number };
fps: number;
resolution: MixedResolution;
- /** The restyle model (cloud Fast), the frame editor (cloud Per frame: MIXED_FRAME_MODELS) or oss-mixed-media (open). */
+ /** The frame model (Per frame: MIXED_FRAME_MODELS in the cloud, the Original on your GPU), Fast's restyle model, or the Original (Smooth). */
modelId: string;
- /** Cloud: frame by frame (default) or one video-to-video pass. */
+ /** Frame by frame (default), Smooth, or (cloud) Fast: one video-to-video pass. */
mode?: MixedMode;
/** Cloud Per frame: the clip's own frame rate (frames are every Nth one of it). */
sourceFps?: number;
@@ -580,15 +666,25 @@ export interface MixedPlanInput {
/** Cloud: the model's extra settings (LTX: follow the outlines). */
extra?: Record<string, unknown>;
seed?: number;
+ /** The Original: the look's LoRAs this run can reach (the server leaves out a civitai one without the key); else the look's own. */
+ loras?: LoraRef[];
}
-/** The full render. Open: one per-frame job. Cloud: cut the selection, restyle it (frame by frame, or Fast), put its own sound back. */
+/**
+ * The full render. Open: one per-frame job (or Smooth). Cloud: cut the selection, restyle it (frame by frame, Smooth or
+ * Fast), put its own sound back.
+ */
export function planMixed(input: MixedPlanInput): { steps: PlanStep[]; final: string } {
- if (input.engine === "cloud" && (input.mode ?? "frames") === "frames") return planMixedFrames(input);
+ const mode = input.mode ?? "frames";
+ if (mode === "smooth") return planMixedSmooth(input);
+ if (input.engine === "cloud" && mode === "frames") return planMixedFrames(input);
const prompts = mixedPrompts(input.preset, input.values);
const base = { batchTitle: input.title };
- const seed = input.seed !== undefined ? { seed: input.seed } : {};
+ const original = input.modelId === MIXED_ORIGINAL;
+ // The Original draws every frame at one seed (the same seed keeps frames alike).
+ const seed = input.seed !== undefined ? { seed: input.seed } : original ? { seed: FRAME_SEED } : {};
if (input.engine === "open") {
+ const loras = original ? (input.loras ?? mixedLoras(input.preset.id)) : [];
return {
final: "render",
steps: [
@@ -598,9 +694,11 @@ export function planMixed(input: MixedPlanInput): { steps: PlanStep[]; final: st
...base,
feature: MIXED_FEATURE,
title: input.title,
+ ...(original && { engine: "open" as const }),
modelId: input.modelId,
op: "v2v",
- prompt: prompts.frame,
+ prompt: withTrigger(prompts.frame, loras),
+ ...(loras.length && { loras }),
inputs: { video: input.source.url },
// frames: exactly floor(seconds × fps), as the page counts them (the graph's own count would add one).
params: {
@@ -712,9 +810,20 @@ export function planMixedFrames(input: MixedPlanInput): { steps: PlanStep[]; fin
});
});
const lane = FRAME_LIMITS.lane;
+ // The Original draws every frame on its own (the frame's outlines, the look's LoRA, one seed): no lanes, no second picture.
+ const original = input.modelId === MIXED_ORIGINAL ? originalFrameRequest({ ...input, resolution: frameResolution(n, input.resolution), seed }) : null;
for (let i = 0; i < n; i++) {
const w = Math.floor(i / FRAME_LIMITS.perExtract);
const frame = { slot: "images" as const, index: i - w * FRAME_LIMITS.perExtract, of: windows[w].count, position: "first" as const };
+ if (original) {
+ add(`Frame ${i + 1} of ${n}`, {
+ key: `f${i}`,
+ request: { ...base, ...feeds, feature: MIXED_FRAME_FEATURE, ...original },
+ after: [`frames${w + 1}`],
+ chain: [frame],
+ });
+ continue;
+ }
// The styled picture it matches: the frame before it in its lane, else the approved preview, else the first styled frame.
const ref = i % lane ? `f${i - 1}` : input.anchor ? null : i ? "f0" : null;
add(`Frame ${i + 1} of ${n}`, {
@@ -777,21 +886,69 @@ export function planMixedFrames(input: MixedPlanInput): { steps: PlanStep[]; fin
return { steps, final: "final" };
}
+/**
+ * Smooth (both engines): the clip in pieces (on your GPU 81 frames at 16 fps, 480p; on fal up to 240 frames at the clip's
+ * own rate, 720p), each piece's first frame drawn in the look by the Original (the preview's route and seed), then Fuobe
+ * Shorts' Wan 2.2 Fun VACE carries that frame through every frame by depth; the pieces are joined and the cut's own
+ * sound put back. The Shorts chain, in the clip's own shape, with the first frame swapped for the Original's.
+ */
+export function planMixedSmooth(input: MixedPlanInput): { steps: PlanStep[]; final: string } {
+ const look: ShortsLook = { presetId: input.preset.id, name: input.preset.name, look: mixedLook(input.preset, input.values) };
+ const w = input.sourceSize?.width;
+ const h = input.sourceSize?.height;
+ const plan = planShorts({
+ engine: input.engine,
+ title: input.title,
+ source: { url: input.source.url, duration: input.source.duration, hasAudio: input.source.hasAudio, width: w, height: h, ...(input.sourceFps && { fps: input.sourceFps }) },
+ range: input.range,
+ look,
+ aspectRatio: (w ?? 16) >= (h ?? 9) ? "16:9" : "9:16",
+ keepShape: true,
+ language: "auto",
+ modelId: MIXED_SMOOTH_MODEL,
+ maxRefs: 0,
+ ...(input.engine === "cloud" && { resolution: "720p" }),
+ seed: input.seed ?? FRAME_SEED,
+ });
+ const final = plan.final ?? plan.takes[0].look;
+ const frame = originalFrameRequest({ ...input, resolution: input.resolution === "1K" ? "1K" : "2K" });
+ const frameKeys = new Set(plan.takes.map((t) => t.frame));
+ const steps = plan.steps.map((s) => {
+ let request: GenerationRequest = s.key === final ? { ...s.request, feature: MIXED_FEATURE, title: input.title } : { ...s.request, feature: MIXED_STEP_FEATURE };
+ if (frameKeys.has(s.key)) request = { ...request, ...frame, inputs: undefined };
+ return { ...s, request };
+ });
+ return { steps, final };
+}
+
/** One frame with the current settings. Open: the per-frame model on one frame; cloud: an image edit of the frame the browser grabbed. */
export function planMixedPreview(input: MixedPlanInput & { frameUrl?: string }): PlanStep {
const prompts = mixedPrompts(input.preset, input.values);
const title = `${input.preset.name} · preview`;
+ const original = input.modelId === MIXED_ORIGINAL && input.mode !== "fast";
+ // The Original in the cloud (Per frame and Smooth): its frame route on the grabbed frame, with the render's seed, look and size.
+ if (original && input.engine === "cloud") {
+ const count = input.sourceFps ? frameSampling(input.range.end - input.range.start, input.fps, input.sourceFps).frames : 0;
+ const frame = originalFrameRequest({ ...input, resolution: input.mode === "smooth" ? input.resolution : frameResolution(count, input.resolution) });
+ return { key: "preview", request: { feature: MIXED_PREVIEW_FEATURE, title, ...frame, inputs: { images: input.frameUrl ? [input.frameUrl] : [] } } };
+ }
if (input.engine === "open") {
+ // The per-frame graph on the selection's first frame: on your GPU the Original's preview (and Smooth's first frame) is
+ // drawn with the render's look, LoRA and seed.
+ const loras = input.modelId === MIXED_OPEN_LEGACY ? [] : (input.loras ?? mixedLoras(input.preset.id));
+ const seed = input.seed ?? (input.modelId === MIXED_OPEN_LEGACY ? undefined : FRAME_SEED);
return {
key: "preview",
request: {
feature: MIXED_PREVIEW_FEATURE,
title,
- modelId: MIXED_TOOLS.open.preview,
+ ...(input.modelId !== MIXED_OPEN_LEGACY && { engine: "open" as const }),
+ modelId: input.modelId === MIXED_OPEN_LEGACY ? MIXED_OPEN_LEGACY : MIXED_TOOLS.open.preview,
op: "v2v",
- prompt: prompts.frame,
+ prompt: withTrigger(prompts.frame, loras),
+ ...(loras.length && { loras }),
inputs: { video: input.source.url },
- params: { startTime: input.range.start, fps: input.fps, aspectRatio: "auto", resolution: input.resolution, ...(input.seed !== undefined ? { seed: input.seed } : {}), extra: { denoise: denoiseFor(input.values), frames: 1 } },
+ params: { startTime: input.range.start, fps: input.fps, aspectRatio: "auto", resolution: input.resolution, ...(seed !== undefined ? { seed } : {}), extra: { denoise: denoiseFor(input.values), frames: 1 } },
},
};
}
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index 69aa1a63..265d0c10 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -615,6 +615,14 @@ function videoMegapixels(model: ModelDef, params: GenParams, seconds: number): n
return frames === undefined ? undefined : (width * height * frames) / 1e6;
}
+/** The megapixels of a size sent as params.extra.image_size {width, height}, if one is. */
+function sentMegapixels(params: GenParams): number | undefined {
+ const size = params.extra?.image_size as { width?: unknown; height?: unknown } | undefined;
+ const w = Number(size?.width);
+ const h = Number(size?.height);
+ return Number.isFinite(w) && Number.isFinite(h) && w > 0 && h > 0 ? (w * h) / (1024 * 1024) : undefined;
+}
+
/** Rough USD estimate for a plan (BYO-key cloud runs). Open-source runs are free. */
export function estimateCost(model: ModelDef, params: GenParams, jobs = 1, op?: Operation, withLoras = false): number | null {
if (model.engine === "open" || !model.pricing) return model.engine === "open" ? 0 : null;
@@ -627,9 +635,10 @@ export function estimateCost(model: ModelDef, params: GenParams, jobs = 1, op?:
let per = usd;
const clip = op && CLIP_LENGTH_OPS.has(op) && params.sourceDuration && params.sourceDuration > 0 ? params.sourceDuration * (op === "interpolate" ? Math.max(1, params.slowdown ?? 1) : 1) : undefined;
if (p.unit === "image") per = usd * n;
- // Per megapixel of every image made: Soul's sizes are known (about 1 or 2 MP); other models are taken as 1 MP.
+ // Per megapixel of every image made: Soul's sizes are known (about 1 or 2 MP), so is a size sent as fal's image_size
+ // {width, height} (Fuobe Mixed Media's frames); other models are taken as 1 MP.
if (p.unit === "megapixel") {
- const mp = soulKind(model) ? soulMegapixels(params.aspectRatio ?? model.defaults?.aspectRatio, params.resolution ?? model.defaults?.resolution) : 1;
+ const mp = soulKind(model) ? soulMegapixels(params.aspectRatio ?? model.defaults?.aspectRatio, params.resolution ?? model.defaults?.resolution) : (sentMegapixels(params) ?? 1);
per = usd * (p.roundUp ? Math.ceil(mp - 1e-9) : mp) * n;
}
if (p.unit === "second") {
diff --git a/src/lib/catalog/shorts-models.ts b/src/lib/catalog/shorts-models.ts
index 989ebc7b..b71c120c 100644
--- a/src/lib/catalog/shorts-models.ts
+++ b/src/lib/catalog/shorts-models.ts
@@ -1,34 +1,43 @@
/**
* What the Shorts Studio and Mixed Media restyle models can take, read from their routes (field
* maps), and slim rows for the pages. Uses the full catalog, so it runs on the server (pages and
- * src/server/shorts.ts, src/server/mixed-media.ts); the browser gets the rows.
+ * src/server/shorts.ts, src/server/mixed-media.ts); the browser gets the rows. A Fuobe Original runs on
+ * both engines: each answer is for the engine asked about (its default engine when none is named).
*/
+import { onEngine } from "./engines";
import { getModel } from "./index";
import { routesFor } from "./plan";
-import { SHORTS } from "./shorts";
+import { SHORTS, SHORTS_ORIGINAL } from "./shorts";
import type { Engine, ModelDef } from "./types";
-/** How many reference images a restyle model takes on every route (0: it restyles from words only). */
-export function maxRefsFor(modelId: string): number {
+/** The model as it runs on `engine` (an Original keeps that engine's routes only). */
+function view(modelId: string, engine?: Engine): ModelDef | undefined {
const m = getModel(modelId);
+ return m && engine ? onEngine(m, engine) : m;
+}
+
+/** How many reference images a restyle model takes on every route (0: it restyles from words only). */
+export function maxRefsFor(modelId: string, engine?: Engine): number {
+ const m = view(modelId, engine);
if (!m) return 0;
- if (m.engine === "open") return SHORTS.openReferences;
+ // The open chain and Fuobe Shorts (both engines) send them to the first frame's edit, as images 2 and 3.
+ if (m.engine === "open" || modelId === SHORTS_ORIGINAL) return SHORTS.openReferences;
const routes = routesFor(m, "v2v");
if (!routes.length || !routes.every((r) => r.map?.images)) return 0;
return Math.min(SHORTS.maxReferences, m.options.maxImages ?? 4);
}
/** Whether every v2v route of a cloud model reads an image (LTX: the first frame; Kling, Happy Horse: references). */
-export function takesImage(modelId: string): boolean {
- const m = getModel(modelId);
+export function takesImage(modelId: string, engine?: Engine): boolean {
+ const m = view(modelId, engine);
if (!m || m.engine !== "cloud") return false;
const routes = routesFor(m, "v2v");
return routes.length > 0 && routes.every((r) => r.map?.image || r.map?.images);
}
/** Whether every v2v route can be asked for an aspect ratio (else the output keeps the clip's shape). */
-export function reframes(modelId: string): boolean {
- const m = getModel(modelId);
+export function reframes(modelId: string, engine?: Engine): boolean {
+ const m = view(modelId, engine);
if (!m) return false;
if (m.engine === "open") return true;
const routes = routesFor(m, "v2v");
@@ -53,8 +62,8 @@ export function sourceSeconds(modelId: string): { min?: number; max?: number } {
}
/** The cloud model's 720p setting, when it has one (Higgsfield renders Shorts at 720p). */
-export function resolutionFor(modelId: string): string | undefined {
- const m = getModel(modelId);
+export function resolutionFor(modelId: string, engine?: Engine): string | undefined {
+ const m = view(modelId, engine);
return m?.engine === "cloud" && m.options.resolutions?.includes("720p") ? "720p" : undefined;
}
@@ -77,29 +86,36 @@ export interface RestyleModelInfo {
maxSeconds?: number;
}
-/** What one unit costs at the resolution the studios ask for, counting input seconds when the model bills them. */
+/**
+ * What one unit costs at the resolution the studios ask for, counting input seconds when the model bills them. Fuobe
+ * Shorts in the cloud bills frames ÷ 16 as seconds: a second of a 30 fps clip, the common case, is shown.
+ */
export function unitPrice(m: ModelDef): number | null {
const p = m.pricing;
if (!p) return null;
- const res = resolutionFor(m.id) ?? m.defaults?.resolution;
+ const res = resolutionFor(m.id, m.engine) ?? m.defaults?.resolution;
const usd = (res && p.byResolution?.[res]) || p.usd;
+ if (m.id === SHORTS_ORIGINAL && p.unit === "second") return (usd * SHORTS.original.maxFps) / SHORTS.original.billFps;
return p.unit === "second" && p.inputSeconds ? usd * 2 : usd;
}
+const UNIT: Record<string, string> = { second: "s", megapixel: "MP" };
+
function priceLine(m: ModelDef): string | null {
if (m.engine === "open") return "Free · your GPU";
const p = m.pricing;
const v = unitPrice(m);
if (!p || v === null) return null;
const usd = v < 0.1 ? v.toFixed(3).replace(/0$/, "") : v.toFixed(2);
- return `$${usd} / ${p.unit === "second" ? "s" : p.unit}`;
+ return `$${usd} / ${UNIT[p.unit] ?? p.unit}${m.id === SHORTS_ORIGINAL ? " at 30 fps" : ""}`;
}
-/** Slim model rows for a studio page (so the browser needs no catalog). */
-export function modelInfos(ids: string[]): RestyleModelInfo[] {
+/** Slim model rows for a studio page (so the browser needs no catalog), as each runs on `engine`. */
+export function modelInfos(ids: string[], engine?: Engine): RestyleModelInfo[] {
return ids.flatMap((id) => {
- const m = getModel(id);
- if (!m) return [];
+ const found = getModel(id);
+ if (!found) return [];
+ const m = engine ? onEngine(found, engine) : found;
return [
{
id,
@@ -107,9 +123,9 @@ export function modelInfos(ids: string[]): RestyleModelInfo[] {
vendor: m.vendor,
tagline: m.tagline,
engine: m.engine,
- refs: maxRefsFor(id),
- image: takesImage(id),
- reframes: reframes(id),
+ refs: maxRefsFor(id, m.engine),
+ image: takesImage(id, m.engine),
+ reframes: reframes(id, m.engine),
price: priceLine(m),
...(m.options.resolutions ? { resolutions: m.options.resolutions } : {}),
...(sourceSeconds(id).min ? { minSeconds: sourceSeconds(id).min } : {}),
diff --git a/src/lib/catalog/shorts.ts b/src/lib/catalog/shorts.ts
index b383a23f..6717c3e9 100644
--- a/src/lib/catalog/shorts.ts
+++ b/src/lib/catalog/shorts.ts
@@ -4,8 +4,14 @@
* cloud models, ≤5 s = 81 frames at 16 fps on the open engine), each segment is restyled, and the
* segments are stitched back together under the original sound.
*
+ * Fuobe Shorts (build plan O9) is the default on both engines: each segment's first frame drawn in the look
+ * (Qwen-Image-Edit 2511), then Wan 2.2 Fun VACE carries it through every frame by depth, on your GPU (81 frames at
+ * 16 fps a segment) or on fal (pieces of up to 241 frames at the clip's own rate). Gemini Omni Flash (Higgsfield's
+ * Shorts engine) and the other partner models stay as choices.
+ *
* Pure module (presets, limits, segment planning, prompts, the pipeline's steps), shared by the
- * page, the server (src/server/shorts.ts) and the tests. Research: docs/research/higgsfield-studios.md §2.
+ * page, the server (src/server/shorts.ts) and the tests. Research: docs/research/higgsfield-studios.md §2,
+ * docs/research/fuobe-originals-recipes-5.md (studios[shorts]).
*/
import { scenePoster, type PresetPreview, type PreviewFx, type PreviewScene } from "../preset-cards";
import type { ChainSlot, Engine, Generation, GenerationRequest } from "./types";
@@ -24,8 +30,13 @@ export const SHORTS = {
openFps: 16,
openMaxFrames: 81,
maxReferences: 10,
- /** Qwen-Image-Edit takes the frame plus two references. */
+ /** Qwen-Image-Edit takes the frame plus two references (the Original's first frame, on both engines). */
openReferences: 2,
+ /**
+ * Fuobe Shorts in the cloud: fal's Wan 2.2 Fun VACE makes 17–241 frames at 5–30 fps, matching its input clip's count and
+ * rate. A clip above 30 fps is worked at half (a third…) its rate and brought back (temporal_downsample_factor).
+ */
+ original: { maxFrames: 240, maxFps: 30, billFps: 16 },
accept: "video/mp4,video/quicktime,video/webm,.mp4,.mov,.m4v,.webm",
} as const;
@@ -72,15 +83,21 @@ export const SHORTS_LANGUAGES = [
"Vietnamese",
] as const;
-/** Restyle models per engine; the first is the default (Gemini Omni Flash is Higgsfield's Shorts engine). */
+/** Shorts Studio's Original (O9): the open Shorts chain on both engines. */
+export const SHORTS_ORIGINAL = "fuobe-shorts";
+
+/**
+ * Restyle models per engine; the first is the default: Fuobe Shorts. Gemini Omni Flash (Higgsfield's Shorts engine) and
+ * the other partner models stay as choices in the cloud.
+ */
export const SHORTS_MODELS: Record<Engine, string[]> = {
- cloud: ["gemini-omni-flash", "kling-o3-4k-edit", "happy-horse-video-edit", "lucy-edit-pro", "runway-aleph-2", "ltx-2-3-restyle", "wan-2-7"],
- open: ["oss-wan22-vace-restyle"],
+ cloud: [SHORTS_ORIGINAL, "gemini-omni-flash", "kling-o3-4k-edit", "happy-horse-video-edit", "lucy-edit-pro", "runway-aleph-2", "ltx-2-3-restyle", "wan-2-7"],
+ open: [SHORTS_ORIGINAL],
};
-/** The helper models of the pipeline. */
+/** The helper models of the pipeline (the cloud Original's first frame: `still` takes it, `frame` restyles it). */
export const SHORTS_TOOLS = {
- cloud: { cut: "trim-video", trim: "trim-video", fit: "scale-video", join: "join-clips", mux: "merge-audio-video", joinMax: 24 },
+ cloud: { cut: "trim-video", trim: "trim-video", fit: "scale-video", still: "extract-frame", frame: "qwen-image-edit-2511-cloud", join: "join-clips", mux: "merge-audio-video", joinMax: 24 },
open: { cut: "oss-segment", trim: "oss-trim", frame: "oss-qwen-edit", join: "oss-join-clips", mux: "oss-mux", joinMax: 4 },
} as const;
@@ -343,8 +360,32 @@ export function planOpenSegments(range: ShortsRange, fps: number = SHORTS.openFp
return out;
}
-export function planSegments(range: ShortsRange, engine: Engine): ShortsSegment[] {
- return engine === "open" ? planOpenSegments(range) : planCloudSegments(range);
+/**
+ * fal's Wan 2.2 Fun VACE works at up to 30 fps: a faster clip is worked at a whole fraction of its rate and brought back
+ * (its temporal_downsample_factor: 1 skips every other frame). 0 for 30 fps and below.
+ */
+export function vaceDownsample(fps: number | undefined): number {
+ return fps && fps > SHORTS.original.maxFps + 0.01 ? Math.ceil(fps / SHORTS.original.maxFps - 1e-6) - 1 : 0;
+}
+
+/**
+ * The longest segment Fuobe Shorts takes in the cloud: up to 241 frames as fal works them (240 here, so a rounded cut
+ * never tips over), at most 10 s. An unknown rate counts as 30 fps (8 s segments).
+ */
+export function originalSegmentSeconds(fps?: number): number {
+ const rate = fps && fps > 0 ? fps / (vaceDownsample(fps) + 1) : SHORTS.original.maxFps;
+ return Math.min(SHORTS.cloudSegmentSeconds, Math.floor((SHORTS.original.maxFrames / rate) * 100) / 100);
+}
+
+/** Segments for a model: the open engine's 81-frame windows, Fuobe Shorts' frame-limited pieces, or ≤10 s cuts. */
+export function planSegments(range: ShortsRange, engine: Engine, model?: { modelId?: string; fps?: number }): ShortsSegment[] {
+ if (engine === "open") return planOpenSegments(range);
+ return model?.modelId === SHORTS_ORIGINAL ? planCloudSegments(range, originalSegmentSeconds(model.fps)) : planCloudSegments(range);
+}
+
+/** The seconds fal bills for a Fuobe Shorts segment: its frames ÷ 16 ("video seconds"); an unknown rate counts as 30 fps. */
+export function originalBilledSeconds(seconds: number, fps?: number): number {
+ return Math.round(((seconds * (fps && fps > 0 ? fps : SHORTS.original.maxFps)) / SHORTS.original.billFps) * 1e6) / 1e6;
}
/** Groups of at most `max` consecutive items, as even as possible (5 by 4 → 3 + 2, never 4 + 1). */
@@ -378,7 +419,8 @@ export interface PlanStep {
export interface ShortsPlanInput {
engine: Engine;
title: string;
- source: { url: string; duration?: number; hasAudio?: boolean; width?: number; height?: number };
+ /** fps: the clip's own frame rate (Fuobe Shorts in the cloud: its pieces are frame-limited and billed on frames). */
+ source: { url: string; duration?: number; hasAudio?: boolean; width?: number; height?: number; fps?: number };
range: ShortsRange;
look: ShortsLook;
aspectRatio: ShortsRatio;
@@ -390,7 +432,7 @@ export interface ShortsPlanInput {
*/
keepShape?: boolean;
language: string;
- /** The restyle model (cloud: SHORTS_MODELS.cloud; open: oss-wan22-vace-restyle). */
+ /** The restyle model (SHORTS_MODELS; Fuobe Shorts runs as a chain of its own on both engines). */
modelId: string;
/** How many reference images the restyle model takes (0: it restyles from words only). */
maxRefs: number;
@@ -409,6 +451,9 @@ export interface TakeKeys {
cut: string;
/** Cloud: the cut cropped to the output ratio. */
fit?: string;
+ /** Fuobe Shorts in the cloud: the segment's first frame, taken out of the cut (the open cut makes it itself). */
+ still?: string;
+ /** The first frame in the new look (Fuobe Shorts, both engines). */
frame?: string;
look: string;
}
@@ -419,13 +464,16 @@ const ratioParams = (input: Pick<ShortsPlanInput, "engine" | "aspectRatio" | "ke
const segLabel = (s: ShortsSegment, n: number, what: string) => ({ label: `Segment ${s.index + 1} of ${n} · ${what}`, index: s.index, of: n });
-/** Which references go where: the cloud model's own reference slot, or images 2–3 of the open first-frame edit. */
-export function refsFor(input: Pick<ShortsPlanInput, "engine" | "look" | "maxRefs">): string[] {
+/** Which references go where: the cloud model's own reference slot, or images 2–3 of the first-frame edit (open, and Fuobe Shorts). */
+export function refsFor(input: Pick<ShortsPlanInput, "engine" | "look" | "maxRefs" | "modelId">): string[] {
const refs = input.look.references ?? [];
- if (input.engine === "open") return refs.slice(0, SHORTS.openReferences);
+ if (input.engine === "open" || input.modelId === SHORTS_ORIGINAL) return refs.slice(0, SHORTS.openReferences);
return refs.slice(0, Math.max(0, input.maxRefs));
}
+/** The engine an Original's step runs on (a model on one engine ignores it). */
+const originalEngine = (input: Pick<ShortsPlanInput, "engine" | "modelId">) => (input.modelId === SHORTS_ORIGINAL ? { engine: input.engine } : {});
+
/** One take of one segment: cut it out, (open: restyle its first frame,) restyle it. */
export function planTake(input: ShortsPlanInput, seg: ShortsSegment, total: number, suffix = ""): { steps: PlanStep[]; keys: TakeKeys } {
const t = SHORTS_TOOLS[input.engine];
@@ -468,6 +516,7 @@ export function planTake(input: ShortsPlanInput, seg: ShortsSegment, total: numb
key: keys.look,
request: {
...base,
+ ...originalEngine(input),
modelId: input.modelId,
op: "v2v",
prompt: segmentPrompt(input.look),
@@ -481,6 +530,7 @@ export function planTake(input: ShortsPlanInput, seg: ShortsSegment, total: numb
};
}
const fit = !input.keepShape && !input.reframes && needsFit(input.source, input.aspectRatio);
+ if (input.modelId === SHORTS_ORIGINAL) return planOriginalTake(input, seg, total, k, fit, refs);
const keys: TakeKeys = { cut: k("cut"), ...(fit ? { fit: k("fit") } : {}), look: k("look") };
const seconds = seg.end - seg.start;
return {
@@ -527,6 +577,89 @@ export function planTake(input: ShortsPlanInput, seg: ShortsSegment, total: numb
};
}
+/**
+ * Fuobe Shorts in the cloud: cut the segment (cropped to the output ratio when it isn't), take its first frame, draw it in
+ * the look with Qwen-Image-Edit 2511 (the look's references as images 2 and 3), then fal's Wan 2.2 Fun VACE carries that
+ * frame through every frame of the cut by depth, keeping its frame count and rate (a clip above 30 fps is worked at a
+ * fraction of its rate and brought back). Billed on frames ÷ 16, like every fal Wan VACE route.
+ */
+function planOriginalTake(input: ShortsPlanInput, seg: ShortsSegment, total: number, k: (what: string) => string, fit: boolean, refs: string[]): { steps: PlanStep[]; keys: TakeKeys } {
+ const t = SHORTS_TOOLS.cloud;
+ const base = { feature: SHORTS_FEATURE, batchTitle: input.title };
+ const helper = { feature: SHORTS_STEP_FEATURE, batchTitle: input.title };
+ const seed = input.seed !== undefined ? { seed: input.seed } : {};
+ const keys: TakeKeys = { cut: k("cut"), ...(fit ? { fit: k("fit") } : {}), still: k("still"), frame: k("frame"), look: k("look") };
+ const clip = keys.fit ?? keys.cut;
+ const seconds = seg.end - seg.start;
+ const downsample = vaceDownsample(input.source.fps);
+ return {
+ keys,
+ steps: [
+ {
+ key: keys.cut,
+ request: { ...helper, modelId: t.cut, op: "trim", inputs: { video: input.source.url }, params: { startTime: seg.start, endTime: seg.end }, step: segLabel(seg, total, "cut") },
+ },
+ ...(keys.fit
+ ? [
+ {
+ key: keys.fit,
+ request: {
+ ...helper,
+ modelId: t.fit,
+ op: "reframe" as const,
+ params: { aspectRatio: input.aspectRatio, extra: { ...fitSize(input.aspectRatio) } },
+ step: segLabel(seg, total, `crop to ${input.aspectRatio}`),
+ },
+ after: [keys.cut],
+ chain: [{ slot: "video" as const }],
+ },
+ ]
+ : []),
+ {
+ key: keys.still!,
+ request: { ...helper, modelId: t.still, op: "frame", params: { extra: { frame_type: "first" } }, step: segLabel(seg, total, "first frame") },
+ after: [clip],
+ chain: [{ slot: "video" }],
+ },
+ {
+ key: keys.frame!,
+ request: {
+ ...helper,
+ modelId: t.frame,
+ op: "edit",
+ prompt: firstFramePrompt(input.look, input.language, refs.length),
+ ...(refs.length ? { inputs: { images: refs } } : {}),
+ params: { ...seed },
+ step: segLabel(seg, total, "first frame in the look"),
+ },
+ after: [keys.still!],
+ chain: [{ slot: "images", position: "first" }],
+ },
+ {
+ key: keys.look,
+ request: {
+ ...base,
+ engine: "cloud",
+ modelId: input.modelId,
+ op: "v2v",
+ prompt: segmentPrompt(input.look),
+ // fal bills frames ÷ 16 as "video seconds" (duration); sourceDuration is the cut's own length.
+ params: {
+ duration: originalBilledSeconds(seconds, input.source.fps),
+ sourceDuration: r3(seconds),
+ ...(input.resolution ? { resolution: input.resolution } : {}),
+ ...seed,
+ ...(downsample ? { extra: { temporal_downsample_factor: downsample } } : {}),
+ },
+ step: segLabel(seg, total, "restyle"),
+ },
+ after: [clip, keys.frame!],
+ chain: [{ slot: "video" }, { slot: "images", position: "first" }],
+ },
+ ],
+ };
+}
+
/** The size a cut is cropped to before a restyle that keeps its input's shape (1080 on the short side). */
export function fitSize(ratio: ShortsRatio): { width: number; height: number } {
return ratio === "9:16" ? { width: 1080, height: 1920 } : { width: 1920, height: 1080 };
@@ -622,7 +755,7 @@ export function planStitch(input: ShortsPlanInput, clips: ClipRef[], suffix = ""
/** The whole session: every segment's first take, the stitch and the soundtrack. */
export function planShorts(input: ShortsPlanInput): { segments: ShortsSegment[]; steps: PlanStep[]; takes: TakeKeys[]; final?: string } {
- const segments = planSegments(input.range, input.engine);
+ const segments = planSegments(input.range, input.engine, { modelId: input.modelId, fps: input.source.fps });
const takes = segments.map((s) => planTake(input, s, segments.length));
const stitch = planStitch(
input,
@@ -639,6 +772,8 @@ export interface ShortsTake {
cut: string;
/** Cloud: the cut cropped to the output ratio. */
fit?: string;
+ /** Fuobe Shorts in the cloud: the segment's first frame. */
+ still?: string;
frame?: string;
look: string;
createdAt: number;
@@ -666,7 +801,7 @@ export interface ShortsSession {
engine: Engine;
batchId: string;
look: ShortsLook;
- source: { url: string; name?: string; duration?: number; hasAudio?: boolean; width?: number; height?: number };
+ source: { url: string; name?: string; duration?: number; hasAudio?: boolean; width?: number; height?: number; fps?: number };
range: ShortsRange;
settings: { aspectRatio: ShortsRatio; language: string; modelId: string; resolution?: string; maxRefs: number; reframes?: boolean };
segments: ShortsSessionSegment[];
@@ -747,10 +882,11 @@ export function chainState(steps: { g?: Generation; label: string }[]): ChainSta
}
/** A take's steps with their labels. */
-export function takeSteps(t: Pick<ShortsTake, "cut" | "fit" | "frame" | "look">, gens: Record<string, Generation>): { g?: Generation; label: string }[] {
+export function takeSteps(t: Pick<ShortsTake, "cut" | "fit" | "still" | "frame" | "look">, gens: Record<string, Generation>): { g?: Generation; label: string }[] {
return [
{ g: gens[t.cut], label: "Cutting the segment" },
...(t.fit ? [{ g: gens[t.fit], label: "Cropping the segment" }] : []),
+ ...(t.still ? [{ g: gens[t.still], label: "Taking the first frame" }] : []),
...(t.frame ? [{ g: gens[t.frame], label: "Restyling the first frame" }] : []),
{ g: gens[t.look], label: "Restyling" },
];
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index d5c2460e..d46cf262 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -1069,7 +1069,10 @@ export interface Preset {
prestep?: PresetPrestep;
}
-/** A step whose picture becomes a preset's start frame (Fuobe DoP relights the still, then animates it). */
+/**
+ * A step whose picture becomes a preset's start frame (Fuobe DoP relights the still, or draws it in a Mixed Media look
+ * on Fuobe Mixed Media, then animates it).
+ */
export interface PresetPrestep {
open: PrestepRoute;
cloud: PrestepRoute;
@@ -1080,6 +1083,10 @@ export interface PrestepRoute {
op: Operation;
prompt: string;
loras?: LoraRef[];
+ /** The step's own settings (Fuobe Mixed Media: its seed, control scale or strength). */
+ params?: GenParams;
+ /** What the step and the clip after it are called in a run ("Start frame in the look", "Restyled clip"); relight's when unset. */
+ labels?: { step: string; clip: string };
/** What the step costs (a 1-megapixel picture), added to the clip's price before the run; 0 on the user's GPU. */
usd?: number;
}
diff --git a/src/server/chains.ts b/src/server/chains.ts
index a4b73289..7743433e 100644
--- a/src/server/chains.ts
+++ b/src/server/chains.ts
@@ -5,7 +5,7 @@ import { MODEL3D_STEP_FEATURE, stillPromptFor3d } from "@/lib/av/model3d";
import { chainTiming, frameTimes, planKeyframeClips, spread } from "@/lib/catalog/keyframes";
import { onEngine } from "@/lib/catalog/engines";
import { routesFor } from "@/lib/catalog/plan";
-import type { ChainSlot, Engine, Generation, GenerationRequest, LoraRef, ModelDef, ModelRoute, Operation } from "@/lib/catalog/types";
+import type { ChainSlot, Engine, GenParams, Generation, GenerationRequest, LoraRef, ModelDef, ModelRoute, Operation } from "@/lib/catalog/types";
import { db } from "./db";
import { cancelGeneration, chooseRoute, createGenerations, getGeneration, previewChained, previewGeneration } from "./generations";
import { provider } from "./providers";
@@ -362,27 +362,34 @@ export function createStillTo3d(original: GenerationRequest, model: ModelDef, ro
* Fuobe DoP's relight effects (Silhouette, Window, Practicals…): the start frame is relit first (Qwen-Image-Edit 2509
* with its Relight LoRA, on the engine the clip runs on), then animated with the effect's words. One batch of two steps.
*/
-export function createRelitClip(original: GenerationRequest, relight: { engine: Engine; step: { modelId: string; op: Operation; prompt: string; loras?: LoraRef[] } }): Generation[] {
+export function createRelitClip(
+ original: GenerationRequest,
+ relight: { engine: Engine; step: { modelId: string; op: Operation; prompt: string; loras?: LoraRef[]; params?: GenParams; labels?: { step: string; clip: string } } },
+): Generation[] {
const [image, ...rest] = original.inputs?.images ?? [];
- if (!image) throw new Error("Add a start frame to relight");
const { engine, step } = relight;
+ const mixed = !!step.labels;
+ if (!image) throw new Error(mixed ? "Add a start frame to draw in the look" : "Add a start frame to relight");
// The clip runs on the engine asked for, never quietly on the other one (createGenerations refuses an engine that is off).
const where = (e: Engine) => (e === "open" ? "on your GPU" : "in the cloud");
- if (original.engine && original.engine !== engine) throw new Error(`This relight effect was planned ${where(engine)}, but ${where(original.engine)} was asked for`);
+ if (original.engine && original.engine !== engine) throw new Error(`This ${mixed ? "effect" : "relight effect"} was planned ${where(engine)}, but ${where(original.engine)} was asked for`);
assertOneMode([
- { label: "Relighting the start frame", modelId: step.modelId, op: step.op, engine },
+ { label: step.labels?.step ?? "Relighting the start frame", modelId: step.modelId, op: step.op, engine },
{ label: getModel(original.modelId)?.name ?? original.modelId, modelId: original.modelId, op: original.op ?? "i2v", engine },
]);
const batchId = nanoid(10);
const relit = createGenerations(
{
feature: original.feature,
+ // The step's model may run on both engines (Fuobe Mixed Media): it runs on the clip's.
+ engine,
modelId: step.modelId,
op: step.op,
prompt: step.prompt,
inputs: { images: [image] },
...(step.loras?.length && { loras: step.loras }),
- step: { label: "Relit start frame", index: 0, of: 2 },
+ ...(step.params && { params: step.params }),
+ step: { label: step.labels?.step ?? "Relit start frame", index: 0, of: 2 },
},
{ batchId },
)[0];
@@ -393,7 +400,7 @@ export function createRelitClip(original: GenerationRequest, relight: { engine:
engine,
inputs: { ...original.inputs, images: rest.length ? rest : undefined },
chain: [{ slot: "images", position: "first" }],
- step: { label: "Relit clip", index: 1, of: 2 },
+ step: { label: step.labels?.clip ?? "Relit clip", index: 1, of: 2 },
},
{ batchId, dependsOn: relit.id },
)[0];
diff --git a/src/server/mixed-media.ts b/src/server/mixed-media.ts
index 2a86ccb9..f6254393 100644
--- a/src/server/mixed-media.ts
+++ b/src/server/mixed-media.ts
@@ -11,7 +11,12 @@ import {
MIXED_FRAME_FEATURE,
MIXED_FRAME_MODELS,
MIXED_MODELS,
+ MIXED_MODES,
+ MIXED_OPEN_LEGACY,
+ MIXED_ORIGINAL,
+ MIXED_SMOOTH_MODEL,
mixedFrames,
+ mixedLoras,
mixedRangeProblem,
nearestResolution,
planMixed,
@@ -20,12 +25,13 @@ import {
type MixedPlanInput,
type MixedResolution,
} from "@/lib/catalog/mixed-media";
-import { clipLengthProblem, type PlanStep } from "@/lib/catalog/shorts";
+import { clipLengthProblem, planSegments, type PlanStep } from "@/lib/catalog/shorts";
import { sourceSeconds, takesImage } from "@/lib/catalog/shorts-models";
import type { Engine, Generation, ProviderId } from "@/lib/catalog/types";
import { createPipeline } from "./chains";
import { db } from "./db";
import { DROPPED_UNUSED, getGeneration, previewChained, unfilledRequest, waitedOnFailure } from "./generations";
+import { withoutUnreachableCivitai } from "./loras";
import { engineMode } from "./settings";
import { probeSource, ShortsError } from "./shorts";
@@ -41,13 +47,14 @@ export interface MixedBody {
engine: Engine;
presetId: string;
values?: Record<string, unknown>;
- source: { url: string; name?: string; duration?: number; fps?: number };
+ /** width / height / fps: what the browser read, for estimates made before the server has the file. */
+ source: { url: string; name?: string; duration?: number; fps?: number; width?: number; height?: number };
range: { start: number; end: number };
fps: number;
resolution: MixedResolution;
- /** Cloud Fast: the restyle model; cloud Per frame: the frame editor (MIXED_FRAME_MODELS). */
+ /** Per frame: the frame model (MIXED_FRAME_MODELS in the cloud, the Original on your GPU); Fast: the restyle model; Smooth: the Original. */
modelId?: string;
- /** Cloud: frame by frame or Fast (one video-to-video pass). Without it, Fast for a Fast restyle model, else Per frame. */
+ /** Frame by frame, Smooth or (cloud) Fast. Without it, Fast for a Fast restyle model, else Per frame. */
mode?: MixedMode;
/** Cloud: the approved preview still (anchors the render: Per frame always, Fast when the model takes an image). */
anchor?: string;
@@ -57,22 +64,34 @@ export interface MixedBody {
}
/**
- * How a cloud render restyles: the mode asked for, else Fast when the model named is a Fast restyle model (an API
- * caller from before Per frame), else Per frame. A model that belongs to the other mode is refused, not swapped.
+ * How a render restyles: the mode asked for, else Fast when the model named is a Fast restyle model (an API caller from
+ * before Per frame), else Per frame. A model that belongs to another mode is refused, not swapped; Smooth is the
+ * Original's own, and Fast is the cloud's.
*/
-function cloudMode(body: Pick<MixedBody, "engine" | "mode" | "modelId">): MixedMode | undefined {
- if (body.engine !== "cloud") return undefined;
+function renderMode(body: Pick<MixedBody, "engine" | "mode" | "modelId">): MixedMode {
const fastModel = !!body.modelId && MIXED_MODELS.cloud.includes(body.modelId);
- const frameModel = !!body.modelId && (MIXED_FRAME_MODELS as readonly string[]).includes(body.modelId);
- const mode = body.mode ?? (fastModel ? "fast" : "frames");
+ const frameModel = !!body.modelId && (MIXED_FRAME_MODELS as readonly string[]).includes(body.modelId) && body.modelId !== MIXED_ORIGINAL;
+ const mode = body.mode ?? (body.engine === "cloud" && fastModel ? "fast" : "frames");
const name = (id: string) => getModel(id)?.name ?? id;
- if (mode === "frames" && fastModel) {
+ if (!MIXED_MODES[body.engine].includes(mode)) throw new ShortsError("Fast runs in the cloud — on your GPU pick Per frame or Smooth", 422);
+ if (body.engine === "cloud" && mode === "frames" && fastModel) {
throw new ShortsError(`${name(body.modelId!)} restyles the clip as video — pick Fast for it, or ${MIXED_FRAME_MODELS.map(name).join(" or ")} to redraw each frame`, 422);
}
- if (mode === "fast" && frameModel) throw new ShortsError(`${name(body.modelId!)} redraws single frames — pick Per frame for it, or a Fast restyle model`, 422);
+ if (mode === "fast" && (frameModel || body.modelId === MIXED_ORIGINAL)) {
+ throw new ShortsError(`${name(body.modelId!)} redraws single frames — pick Per frame${frameModel ? "" : " or Smooth"} for it, or a Fast restyle model`, 422);
+ }
+ if (mode === "smooth" && body.modelId && body.modelId !== MIXED_ORIGINAL) throw new ShortsError(`Smooth is ${name(MIXED_ORIGINAL)}'s own — pick Per frame or Fast for ${name(body.modelId)}`, 422);
return mode;
}
+/** The models a mode chooses from on an engine (the first is its default). */
+function modeModels(engine: Engine, mode: MixedMode): readonly string[] {
+ if (mode === "smooth") return [MIXED_ORIGINAL];
+ if (mode === "fast") return MIXED_MODELS.cloud;
+ // On your GPU, an API caller that names the per-frame model from before the Original keeps it.
+ return engine === "cloud" ? MIXED_FRAME_MODELS : [...MIXED_MODELS.open, MIXED_OPEN_LEGACY];
+}
+
const ordinal = (n: number) => `${n}${n % 100 >= 11 && n % 100 <= 13 ? "th" : (["th", "st", "nd", "rd"][n % 10] ?? "th")}`;
async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ input: MixedPlanInput; frames: number; fps: number; notes: string[] }> {
@@ -88,15 +107,17 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
const problem = mixedRangeProblem(body.range, duration, sourceFps);
if (problem) throw new ShortsError(problem);
const fps = clampFps(body.fps, sourceFps);
- const mode = cloudMode(body);
- const choices: readonly string[] = mode === "frames" ? MIXED_FRAME_MODELS : MIXED_MODELS[body.engine];
+ const mode = renderMode(body);
+ const choices = modeModels(body.engine, mode);
const modelId = body.modelId && choices.includes(body.modelId) ? body.modelId : choices[0];
const model = getModel(modelId);
const len = body.range.end - body.range.start;
const notes: string[] = [];
let frames = mixedFrames(len, fps);
let rate = fps;
- if (mode === "frames") {
+ const size = info.width && info.height ? { width: info.width, height: info.height } : body.source.width && body.source.height ? { width: body.source.width, height: body.source.height } : undefined;
+ const original = modelId === MIXED_ORIGINAL;
+ if (body.engine === "cloud" && mode === "frames") {
// Frames are every Nth frame of the clip: say so when that isn't the rate picked.
if (!sourceFps) throw new ShortsError("Couldn't read this clip's frame rate — pick Fast to restyle it as video", 422);
const s = frameSampling(len, fps, sourceFps);
@@ -104,6 +125,7 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
rate = s.fps;
if (Math.abs(s.fps - fps) > 0.01) notes.push(`Frames are every ${s.interval === 1 ? "" : `${ordinal(s.interval)} `}frame of this ${+sourceFps.toFixed(2)} FPS clip: ${+s.fps.toFixed(2)} FPS, ${frames} frames`);
if (modelId === "seedream-5-flash") notes.push(`Seedream 5.0 Flash takes no seed, so frames vary a little more than with Nano Banana 2${body.resolution === "4K" ? "; it draws up to 2K" : ""}`);
+ else if (original && body.resolution === "4K") notes.push(`${model?.name} draws frames at up to 2K (about 4 megapixels)`);
else if (frames > FRAME_LIMITS.perClip && body.resolution !== "1K") {
// merge-videos sizes the joined clips 512–2048 px a side.
notes.push(`Over ${FRAME_LIMITS.perClip} frames are made as clips and joined at up to ${FRAME_LIMITS.joinMaxPx} px${frameResolution(frames, body.resolution) !== body.resolution ? ", so frames are drawn at 2K" : ""}`);
@@ -118,11 +140,23 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
throw new ShortsError(`${tooShort} — select ${more ? "more" : "less"}${other ? `, or pick ${getModel(other)?.name ?? other}` : ""}`);
}
}
- const anchor = mode === "frames" ? body.anchor : mode === "fast" && body.anchor && takesImage(modelId) ? body.anchor : undefined;
+ // The partner editors start each lane from the approved preview; the Original draws every frame on its own (one seed).
+ const anchor = mode === "frames" && body.engine === "cloud" && !original ? body.anchor : mode === "fast" && body.anchor && takesImage(modelId, "cloud") ? body.anchor : undefined;
if (mode === "fast") {
if (body.anchor && !anchor) notes.push(`${model?.name} restyles from words only — the preview frame isn't sent`);
notes.push(`${model?.name} restyles the clip as smooth video in one pass — Per frame redraws every frame of it instead`);
- } else if (!mode && body.resolution !== "1K") notes.push("The open engine renders up to 1536 px on the long side");
+ } else if (mode === "smooth") {
+ const pieces = planSegments(body.range, body.engine, { modelId: MIXED_SMOOTH_MODEL, fps: sourceFps }).length;
+ notes.push(
+ body.engine === "open"
+ ? `Smooth draws the first frame in the look, then Wan 2.2 Fun VACE carries it through the clip by depth: 480p at 16 fps on your GPU${pieces > 1 ? `, in ${pieces} pieces of up to 5 s` : ""}`
+ : `Smooth draws the first frame in the look, then Wan 2.2 Fun VACE carries it through the clip by depth at 720p${pieces > 1 ? `, in ${pieces} pieces (each starts from its own first frame)` : ""}`,
+ );
+ if (body.engine === "cloud" && sourceFps && sourceFps > 16.5) notes.push(`fal bills this clip's ${Math.round(sourceFps)} fps as ${(sourceFps / 16).toFixed(1)}× its length (video seconds at 16 fps)`);
+ } else if (body.engine === "open" && body.resolution !== "1K") notes.push("The open engine renders up to 1536 px on the long side");
+ // The look's LoRA: one that downloads from civitai needs the civitai key; without it the look runs on its words.
+ const reach = original && mode !== "fast" ? withoutUnreachableCivitai(mixedLoras(preset.id), body.engine === "open" ? "comfyui" : "fal") : undefined;
+ if (reach) notes.push(...reach.notes);
const name = (body.source.name ?? "").replace(/\.[a-z0-9]{2,4}$/i, "").trim().slice(0, 40);
return {
frames,
@@ -141,7 +175,8 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
modelId,
mode,
sourceFps,
- ...(info.width && info.height ? { sourceSize: { width: info.width, height: info.height } } : {}),
+ ...(size && { sourceSize: size }),
+ ...(reach && { loras: reach.loras }),
anchor,
modelResolution: mode === "fast" ? nearestResolution(model?.options.resolutions, body.resolution) : undefined,
// LTX follows the clip's outlines, like the open engine's canny ControlNet.
diff --git a/src/server/shorts-schemas.ts b/src/server/shorts-schemas.ts
index 3dc32d7f..7c981d3c 100644
--- a/src/server/shorts-schemas.ts
+++ b/src/server/shorts-schemas.ts
@@ -51,8 +51,8 @@ export const MixedBodySchema = z.object({
fps: z.number().finite().min(MIXED.manualFps.min).max(MIXED.manualFps.max).default(MIXED.defaultFps),
resolution: z.enum(MIXED.resolutions).default("1K"),
modelId: z.string().max(80).optional(),
- /** Cloud: "frames" (frame by frame, the default) or "fast" (one video-to-video pass). */
- mode: z.enum(["frames", "fast"]).optional(),
+ /** "frames" (frame by frame, the default), "smooth" (the Original's first frame, then Wan 2.2 Fun VACE by depth) or, in the cloud, "fast" (one video-to-video pass). */
+ mode: z.enum(["frames", "smooth", "fast"]).optional(),
anchor: fileUrl.optional(),
frameUrl: fileUrl.optional(),
seed: z.number().int().min(0).max(2 ** 48).optional(),
diff --git a/src/server/shorts.ts b/src/server/shorts.ts
index 4d761f01..b9d83061 100644
--- a/src/server/shorts.ts
+++ b/src/server/shorts.ts
@@ -19,6 +19,8 @@ import {
stitchCurrent,
SHORTS,
SHORTS_MODELS,
+ SHORTS_ORIGINAL,
+ vaceDownsample,
type PlanStep,
type ShortsCustomPreset,
type ShortsLook,
@@ -28,6 +30,8 @@ import {
type ShortsSession,
type ShortsSessionSegment,
type ShortsStitch,
+ type ShortsTake,
+ type TakeKeys,
} from "@/lib/catalog/shorts";
import type { Engine, Generation } from "@/lib/catalog/types";
import { createPipeline } from "./chains";
@@ -196,8 +200,8 @@ export function deleteCustomPreset(id: string): boolean {
export interface ShortsBody {
engine: Engine;
presetId: string;
- /** width / height: what the browser read, for estimates made before the server has the file. */
- source: { url: string; name?: string; duration?: number; width?: number; height?: number };
+ /** width / height / fps: what the browser read, for estimates made before the server has the file. */
+ source: { url: string; name?: string; duration?: number; width?: number; height?: number; fps?: number };
range: ShortsRange;
aspectRatio: ShortsRatio;
language: string;
@@ -240,17 +244,18 @@ function planWith(body: ShortsBody, info: SourceInfo): { input: ShortsPlanInput;
const modelId = body.modelId && SHORTS_MODELS[body.engine].includes(body.modelId) ? body.modelId : firstOn(SHORTS_MODELS[body.engine], body.engine)!;
const look = body.look ?? lookFor(body.presetId);
const duration = info.duration ?? body.source.duration;
+ const fps = info.fps ?? body.source.fps;
const problem = rangeProblem(body.range, duration) ?? clipShapeProblem(info.width ?? body.source.width, info.height ?? body.source.height);
if (problem) throw new ShortsError(problem);
// Every segment has to be a clip the restyle model takes (a cut outside its window is paid for, then refused).
const limits = sourceSeconds(modelId);
- const odd = planSegments(body.range, body.engine)
+ const odd = planSegments(body.range, body.engine, { modelId, fps })
.map((s) => clipLengthProblem({ name: getModel(modelId)?.name ?? modelId, minSeconds: limits.min, maxSeconds: limits.max }, s.end - s.start))
.find(Boolean);
if (odd) throw new ShortsError(`${odd} per segment — pick another model`);
// A custom preset without words on a words-only model would restyle from nothing but "the look of the reference images".
- if (look.custom && !look.described && body.engine === "cloud" && !maxRefsFor(modelId)) {
- const readers = SHORTS_MODELS.cloud.filter((id) => maxRefsFor(id) > 0).map((id) => getModel(id)?.name ?? id);
+ if (look.custom && !look.described && body.engine === "cloud" && !maxRefsFor(modelId, "cloud")) {
+ const readers = SHORTS_MODELS.cloud.filter((id) => maxRefsFor(id, "cloud") > 0).map((id) => getModel(id)?.name ?? id);
throw new ShortsError(`${getModel(modelId)?.name ?? "This model"} restyles from words only — describe the look in your preset, or pick ${readers.join(" or ")}`, 422);
}
const name = fileTitle(body.source.name);
@@ -267,15 +272,16 @@ function planWith(body: ShortsBody, info: SourceInfo): { input: ShortsPlanInput;
hasAudio: info.hasAudio ?? false,
width: info.width ?? body.source.width,
height: info.height ?? body.source.height,
+ ...(fps ? { fps } : {}),
},
range: body.range,
look,
aspectRatio: body.aspectRatio,
language: body.language || "auto",
modelId,
- maxRefs: maxRefsFor(modelId),
- resolution: resolutionFor(modelId),
- reframes: body.engine === "open" || reframes(modelId),
+ maxRefs: maxRefsFor(modelId, body.engine),
+ resolution: resolutionFor(modelId, body.engine),
+ reframes: body.engine === "open" || reframes(modelId, body.engine),
},
};
}
@@ -305,11 +311,20 @@ export interface ShortsEstimate {
notes: string[];
}
-function notesFor(input: ShortsPlanInput): string[] {
+function notesFor(input: ShortsPlanInput, segments: number): string[] {
const notes: string[] = [];
const refs = input.look.references?.length ?? 0;
+ const original = input.modelId === SHORTS_ORIGINAL;
if (refs && input.engine === "cloud" && !input.maxRefs) notes.push(`${getModel(input.modelId)?.name ?? "This model"} restyles from words only — pick Kling O3 4K Edit or Happy Horse to use your reference images`);
- if (refs > SHORTS.openReferences && input.engine === "open") notes.push(`The open engine uses your first ${SHORTS.openReferences} reference images`);
+ if (refs > SHORTS.openReferences && (input.engine === "open" || original)) notes.push(`${original ? "Fuobe Shorts" : "The open engine"} uses your first ${SHORTS.openReferences} reference images (on each segment's first frame)`);
+ if (original) {
+ const fps = input.source.fps;
+ if (input.engine === "cloud") {
+ notes.push(`Fuobe Shorts draws each segment's first frame in the look (Qwen-Image-Edit 2511), then Wan 2.2 Fun VACE carries it through every frame by depth${segments > 1 ? `: ${segments} segments, joined with the clip's own sound` : ""}`);
+ if (fps && fps > SHORTS.original.billFps + 0.5) notes.push(`fal bills this clip's ${Math.round(fps)} fps as ${(fps / SHORTS.original.billFps).toFixed(1)}× its length (video seconds at ${SHORTS.original.billFps} fps)`);
+ if (vaceDownsample(fps)) notes.push(`Wan 2.2 Fun VACE works this ${Math.round(fps!)} fps clip at ${Math.round(fps! / (vaceDownsample(fps) + 1))} fps and brings it back to its own rate`);
+ } else notes.push("Fuobe Shorts on your GPU renders 480p at 16 fps, 5 s a segment");
+ }
if (input.engine === "cloud") {
const { width: w, height: h } = input.source;
if (!input.reframes && w && h && needsFit(input.source, input.aspectRatio)) notes.push(`Your ${w}×${h} clip is centre-cropped to ${input.aspectRatio} before the restyle`);
@@ -334,7 +349,7 @@ export function estimateWith(body: ShortsBody, info: SourceInfo): ShortsEstimate
segments: plan.segments.length,
seconds: Math.round((input.range.end - input.range.start) * 10) / 10,
refsSent: input.engine === "open" ? Math.min(SHORTS.openReferences, input.look.references?.length ?? 0) : Math.min(input.maxRefs, input.look.references?.length ?? 0),
- notes: notesFor(input),
+ notes: notesFor(input, plan.segments.length),
};
}
@@ -356,9 +371,9 @@ export async function createSession(body: ShortsBody, known?: SourceInfo): Promi
const now = Date.now();
const segments: ShortsSessionSegment[] = plan.segments.map((s, i) => {
const t = plan.takes[i];
- return { ...s, takes: [{ cut: id(t.cut), ...(t.fit ? { fit: id(t.fit) } : {}), ...(t.frame ? { frame: id(t.frame) } : {}), look: id(t.look), createdAt: now }], primary: id(t.look) };
+ return { ...s, takes: [takeOf(t, id, now)], primary: id(t.look) };
});
- const takeKeys = new Set(plan.takes.flatMap((t) => [t.cut, t.look, ...(t.fit ? [t.fit] : []), ...(t.frame ? [t.frame] : [])]));
+ const takeKeys = new Set(plan.takes.flatMap((t) => [t.cut, t.look, ...(t.fit ? [t.fit] : []), ...(t.still ? [t.still] : []), ...(t.frame ? [t.frame] : [])]));
const stitch: ShortsStitch = {
ids: plan.steps.filter((s) => !takeKeys.has(s.key)).map((s) => id(s.key)),
final: id(plan.final!),
@@ -371,7 +386,15 @@ export async function createSession(body: ShortsBody, known?: SourceInfo): Promi
engine: input.engine,
batchId: pipeline.batchId,
look: input.look,
- source: { url: input.source.url, name: body.source.name, duration: input.source.duration, hasAudio: input.source.hasAudio, width: info.width, height: info.height },
+ source: {
+ url: input.source.url,
+ name: body.source.name,
+ duration: input.source.duration,
+ hasAudio: input.source.hasAudio,
+ width: info.width,
+ height: info.height,
+ ...(input.source.fps ? { fps: input.source.fps } : {}),
+ },
range: input.range,
settings: { aspectRatio: input.aspectRatio, language: input.language, modelId: input.modelId, resolution: input.resolution, maxRefs: input.maxRefs, reframes: input.reframes },
segments,
@@ -401,9 +424,24 @@ export async function createSession(body: ShortsBody, known?: SourceInfo): Promi
return session;
}
+/** A take's generations by role, from its steps' keys. */
+function takeOf(t: TakeKeys, id: (key: string) => string, createdAt: number): ShortsTake {
+ return {
+ cut: id(t.cut),
+ ...(t.fit ? { fit: id(t.fit) } : {}),
+ ...(t.still ? { still: id(t.still) } : {}),
+ ...(t.frame ? { frame: id(t.frame) } : {}),
+ look: id(t.look),
+ createdAt,
+ };
+}
+
/** Every generation a session made. */
export function sessionIds(s: ShortsSession): string[] {
- const ids = [...s.segments.flatMap((g) => g.takes.flatMap((t) => [t.cut, ...(t.fit ? [t.fit] : []), ...(t.frame ? [t.frame] : []), t.look])), ...s.stitches.flatMap((x) => [...x.ids, x.final])];
+ const ids = [
+ ...s.segments.flatMap((g) => g.takes.flatMap((t) => [t.cut, ...(t.fit ? [t.fit] : []), ...(t.still ? [t.still] : []), ...(t.frame ? [t.frame] : []), t.look])),
+ ...s.stitches.flatMap((x) => [...x.ids, x.final]),
+ ];
return [...new Set(ids)];
}
@@ -496,14 +534,7 @@ export function regenerateSegment(id: string, index: number): ShortsSessionView
} catch (e) {
throw new ShortsError((e as Error).message, 422);
}
- const id_ = (k: string) => pipeline.byKey[k].id;
- const next = {
- cut: id_(take.keys.cut),
- ...(take.keys.fit ? { fit: id_(take.keys.fit) } : {}),
- ...(take.keys.frame ? { frame: id_(take.keys.frame) } : {}),
- look: id_(take.keys.look),
- createdAt: Date.now(),
- };
+ const next = takeOf(take.keys, (k) => pipeline.byKey[k].id, Date.now());
const segments = s.segments.map((g, i) => (i === index ? { ...g, takes: [...g.takes, next], primary: usable(g.primary) ? g.primary : next.look } : g));
saveSession({ ...s, segments });
return getSession(id);
diff --git a/tests/assist-studio-routes.test.ts b/tests/assist-studio-routes.test.ts
index 98f11afc..356e35bd 100644
--- a/tests/assist-studio-routes.test.ts
+++ b/tests/assist-studio-routes.test.ts
@@ -172,7 +172,8 @@ describe("Shorts Studio", () => {
i,
),
);
- expect(p.jobs).toEqual([expect.objectContaining({ modelId: "gemini-omni-flash", op: "v2v", costUsd: est.costUsd, demo: false, atomic: true })]);
+ // Fuobe Shorts (O9) is Shorts Studio's default on both engines, priced as the studio prices it.
+ expect(p.jobs).toEqual([expect.objectContaining({ modelId: "fuobe-shorts", op: "v2v", costUsd: est.costUsd, demo: false, atomic: true })]);
expect(est.costUsd).toBeGreaterThan(0);
expect(p.jobs[0].note).toMatch(/^2 segments of 12 s, stitched under the original sound/);
});
@@ -444,7 +445,7 @@ describe("MCP", () => {
it("tool arguments name what each studio takes", async () => {
const list = (await rpc("tools/list")) as { result: { tools: { name: string; inputSchema: { properties: Record<string, { description?: string; items?: unknown }> } }[] } };
const arg = (tool: string, key: string) => list.result.tools.find((t) => t.name === tool)!.inputSchema.properties[key].description ?? "";
- expect(arg("restyle_footage", "model_id")).toMatch(/gemini-omni-flash.*oss-wan22-vace-restyle.*outside Shorts Studio/);
+ expect(arg("restyle_footage", "model_id")).toMatch(/fuobe-shorts, gemini-omni-flash.*fuobe-shorts \(open source\).*outside Shorts Studio/);
expect(arg("split_layers", "model_id")).toMatch(/seedream-5-layers.*oss-qwen-layered.*outside Layers/);
expect(arg("create_ads", "aspect_ratios")).toMatch(/16:9 runs outside Ads Studio/);
});
diff --git a/tests/mixed-shorts-originals.test.ts b/tests/mixed-shorts-originals.test.ts
new file mode 100644
index 00000000..027abc89
--- /dev/null
+++ b/tests/mixed-shorts-originals.test.ts
@@ -0,0 +1,367 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
+import type { GenInput, ModelDef, ModelRoute } from "@/lib/catalog/types";
+
+// Fuobe Mixed Media and Fuobe Shorts (build plan O9): Higgsfield's Mixed Media and Shorts as Originals on both engines.
+// Frames are floor(seconds × fps) and priced per frame; the cloud fans the Original's frame route out over every frame
+// (no lanes: one seed, the look's LoRA) and splits clips above 200 frames; Smooth and Shorts run the Wan 2.2 Fun VACE
+// pass from a restyled first frame; the fal payloads come from the research's FieldMaps; DoP's 32 Mixed Media effects
+// draw their still on the Original first.
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-o9-"));
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://127.0.0.1:9"; // nothing listens here: open runs fall back to the demo
+
+const { setSetting } = await import("@/server/settings");
+const { createGenerations, previewChained } = await import("@/server/generations");
+const { createPipeline } = await import("@/server/chains");
+const { db } = await import("@/server/db");
+const { falProvider } = await import("@/server/providers/fal");
+const { EFFECTS, getModel, getPreset } = await import("@/lib/catalog");
+const { onEngine } = await import("@/lib/catalog/engines");
+const { estimateCost } = await import("@/lib/catalog/plan");
+const { prestepCost } = await import("@/lib/composer");
+const mm = await import("@/lib/catalog/mixed-media");
+const sh = await import("@/lib/catalog/shorts");
+const { maxRefsFor, modelInfos, reframes, resolutionFor } = await import("@/lib/catalog/shorts-models");
+const { MIXED_MEDIA_LOOK_LORAS, LORA_LIBRARY } = await import("@/lib/catalog/lora-library.generated");
+
+beforeAll(() => setSetting("demoMode", "auto"));
+afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
+
+const view = (id: string, engine: "open" | "cloud") => onEngine(getModel(id)!, engine);
+const noir = mm.getMixedPreset("mixed-noir")!;
+const sketch = mm.getMixedPreset("mixed-sketch")!;
+const research = JSON.parse(fs.readFileSync(path.join(__dirname, "../docs/research/fuobe-originals-recipes-5.json"), "utf8"));
+const mixedRecord = research.studios.find((s: { id: string }) => s.id === "mixed-media").original;
+const shortsRecord = research.studios.find((s: { id: string }) => s.id === "shorts").original;
+
+const input = (over: Partial<Parameters<typeof mm.planMixed>[0]> = {}): Parameters<typeof mm.planMixed>[0] => ({
+ engine: "cloud",
+ title: "Noir · street",
+ preset: noir,
+ values: mm.defaultValues(noir),
+ source: { url: "/api/files/uploads/street.mp4", duration: 12, hasAudio: true },
+ range: { start: 0, end: 10 },
+ fps: 24,
+ resolution: "1K",
+ modelId: mm.MIXED_ORIGINAL,
+ mode: "frames",
+ sourceFps: 24,
+ sourceSize: { width: 1920, height: 1080 },
+ ...over,
+});
+
+/** Submit through the fal adapter and return the URL and JSON body it posted. */
+async function submit(model: ModelDef, route: ModelRoute, given: GenInput): Promise<{ url: string; body: Record<string, unknown> }> {
+ const real = globalThis.fetch;
+ let seen: { url: string; body: Record<string, unknown> } | undefined;
+ globalThis.fetch = (async (url: string, init?: RequestInit) => {
+ seen = { url: String(url), body: JSON.parse(String(init?.body ?? "{}")) };
+ return new Response(JSON.stringify({ request_id: "r1", status_url: "s", response_url: "r", cancel_url: "c" }), { status: 200 });
+ }) as typeof fetch;
+ try {
+ await falProvider.submit({ generationId: "g", model, route, input: given });
+ } finally {
+ globalThis.fetch = real;
+ }
+ return seen!;
+}
+
+describe("Fuobe Mixed Media and Fuobe Shorts in the catalog", () => {
+ it("are Originals on both engines: ComfyUI graphs on your GPU, hosted open weights on fal", () => {
+ const mmModel = getModel("fuobe-mixed-media")!;
+ expect(mmModel.engines).toEqual(["open", "cloud"]);
+ expect(view("fuobe-mixed-media", "open").routes.map((r) => [r.op, r.endpoint])).toEqual([
+ ["v2v", "mixed-media-zimage-frames"],
+ ["edit", "z-image-turbo-i2i"],
+ ]);
+ expect(view("fuobe-mixed-media", "cloud").routes.map((r) => [r.op, r.endpoint])).toEqual([["edit", mixedRecord.cloud.frame]]);
+ expect(view("fuobe-mixed-media", "cloud").pricing).toMatchObject({ unit: "megapixel", usd: 0.01 });
+ expect(mmModel.licence).toMatchObject({ licence: "Apache-2.0", commercial: true });
+ const shorts = getModel("fuobe-shorts")!;
+ expect(shorts.engines).toEqual(["open", "cloud"]);
+ expect(view("fuobe-shorts", "open").routes.map((r) => r.endpoint)).toEqual(["video-restyle-wan22-fun-vace"]);
+ expect(view("fuobe-shorts", "cloud").routes.map((r) => r.endpoint)).toEqual([shortsRecord.cloud.restyle]);
+ // The cut is cropped to 9:16 / 16:9 first: fal's aspect_ratio is never asked for.
+ expect(view("fuobe-shorts", "cloud").routes[0].map?.aspectRatio).toBeUndefined();
+ expect(view("fuobe-shorts", "cloud").routes[0].map?.defaults).toEqual(shortsRecord.cloud.defaults);
+ });
+
+ it("are the studios' defaults, with the partners kept as choices", () => {
+ expect(mm.MIXED_FRAME_MODELS[0]).toBe("fuobe-mixed-media");
+ expect(mm.MIXED_FRAME_MODELS).toContain("nano-banana-2");
+ expect(mm.MIXED_MODELS.open).toEqual(["fuobe-mixed-media"]);
+ expect(mm.MIXED_MODELS.cloud).toContain("gemini-omni-flash");
+ expect(sh.SHORTS_MODELS.cloud[0]).toBe("fuobe-shorts");
+ expect(sh.SHORTS_MODELS.cloud).toContain("gemini-omni-flash");
+ expect(sh.SHORTS_MODELS.open).toEqual(["fuobe-shorts"]);
+ // As each runs per engine: free on your GPU, priced in the cloud; refs go to the first frame's edit on both.
+ const [open] = modelInfos(["fuobe-shorts"], "open");
+ const [cloud] = modelInfos(["fuobe-shorts"], "cloud");
+ expect(open).toMatchObject({ engine: "open", price: "Free · your GPU", refs: 2, reframes: true });
+ expect(cloud).toMatchObject({ engine: "cloud", price: "$0.19 / s at 30 fps", refs: 2, reframes: false });
+ expect([maxRefsFor("fuobe-shorts", "cloud"), reframes("fuobe-shorts", "cloud"), resolutionFor("fuobe-shorts", "cloud"), resolutionFor("fuobe-shorts", "open")]).toEqual([2, false, "720p", undefined]);
+ expect(modelInfos(["fuobe-mixed-media"], "cloud")[0].price).toBe("$0.01 / MP");
+ });
+
+ it("gives 14 of the 33 looks a Z-Image LoRA from the library, from the research", () => {
+ expect(Object.keys(MIXED_MEDIA_LOOK_LORAS).sort()).toEqual(Object.keys(mixedRecord.looks).sort());
+ expect(Object.keys(MIXED_MEDIA_LOOK_LORAS)).toHaveLength(14);
+ for (const [id, loras] of Object.entries(MIXED_MEDIA_LOOK_LORAS)) {
+ expect(mm.getMixedPreset(id), id).toBeDefined();
+ for (const l of loras) expect(LORA_LIBRARY.find((e) => e.key === l.key)?.base, `${id} ${l.key}`).toBe("z-image-turbo");
+ }
+ expect(mm.mixedLoras("mixed-noir").map((l) => [l.file, l.strength])).toEqual([["darkroom-noir.safetensors", 0.8]]);
+ expect(mm.mixedLoras("mixed-toxic")).toEqual([]);
+ // A look with a LoRA leads with its trigger words.
+ expect(mm.withTrigger("Noir.", mm.mixedLoras("mixed-noir"))).toBe("drkrm style, Noir.");
+ });
+});
+
+describe("Fuobe Mixed Media frames and cost", () => {
+ it("counts frames as floor(seconds × fps): up to 10 s × 24 fps = 240", () => {
+ expect(mm.mixedFrames(10, 24)).toBe(240);
+ expect(mm.mixedFrames(3.33, 8)).toBe(26);
+ expect(mm.mixedRangeProblem({ start: 0, end: 10.2 })).toBe("Select up to 10 seconds");
+ expect(mm.clampFps(30)).toBe(24);
+ });
+
+ it("draws each frame at about 1 (1K) or 4 (2K) megapixels in the clip's shape, priced per megapixel", () => {
+ expect(mm.originalFrameSize({ width: 1920, height: 1080 }, "1K")).toEqual({ width: 1360, height: 768 });
+ expect(mm.originalFrameSize({ width: 1080, height: 1920 }, "2K")).toEqual({ width: 1536, height: 2736 });
+ // 4K is drawn at 2K (Z-Image Turbo's range); an unknown size keeps the frame's own (fal's "auto").
+ expect(mm.originalFrameSize({ width: 1920, height: 1080 }, "4K")).toEqual(mm.originalFrameSize({ width: 1920, height: 1080 }, "2K"));
+ expect(mm.originalFrameSize(undefined, "1K")).toBeUndefined();
+ const cloud = view("fuobe-mixed-media", "cloud");
+ const one = estimateCost(cloud, mm.originalFrameParams(mm.defaultValues(noir), "1K", 1, { width: 1920, height: 1080 }), 1, "edit");
+ expect(one).toBeCloseTo(0.01, 3);
+ const two = estimateCost(cloud, mm.originalFrameParams(mm.defaultValues(noir), "2K", 1, { width: 1920, height: 1080 }), 1, "edit");
+ expect(two).toBeCloseTo(0.04, 2);
+ // 240 frames at 1K: about $2.40 before the few cents of cutting and rebuilding the clip.
+ expect(mm.framesCost(240, one!)).toBeCloseTo(2.39, 1);
+ });
+
+ it("fans the frame route out over every frame on the cloud: cut → frames → one controlled draw each → clips of 200 → joined → sound", () => {
+ const { steps, final } = mm.planMixed(input());
+ const frames = steps.filter((s) => s.request.feature === mm.MIXED_FRAME_FEATURE);
+ expect(frames).toHaveLength(240);
+ expect(steps.filter((s) => s.request.op === "extract-frames").map((s) => s.request.params?.extra?.max_frames)).toEqual([240]);
+ // No lanes: each frame waits for the extraction alone and takes its own frame (one seed keeps them alike).
+ for (const [i, f] of frames.entries()) {
+ expect(f.after).toEqual(["frames1"]);
+ expect(f.chain).toEqual([{ slot: "images", index: i, of: 240, position: "first" }]);
+ }
+ expect(frames[17].request).toMatchObject({
+ engine: "cloud",
+ modelId: "fuobe-mixed-media",
+ op: "edit",
+ params: { seed: mm.FRAME_SEED, numOutputs: 1, extra: { control_scale: 0.75, image_size: { width: 1360, height: 768 } } },
+ });
+ expect(frames[17].request.prompt).toMatch(/^drkrm style, Cinematic film noir/);
+ expect(frames[17].request.loras?.map((l) => l.file)).toEqual(["darkroom-noir.safetensors"]);
+ // Split above 200: 200 + 40 frames, joined at the clip's shape, then the cut's own sound.
+ const clips = steps.filter((s) => s.request.op === "images-to-video");
+ expect(clips.map((c) => c.after?.length)).toEqual([200, 40]);
+ expect(steps.find((s) => s.key === "film")!.after).toEqual(["clip1", "clip2"]);
+ expect(final).toBe("final");
+ // 199 frames are one clip; 201 are two.
+ expect(mm.planMixed(input({ range: { start: 0, end: 199 / 24 } })).steps.filter((s) => s.request.op === "images-to-video")).toHaveLength(1);
+ expect(mm.planMixed(input({ range: { start: 0, end: 201 / 24 + 0.001 } })).steps.filter((s) => s.request.op === "images-to-video")).toHaveLength(2);
+ // Bold holds the outlines loosest; the server's reachable LoRAs replace the look's own.
+ const bold = mm.planMixed(input({ values: { ...mm.defaultValues(noir), intensity: "bold" }, loras: [] })).steps.find((s) => s.key === "f0")!;
+ expect(bold.request.params?.extra).toMatchObject({ control_scale: 0.6 });
+ expect(bold.request.loras).toBeUndefined();
+ expect(bold.request.prompt).not.toMatch(/drkrm/);
+ });
+
+ it("creates the fan-out as one pipeline: every frame waits for the extraction, the clips gather them in order", () => {
+ const plan = mm.planMixed(input({ range: { start: 0, end: 1 }, fps: 8, sourceFps: 24 }));
+ const p = createPipeline(plan.steps);
+ const deps = (id: string) => {
+ const v = (db().prepare("SELECT depends_on FROM generations WHERE id = ?").get(id) as { depends_on: string | null }).depends_on;
+ return !v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v];
+ };
+ expect(p.items).toHaveLength(1 + 1 + 8 + 1 + 1);
+ const extract = p.byKey.frames1.id;
+ for (let i = 0; i < 8; i++) expect(deps(p.byKey[`f${i}`].id)).toEqual([extract]);
+ expect(deps(p.byKey.clip1.id)).toEqual(Array.from({ length: 8 }, (_, i) => p.byKey[`f${i}`].id));
+ // Priced before it runs: each frame's draw is previewed with its chain filled by placeholders.
+ const f0 = plan.steps.find((s) => s.key === "f0")!;
+ expect(previewChained({ ...f0.request, chain: f0.chain }, 1)).toMatchObject({ engine: "cloud", demo: true });
+ });
+
+ it("runs on your GPU as one per-frame job with the look's LoRA and one seed", () => {
+ const { steps } = mm.planMixed(input({ engine: "open", mode: "frames" }));
+ expect(steps).toHaveLength(1);
+ expect(steps[0].request).toMatchObject({
+ engine: "open",
+ modelId: "fuobe-mixed-media",
+ op: "v2v",
+ params: { startTime: 0, endTime: 10, fps: 24, seed: mm.FRAME_SEED, extra: { frames: 240, denoise: 0.7 } },
+ });
+ expect(steps[0].request.loras?.map((l) => l.file)).toEqual(["darkroom-noir.safetensors"]);
+ // The open preview is the same graph on one frame, with the same look, LoRA and seed.
+ const preview = mm.planMixedPreview(input({ engine: "open", mode: "frames" }));
+ expect(preview.request).toMatchObject({ engine: "open", modelId: "fuobe-mixed-media", params: { seed: mm.FRAME_SEED, extra: { frames: 1 } } });
+ // The cloud preview is the frame route on the grabbed frame, as frame 1 is drawn.
+ const cloudPreview = mm.planMixedPreview({ ...input(), frameUrl: "/api/files/f.jpg" });
+ expect(cloudPreview.request).toMatchObject({ engine: "cloud", modelId: "fuobe-mixed-media", op: "edit", inputs: { images: ["/api/files/f.jpg"] }, params: { seed: mm.FRAME_SEED } });
+ });
+});
+
+describe("Smooth: the first frame in the look, then Wan 2.2 Fun VACE by depth", () => {
+ it("cloud: pieces of up to 240 frames at the clip's rate, each from its own first frame, joined, the sound put back", () => {
+ const { steps, final } = mm.planMixed(input({ mode: "smooth", sourceFps: 30 }));
+ // 10 s at 30 fps: 300 frames, so two 5 s pieces.
+ expect(steps.filter((s) => s.request.op === "v2v")).toHaveLength(2);
+ const frame0 = steps.find((s) => s.key === "frame0")!;
+ expect(frame0.request).toMatchObject({ engine: "cloud", modelId: "fuobe-mixed-media", op: "edit", params: { seed: mm.FRAME_SEED, extra: { control_scale: 0.75 } } });
+ expect(frame0.request.inputs).toBeUndefined();
+ expect(frame0.after).toEqual(["still0"]);
+ const look0 = steps.find((s) => s.key === "look0")!;
+ expect(look0.request).toMatchObject({ engine: "cloud", modelId: "fuobe-shorts", op: "v2v", feature: mm.MIXED_STEP_FEATURE, params: { resolution: "720p", sourceDuration: 5, duration: 9.375 } });
+ expect(look0.after).toEqual(["cut0", "frame0"]);
+ expect(steps.find((s) => s.key === final)!.request).toMatchObject({ feature: mm.MIXED_FEATURE, modelId: "merge-audio-video", title: "Noir · street" });
+ // In the clip's own shape: nothing cropped.
+ expect(steps.some((s) => s.request.op === "reframe")).toBe(false);
+ });
+
+ it("open: 81-frame segments at 16 fps, the first frame drawn by the Original on your GPU, Fun VACE, joined, the sound", () => {
+ const { steps, final } = mm.planMixed(input({ engine: "open", mode: "smooth" }));
+ const cuts = steps.filter((s) => s.request.modelId === "oss-segment");
+ expect(cuts.length).toBe(sh.planOpenSegments({ start: 0, end: 10 }).length);
+ const frame0 = steps.find((s) => s.key === "frame0")!;
+ expect(frame0.request).toMatchObject({ engine: "open", modelId: "fuobe-mixed-media", op: "edit", params: { extra: { strength: 0.7, megapixels: 1 } } });
+ expect(frame0.chain).toEqual([{ slot: "images", position: "first" }]);
+ expect(steps.find((s) => s.key === "look0")!.request).toMatchObject({ engine: "open", modelId: "fuobe-shorts", op: "v2v" });
+ expect(steps.find((s) => s.key === final)!.request).toMatchObject({ feature: mm.MIXED_FEATURE, modelId: "oss-mux" });
+ });
+});
+
+describe("Fuobe Shorts: segment → Qwen edit of frame 0 → Wan Fun VACE depth → merge → mux", () => {
+ const shortsInput = (over: Partial<Parameters<typeof sh.planShorts>[0]> = {}): Parameters<typeof sh.planShorts>[0] => ({
+ engine: "cloud",
+ title: "Claymation · beach",
+ source: { url: "/api/files/uploads/beach.mp4", duration: 40, hasAudio: true, width: 1080, height: 1920, fps: 30 },
+ range: { start: 0, end: 20 },
+ look: sh.lookFromPreset(sh.getShortsPreset("shorts-claymation")!),
+ aspectRatio: "9:16",
+ language: "auto",
+ modelId: "fuobe-shorts",
+ maxRefs: 2,
+ resolution: "720p",
+ ...over,
+ });
+
+ it("cuts frame-limited segments (240 frames as fal works them, at most 10 s) and bills frames ÷ 16", () => {
+ expect(sh.originalSegmentSeconds(30)).toBe(8);
+ expect(sh.originalSegmentSeconds(24)).toBe(10);
+ expect(sh.originalSegmentSeconds(16)).toBe(10);
+ expect(sh.originalSegmentSeconds(60)).toBe(8);
+ expect(sh.originalSegmentSeconds()).toBe(8);
+ expect(sh.vaceDownsample(30)).toBe(0);
+ expect(sh.vaceDownsample(60)).toBe(1);
+ expect(sh.vaceDownsample(120)).toBe(3);
+ expect(sh.originalBilledSeconds(8, 30)).toBe(15);
+ expect(sh.originalBilledSeconds(6, 16)).toBe(6);
+ expect(sh.planSegments({ start: 0, end: 20 }, "cloud", { modelId: "fuobe-shorts", fps: 30 }).map((s) => s.end - s.start)).toEqual([20 / 3, 20 / 3, 20 / 3].map((x) => expect.closeTo(x, 2)));
+ // Partners keep ≤10 s segments.
+ expect(sh.planSegments({ start: 0, end: 20 }, "cloud", { modelId: "gemini-omni-flash", fps: 30 })).toHaveLength(2);
+ });
+
+ it("plans the hosted-open route per segment: cut → crop → first frame → Qwen edit with references → Fun VACE", () => {
+ const refs = ["/api/files/r1.png", "/api/files/r2.png", "/api/files/r3.png"];
+ const input = shortsInput({ look: { ...sh.lookFromPreset(sh.getShortsPreset("shorts-claymation")!), references: refs }, source: { ...shortsInput().source, width: 1920, height: 1080 } });
+ const plan = sh.planShorts(input);
+ expect(plan.takes[0]).toEqual({ cut: "cut0", fit: "fit0", still: "still0", frame: "frame0", look: "look0" });
+ const by = Object.fromEntries(plan.steps.map((s) => [s.key, s]));
+ expect(by.still0.request).toMatchObject({ modelId: "extract-frame", op: "frame", params: { extra: { frame_type: "first" } } });
+ expect(by.still0.after).toEqual(["fit0"]);
+ expect(by.frame0.request).toMatchObject({ modelId: "qwen-image-edit-2511-cloud", op: "edit", inputs: { images: refs.slice(0, 2) } });
+ expect(by.frame0.request.prompt).toMatch(/images 2 and 3/);
+ expect(by.look0.request).toMatchObject({ engine: "cloud", modelId: "fuobe-shorts", op: "v2v", params: { resolution: "720p", sourceDuration: expect.closeTo(20 / 3, 2), duration: expect.closeTo(12.5, 2) } });
+ expect(by.look0.after).toEqual(["fit0", "frame0"]);
+ expect(by.look0.chain).toEqual([{ slot: "video" }, { slot: "images", position: "first" }]);
+ // Joined with fal's merge-videos, then the original sound from the upload.
+ expect(by.join.request.modelId).toBe("join-clips");
+ expect(plan.final).toBe("final");
+ // A 60 fps clip is worked at 30 fps and brought back.
+ const fast = sh.planShorts(shortsInput({ source: { ...shortsInput().source, fps: 60 } }));
+ expect(fast.steps.find((s) => s.key === "look0")!.request.params?.extra).toEqual({ temporal_downsample_factor: 1 });
+ });
+
+ it("sends fal what the research reads: first_frame_url, match_input_*, no aspect ratio, 720p", async () => {
+ setSetting("falKey", "test-key");
+ try {
+ const m = view("fuobe-shorts", "cloud");
+ const route = m.routes[0];
+ const { url, body } = await submit(m, route, { prompt: "Claymation.", video: "https://x/cut.mp4", images: ["https://x/frame.png"], resolution: "720p", seed: 7, extra: { temporal_downsample_factor: 1 } });
+ expect(url).toContain("fal-ai/wan-22-vace-fun-a14b/depth");
+ expect(body).toMatchObject({ video_url: "https://x/cut.mp4", first_frame_url: "https://x/frame.png", match_input_num_frames: true, match_input_frames_per_second: true, resolution: "720p", seed: 7, temporal_downsample_factor: 1 });
+ expect(body.aspect_ratio).toBeUndefined();
+ const frame = view("fuobe-mixed-media", "cloud");
+ const sent = await submit(frame, frame.routes[0], {
+ prompt: "drkrm style, Noir.",
+ images: ["https://x/f0.jpg"],
+ seed: 424242,
+ numOutputs: 1,
+ loras: mm.mixedLoras("mixed-noir"),
+ extra: { control_scale: 0.75, image_size: { width: 1360, height: 768 } },
+ });
+ expect(sent.url).toContain("fal-ai/z-image/turbo/controlnet/lora");
+ expect(sent.body).toMatchObject({
+ prompt: "drkrm style, Noir.",
+ image_url: "https://x/f0.jpg",
+ preprocess: "canny",
+ output_format: "jpeg",
+ enable_prompt_expansion: false,
+ num_inference_steps: 8,
+ seed: 424242,
+ num_images: 1,
+ control_scale: 0.75,
+ image_size: { width: 1360, height: 768 },
+ });
+ expect(sent.body.loras).toEqual([{ path: expect.stringContaining("darkroom-noir.safetensors"), scale: 0.8 }]);
+ } finally {
+ setSetting("falKey", "");
+ }
+ });
+});
+
+describe("DoP's Mixed Media effects run on Fuobe Mixed Media", () => {
+ const mixedEffects = EFFECTS.filter((p) => p.parity?.includes("Fuobe Mixed Media"));
+
+ it("draws the still in the studio's look first (both engines), then Fuobe DoP animates it", () => {
+ expect(mixedEffects).toHaveLength(32);
+ for (const p of mixedEffects) {
+ expect(p.prestep?.open).toMatchObject({ modelId: "fuobe-mixed-media", op: "edit" });
+ expect(p.prestep?.cloud).toMatchObject({ modelId: "fuobe-mixed-media", op: "edit" });
+ expect(p.open?.modelId).toBe("fuobe-dop");
+ expect(p.cloud?.modelId).toBe("fuobe-dop");
+ }
+ const two = getPreset("effect-two-color")!;
+ expect(two.prestep?.cloud.labels).toEqual({ step: "Start frame as Two color", clip: "Two color clip" });
+ expect(getPreset("effect-noir")!.prestep?.cloud.loras?.map((l) => l.file)).toEqual(["darkroom-noir.safetensors"]);
+ expect(getPreset("effect-noir")!.parity).toMatch(/^Fuobe DoP draws your still as Noir first \(Fuobe Mixed Media: Z-Image Turbo \+ ControlNet with frankbarbs DARKROOM Noir\)/);
+ // About a cent for the still in the cloud, free on your GPU.
+ expect(prestepCost(two, "fuobe-dop", "cloud")).toBeCloseTo(0.01, 3);
+ expect(prestepCost(two, "fuobe-dop", "open")).toBe(0);
+ });
+
+ it("runs the step on the engine the clip runs on, labelled, then the clip from its picture", () => {
+ const req = { feature: "effect", modelId: "fuobe-dop", presetId: "effect-sketch", prompt: "a skater", inputs: { images: ["/api/files/uploads/a.png"] } };
+ for (const engine of ["open", "cloud"] as const) {
+ const [clip, still] = createGenerations({ ...req, engine });
+ expect(still).toMatchObject({ modelId: "fuobe-mixed-media", engine, op: "edit" });
+ expect(still.request.step?.label).toBe("Start frame as Sketch");
+ expect(still.request.loras?.map((l) => l.file)).toEqual(mm.mixedLoras("mixed-sketch").map((l) => l.file));
+ expect(still.request.params?.seed).toBe(mm.FRAME_SEED);
+ expect(clip).toMatchObject({ modelId: "fuobe-dop", engine });
+ expect(clip.request.step?.label).toBe("Sketch clip");
+ expect(clip.request.chain).toEqual([{ slot: "images", position: "first" }]);
+ }
+ expect(sketch.id).toBe("mixed-sketch");
+ });
+});
diff --git a/tests/shorts-api.test.ts b/tests/shorts-api.test.ts
index cd5dbd27..13d1fb4a 100644
--- a/tests/shorts-api.test.ts
+++ b/tests/shorts-api.test.ts
@@ -60,6 +60,8 @@ const dependsOn = (id: string) => {
return !v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v];
};
+// Gemini Omni Flash (Higgsfield's Shorts engine, a partner choice) unless a test names another model; Fuobe Shorts, the
+// default since build plan O9, has tests of its own below.
const body = (over: Record<string, unknown> = {}) => ({
engine: "cloud",
presetId: "shorts-claymation",
@@ -67,6 +69,7 @@ const body = (over: Record<string, unknown> = {}) => ({
range: { start: 0, end: 12 },
aspectRatio: "9:16",
language: "auto",
+ ...(over.engine === "open" ? {} : { modelId: "gemini-omni-flash" }),
...over,
});
@@ -245,7 +248,9 @@ describe("Shorts sessions", () => {
it("runs the open engine: segment (+ first frame) → Qwen first-frame restyle → Wan VACE → join → soundtrack", async () => {
const s = await shorts.createSession(body({ engine: "open" }) as never);
- expect(s.settings.modelId).toBe("oss-wan22-vace-restyle");
+ // Fuobe Shorts is the open engine's restyle model (the same graph oss-wan22-vace-restyle ran), on the GPU.
+ expect(s.settings.modelId).toBe("fuobe-shorts");
+ expect(gens.getGeneration(s.segments[0].takes[0].look)).toMatchObject({ modelId: "fuobe-shorts", engine: "open", provider: "mock" });
expect(s.segments.map((g) => g.frames)).toEqual([65, 65, 61]);
const take = s.segments[2].takes[0];
expect(gens.getGeneration(take.cut)).toMatchObject({ modelId: "oss-segment", op: "trim" });
@@ -259,6 +264,54 @@ describe("Shorts sessions", () => {
expect(frame.request.inputs?.images?.[0]).toMatch(/^\/api\/files\//);
});
+ it("runs Fuobe Shorts in the cloud by default: cut → first frame → Qwen edit in the look → Wan Fun VACE by depth → join → sound", async () => {
+ const rest = { ...body(), modelId: undefined };
+ const s = await shorts.createSession(rest as never);
+ expect(s.settings).toMatchObject({ modelId: "fuobe-shorts", maxRefs: 2, resolution: "720p", reframes: false });
+ // A 16 fps clip: pieces of up to 240 frames (15 s) and 10 s: two 6 s segments.
+ expect(s.source).toMatchObject({ fps: expect.closeTo(16, 1) });
+ expect(s.segments.map((g) => [g.start, g.end])).toEqual([
+ [0, 6],
+ [6, 12],
+ ]);
+ const take = s.segments[1].takes[0];
+ const still = gens.getGeneration(take.still!)!;
+ expect(still).toMatchObject({ modelId: "extract-frame", op: "frame", feature: "shorts-step", request: { params: { extra: { frame_type: "first" } } } });
+ expect(dependsOn(still.id)).toEqual([take.cut]);
+ expect(gens.getGeneration(take.frame!)).toMatchObject({ modelId: "qwen-image-edit-2511-cloud", op: "edit" });
+ expect(dependsOn(take.frame!)).toEqual([take.still]);
+ const look = gens.getGeneration(take.look)!;
+ // The Original runs on the cloud engine asked for, billed on frames ÷ 16 (16 fps: the segment's own 6 s).
+ expect(look).toMatchObject({ modelId: "fuobe-shorts", engine: "cloud", op: "v2v", feature: "shorts", request: { params: { duration: 6, sourceDuration: 6, resolution: "720p" } } });
+ expect(dependsOn(take.look)).toEqual([take.cut, take.frame]);
+ expect(shorts.sessionIds(s)).toEqual(expect.arrayContaining([take.still, take.frame]));
+ // A new take makes its own first frame; the stitch joins the takes under the clip's sound.
+ const again = shorts.regenerateSegment(s.id, 1).segments[1].takes[1];
+ expect(again.still).toEqual(expect.any(String));
+ expect(dependsOn(again.look)).toEqual([again.cut, again.frame]);
+ expect(await settle(s.stitches[0].final)).toMatchObject({ status: "succeeded", modelId: "merge-audio-video" });
+ expect(gens.getGeneration(take.frame!)!.request.inputs?.images?.[0]).toMatch(/^\/api\/files\//);
+ await settle(again.look);
+ setSetting("falKey", "test-key");
+ try {
+ const est = await shorts.estimateShorts({ ...rest, source: { url: clip, duration: 12, fps: 16 } } as never);
+ // Wan 2.2 Fun VACE at 720p, $0.10 per video second, two 6 s segments at 16 fps, plus the first frames' Qwen edits.
+ expect(est).toMatchObject({ demo: false, segments: 2 });
+ expect(est.costUsd!).toBeGreaterThanOrEqual(1.2);
+ expect(est.costUsd!).toBeLessThan(1.35);
+ // Before the clip's rate is known it is priced as 30 fps (30 ÷ 16 of its length): never less than the run costs.
+ const unknown = await shorts.estimateShorts(rest as never);
+ expect(unknown.costUsd!).toBeGreaterThan(2.25);
+ expect(est.notes.join(" ")).toMatch(/Fuobe Shorts draws each segment's first frame in the look/);
+ // A 30 fps clip is billed at 30 ÷ 16 of its length, in pieces of 8 s; a 60 fps one is worked at 30 fps.
+ const fast = await shorts.estimateShorts({ ...rest, source: { url: clip, duration: 12, fps: 60 } } as never);
+ expect(fast.notes.join(" ")).toMatch(/works this 60 fps clip at 30 fps/);
+ } finally {
+ setSetting("falKey", "");
+ }
+ shorts.deleteSession(s.id);
+ });
+
it("custom presets: references go to models that take them", async () => {
const res = await presetsRoute.POST(json("POST", { description: "dusty desert film", references: [png, png] }));
expect(res.status).toBe(201);
@@ -301,7 +354,7 @@ describe("Shorts sessions", () => {
const bare = shorts.createCustomPreset({ references: [png] });
const words = await estimateRoute.POST(json("POST", body({ presetId: bare.id })));
expect(words.status).toBe(422);
- expect((await words.json()).error).toBe("Gemini Omni Flash 1.1 restyles from words only — describe the look in your preset, or pick Kling O3 4K Edit or Happy Horse Video Edit");
+ expect((await words.json()).error).toBe("Gemini Omni Flash 1.1 restyles from words only — describe the look in your preset, or pick Fuobe Shorts or Kling O3 4K Edit or Happy Horse Video Edit");
const kling = await (await estimateRoute.POST(json("POST", body({ presetId: bare.id, modelId: "kling-o3-4k-edit" })))).json();
expect(kling.refsSent).toBe(1);
shorts.deleteCustomPreset(bare.id);
@@ -328,6 +381,8 @@ describe("Shorts sessions", () => {
});
describe("Mixed Media renders", () => {
+ // The cloud's Per frame tests below are Nano Banana 2's lanes unless a test names another model; Fuobe Mixed Media, the
+ // default since build plan O9, has tests of its own (and tests/mixed-shorts-originals.test.ts).
const mm = (over: Record<string, unknown> = {}) => ({
engine: "open",
presetId: "mixed-sketch",
@@ -336,6 +391,7 @@ describe("Mixed Media renders", () => {
range: { start: 2, end: 7 },
fps: 24,
resolution: "1K",
+ ...(over.engine === "cloud" && !over.mode && !over.modelId ? { modelId: "nano-banana-2" } : {}),
...over,
});
@@ -349,10 +405,17 @@ describe("Mixed Media renders", () => {
expect(res.status).toBe(201);
const { final, items } = await res.json();
expect(items).toHaveLength(1);
- expect(final).toMatchObject({ modelId: "oss-mixed-media", feature: "mixed-media", request: { title: "Sketch · skate" } });
- expect(final.request.params).toMatchObject({ startTime: 2, endTime: 7, fps: 16, extra: { denoise: 0.82 } });
+ // Fuobe Mixed Media on your GPU: the look's LoRA (Sketch: pencil) and one seed for every frame.
+ expect(final).toMatchObject({ modelId: "fuobe-mixed-media", engine: "open", feature: "mixed-media", request: { title: "Sketch · skate" } });
+ expect(final.request.params).toMatchObject({ startTime: 2, endTime: 7, fps: 16, seed: 424242, extra: { denoise: 0.82 } });
+ expect(final.request.loras.map((l: { file: string }) => l.file)).toEqual(["Zimage_pencil_sketch.safetensors"]);
expect(final.request.prompt).toMatch(/deep red \(#C1121F\) ink/);
expect(await settle(final.id)).toMatchObject({ status: "succeeded" });
+ // An API caller that names the per-frame model from before the Original keeps it.
+ const legacy = await mixed.createMixed(mm({ modelId: "oss-mixed-media" }) as never);
+ expect(legacy.final).toMatchObject({ modelId: "oss-mixed-media" });
+ expect(legacy.final.request.loras).toBeUndefined();
+ await settle(legacy.final.id);
});
it("renders on the cloud (Fast): cut → restyle anchored on the preview still → the cut's sound", async () => {
@@ -450,7 +513,7 @@ describe("Mixed Media renders", () => {
expect(legacy.perFrameUsd).toBeUndefined();
const wrong = await mixedEstimateRoute.POST(json("POST", mm({ engine: "cloud", mode: "frames", modelId: "ltx-2-3-restyle", source: { url: "/api/files/placeholder.mp4", duration: 12, fps: 24 } })));
expect(wrong.status).toBe(422);
- expect((await wrong.json()).error).toBe("LTX 2.3 Reference Restyle restyles the clip as video — pick Fast for it, or Nano Banana 2 or Seedream 5.0 Flash to redraw each frame");
+ expect((await wrong.json()).error).toBe("LTX 2.3 Reference Restyle restyles the clip as video — pick Fast for it, or Fuobe Mixed Media or Nano Banana 2 or Seedream 5.0 Flash to redraw each frame");
const still = await mixedEstimateRoute.POST(json("POST", mm({ engine: "cloud", mode: "fast", modelId: "nano-banana-2", source: { url: "/api/files/placeholder.mp4", duration: 12, fps: 24 } })));
expect(still.status).toBe(422);
expect((await still.json()).error).toMatch(/^Nano Banana 2 redraws single frames — pick Per frame/);
@@ -511,6 +574,39 @@ describe("Mixed Media renders", () => {
expect(mixed.framesProgress(third.final.id)).toEqual({ total: 4, done: 4, running: 0 });
});
+ it("renders on Fuobe Mixed Media by default, frame by frame on its own (one seed, the look's LoRA, no lanes), and Smooth", async () => {
+ const noir = { ...mm({ engine: "cloud", presetId: "mixed-noir", values: {}, range: { start: 1, end: 2 }, fps: 4 }), modelId: undefined };
+ const { final, items, frames } = await mixed.createMixed(noir as never);
+ expect(frames).toBe(4);
+ expect(items.map((g: Generation) => g.op)).toEqual(["trim", "extract-frames", "images-to-video", "mux"]);
+ expect(await settle(final.id)).toMatchObject({ status: "succeeded", feature: "mixed-media" });
+ const edits = gens.listGenerations({ batchId: final.batchId ?? undefined, features: ["mixed-media-frame-step"], limit: 50 }).sort((a, b) => a.request.step!.index - b.request.step!.index);
+ const extracted = gens.getGeneration(items[1].id)!.outputs;
+ // Each frame is its own controlled draw: only its own extracted frame goes in, every one waits for the extraction only.
+ for (const [i, g] of edits.entries()) {
+ expect(g).toMatchObject({ modelId: "fuobe-mixed-media", engine: "cloud", op: "edit", request: { params: { seed: 424242 } } });
+ expect(g.request.inputs?.images).toEqual([extracted[i].url]);
+ expect(dependsOn(g.id)).toEqual([items[1].id]);
+ expect(g.request.loras?.map((l) => l.file)).toEqual(["darkroom-noir.safetensors"]);
+ expect(g.prompt).toMatch(/^drkrm style, /);
+ }
+ // Smooth: the first frame in the look (the Original), then Fuobe Shorts' Wan 2.2 Fun VACE pass; the cut's sound back.
+ const smooth = await mixed.createMixed({ ...noir, mode: "smooth" } as never);
+ const ops = smooth.items.map((g: Generation) => `${g.modelId} ${g.op}`).sort();
+ // The cut, its first frame, that frame in the look, Wan Fun VACE by depth, the selection's sound and the mux.
+ expect(ops).toEqual(["extract-frame frame", "fuobe-mixed-media edit", "fuobe-shorts v2v", "merge-audio-video mux", "trim-video trim", "trim-video trim"]);
+ const pass = smooth.items.find((g: Generation) => g.modelId === "fuobe-shorts")!;
+ expect(pass.engine).toBe("cloud");
+ expect(smooth.items.find((g: Generation) => g.modelId === "fuobe-mixed-media")!.engine).toBe("cloud");
+ expect(await settle(smooth.final.id)).toMatchObject({ status: "succeeded", feature: "mixed-media", modelId: "merge-audio-video" });
+ const est = await mixed.estimateMixed({ ...noir, mode: "smooth" } as never);
+ expect(est).toMatchObject({ mode: "smooth", demo: true, modelId: "fuobe-mixed-media" });
+ expect(est.notes.join(" ")).toMatch(/Smooth draws the first frame in the look/);
+ // Smooth is the Original's own; Fast is the cloud's.
+ expect((await mixedEstimateRoute.POST(json("POST", { ...noir, mode: "smooth", modelId: "nano-banana-2" }))).status).toBe(422);
+ expect((await mixedEstimateRoute.POST(json("POST", mm({ mode: "fast" })))).status).toBe(422);
+ });
+
it("says which frame failed and why, not just that an earlier step didn't finish", async () => {
const { final } = await mixed.createMixed(mm({ engine: "cloud", range: { start: 1, end: 2 }, fps: 4 }) as never);
const edits = gens.listGenerations({ batchId: final.batchId!, features: ["mixed-media-frame-step"], limit: 50 }).sort((a, b) => a.request.step!.index - b.request.step!.index);
diff --git a/tests/shorts-pricing.test.ts b/tests/shorts-pricing.test.ts
index 98d73b30..8267373f 100644
--- a/tests/shorts-pricing.test.ts
+++ b/tests/shorts-pricing.test.ts
@@ -56,7 +56,8 @@ describe("restyled segments stay in sync with the original sound", () => {
for (const modelId of SHORTS_MODELS.cloud) {
const plan = planShorts(shorts({ modelId, range: { start, end }, source: { url: "/api/files/x.mp4", duration: 130, hasAudio: true } }));
const looks = plan.steps.filter((s) => s.request.op === "v2v");
- const sum = looks.reduce((n, s) => n + (s.request.params!.duration as number), 0);
+ // Fuobe Shorts is billed on frames ÷ 16 (duration); its segments' own lengths are sourceDuration.
+ const sum = looks.reduce((n, s) => n + ((s.request.params!.sourceDuration ?? s.request.params!.duration) as number), 0);
expect(sum).toBeCloseTo(end - start, 2);
}
}
diff --git a/tests/shorts.test.ts b/tests/shorts.test.ts
index e7bfa865..8364149f 100644
--- a/tests/shorts.test.ts
+++ b/tests/shorts.test.ts
@@ -78,7 +78,9 @@ describe("Shorts presets and catalog", () => {
if (typeof id === "number") continue;
expect(getModel(id), id).toBeDefined();
}
- expect(SHORTS_MODELS.cloud[0]).toBe("gemini-omni-flash");
+ // Fuobe Shorts (O9) is the default on both engines; Gemini Omni Flash (Higgsfield's Shorts engine) stays a choice.
+ expect(SHORTS_MODELS.cloud.slice(0, 2)).toEqual(["fuobe-shorts", "gemini-omni-flash"]);
+ expect(SHORTS_MODELS.open).toEqual(["fuobe-shorts"]);
for (const id of SHORTS_MODELS.cloud) expect(getModel(id)!.routes.some((r) => r.op === "v2v"), id).toBe(true);
});