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.

Open engine: Chatterbox voice cloning, dialogue and voice conversion, Wan-Move draw to video, VACE extend/reframe, video tools

Claudeba89794691da
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.py
index 1b8a3e4c..3dc642d7 100644
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@ -308,6 +308,17 @@ model("elevenlabs-sfx", "ElevenLabs Sound Effects", "ElevenLabs", "elevenlabs",
[("sfx", "fal-ai/elevenlabs/sound-effects/v2")], pricing=("second", 0.002), defaults={"duration": 5}, options={"durations": [2, 5, 10, 22]})
model("elevenlabs-music", "ElevenLabs Music", "ElevenLabs", "elevenlabs", "audio", "Studio-quality songs from a prompt",
[("music", "fal-ai/elevenlabs/music")], pricing=("minute", 0.6), defaults={"duration": 30}, options={"durations": [15, 30, 60, 120]})
+model("birefnet-video", "BiRefNet video (hosted)", "ZhengPeng7", "birefnet", "video", "Transparent WebM cut-outs of the subject",
+ [("bg-remove-video", "fal-ai/birefnet/v2/video")], pricing=("second", 0.0), fixed={"video_output_type": "VP9 (.webm)", "model": "General Use (Heavy)"})
+model("bria-video-bg", "Bria video background removal", "Bria", "bria", "video", "Production-grade video matting with audio kept",
+ [("bg-remove-video", "bria/video/background-removal/v3")], pricing=("second", 0.05),
+ fixed={"background_color": "Transparent", "output_container_and_codec": "webm_vp9"})
+model("depth-anything-video-cloud", "Video Depth Anything (hosted)", "ByteDance", "depth-anything", "video", "Stable depth maps for every frame",
+ [("depth-video", "fal-ai/depth-anything-video")], pricing=("second", 0.04), fixed={"model": "VDA-Base", "colormap": "grayscale"})
+model("lightx-relight", "LightX Relight", "LightX", "lightx", "video", "Relight a video from a description and a light direction",
+ [("relight-video", "fal-ai/lightx/relight")], pricing=("second", 0.1),
+ fixed={"relit_cond_type": "ic", "relight_parameters.bg_source": "Left"},
+ options={"controls": [{"param": "relight_parameters.bg_source", "label": "Light from", "values": ["Left", "Right", "Top", "Bottom"], "default": "Left"}]})
model("mmaudio-cloud", "MMAudio", "hkchengrex", "mmaudio", "video", "Add matching sound to a silent video",
[("v2a", "fal-ai/mmaudio-v2")], pricing=("second", 0.001))
@@ -369,6 +380,9 @@ def build_route(op, ep, provider, m, opts, ropts=None):
fmap["prompt"] = kf["prompt"]
else:
fmap["prompt"] = False
+ # Relight endpoints take the lighting description as the prompt.
+ if "lightingPrompt" in kf:
+ fmap["prompt"] = kf["lightingPrompt"]
# Zero-shot TTS takes its reference voice in the "audio" field; voice conversion names it separately.
if op == "tts" and "audio" in kf:
kf["referenceVoice"] = kf.pop("audio")
@@ -475,8 +489,8 @@ def build_route(op, ep, provider, m, opts, ropts=None):
if ropts.get("fixed"):
m = {**m, "fixed": {**m["fixed"], **ropts["fixed"]}}
if m["fixed"]:
- fmap["fixed"] = {k: v for k, v in m["fixed"].items() if k in inputs}
- missing = [k for k in m["fixed"] if k not in inputs]
+ fmap["fixed"] = {k: v for k, v in m["fixed"].items() if k.split(".")[0] in inputs}
+ missing = [k for k in m["fixed"] if k.split(".")[0] not in inputs]
if missing:
warn(f"{m['id']}: fixed fields {missing} not in {ep} inputs")
if not fmap["fixed"]:
diff --git a/src/app/(studio)/video-tools/page.tsx b/src/app/(studio)/video-tools/page.tsx
new file mode 100644
index 00000000..f5c0a61b
--- /dev/null
+++ b/src/app/(studio)/video-tools/page.tsx
@@ -0,0 +1,8 @@
+import type { Metadata } from "next";
+import { ModeSwitchStudio } from "@/components/studio/mode-switch-studio";
+
+export const metadata: Metadata = { title: "Video tools" };
+
+export default function Page() {
+ return <ModeSwitchStudio kind="video-tools" />;
+}
diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.ts
index 431c0a8d..b92f825e 100644
--- a/src/app/api/generations/route.ts
+++ b/src/app/api/generations/route.ts
@@ -18,6 +18,7 @@ const RequestSchema = z.object({
video: z.string().optional(),
audio: z.string().optional(),
voiceAudio: z.string().optional(),
+ voiceAudio2: z.string().optional(),
})
.optional(),
params: z
diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx
index a413bdc5..e6bec1dc 100644
--- a/src/components/app-sidebar.tsx
+++ b/src/components/app-sidebar.tsx
@@ -6,6 +6,7 @@ import { useTheme } from "next-themes";
import { Suspense } from "react";
import {
AtSign,
+ Layers,
Crop,
FastForward,
Brush,
@@ -74,6 +75,7 @@ const NAV = [
{ href: "/video-edit", label: "Edit video", icon: Scissors },
{ href: "/extend", label: "Extend video", icon: FastForward },
{ href: "/reframe", label: "Reframe", icon: Crop },
+ { href: "/video-tools", label: "Video tools", icon: Layers },
{ href: "/elements", label: "Elements", icon: AtSign },
{ href: "/upscale", label: "Upscale", icon: ZoomIn },
{ href: "/audio", label: "Audio", icon: AudioLines },
diff --git a/src/components/studio/audio-controls.tsx b/src/components/studio/audio-controls.tsx
index 5631db8d..9b012989 100644
--- a/src/components/studio/audio-controls.tsx
+++ b/src/components/studio/audio-controls.tsx
@@ -199,7 +199,7 @@ const display = (() => {
const langLabel = (l: string) => (/^[a-z]{2,3}$/.test(l) ? (display?.of(l) ?? l) : l);
/** Target language for dubbing / translation. */
-export function LanguageChip({ languages, value, onChange }: { languages: string[]; value?: string; onChange: (v: string) => void }) {
+export function LanguageChip({ languages, value, onChange, label = "Translate to…" }: { languages: string[]; value?: string; onChange: (v: string) => void; label?: string }) {
const [open, setOpen] = useState(false);
const [q, setQ] = useState("");
const list = useMemo(() => languages.filter((l) => !q || langLabel(l).toLowerCase().includes(q.toLowerCase())), [languages, q]);
@@ -207,7 +207,7 @@ export function LanguageChip({ languages, value, onChange }: { languages: string
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<button type="button" className={cn(chip, value ? on : idle)}>
- <Globe className="size-3.5" /> {value ? langLabel(value) : "Translate to…"}
+ <Globe className="size-3.5" /> {value ? langLabel(value) : label}
</button>
</PopoverTrigger>
<PopoverContent className="w-72 p-1.5" align="start" side="top" collisionPadding={12}>
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 4d52383b..c81bbd05 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -29,7 +29,7 @@ import { estimateCost, planGeneration, routesFor } from "@/lib/catalog/plan";
import { OPERATION_LABELS, type GenerationRequest, type ModelDef, type Operation, type Preset } from "@/lib/catalog/types";
import { enhance, useCreateGeneration, useElements, useEngine, useStatus } from "@/lib/api";
import { applyMentions, type StudioElement } from "@/lib/catalog/elements";
-import { applySketch } from "@/lib/catalog/sketch";
+import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";
import { formatCost, ratioValue } from "@/lib/format";
import { cn } from "@/lib/utils";
import { PRESET_ICONS } from "@/components/preset-icons";
@@ -262,6 +262,7 @@ function buildRequest(
mask: s.mask?.ref || undefined,
sketch: s.sketch?.ref || undefined,
voiceAudio: s.voiceAudio?.ref || undefined,
+ voiceAudio2: s.voiceAudio2?.ref || undefined,
video: s.video?.ref || undefined,
audio: s.audio?.ref || undefined,
},
@@ -298,7 +299,7 @@ export function Composer({ docked }: { docked: boolean }) {
const rawRequest = buildRequest(config.feature, draft, studioOp, config.promptSuffix);
const mentions = model ? applyMentions(rawRequest, model, elements) : { request: rawRequest, mentioned: [], notes: [] };
const sketched = model ? applySketch(mentions.request, model) : { request: mentions.request };
- const request = sketched.request;
+ const request = model ? stripMotionPaths(sketched.request, model) : sketched.request;
const resolvesOnServer = mentions.mentioned.length > 0 || !!draft.slots.mask?.ref || !!draft.slots.sketch?.ref;
let op: Operation | undefined;
let blocker: string | null = null;
@@ -594,7 +595,25 @@ export function Composer({ docked }: { docked: boolean }) {
}}
/>
)}
- {model && opts.languages && <LanguageChip languages={opts.languages} value={p.targetLanguage} onChange={(targetLanguage) => setP({ targetLanguage })} />}
+ {/* Open-source dialogue clones each speaker from a sample. */}
+ {model && opts.voiceClone && (studioOp ?? op) === "dialogue" &&
+ (["voiceAudio", "voiceAudio2"] as const).map((key, i) => (
+ <VoicePicker
+ key={key}
+ model={{ ...model, options: { ...model.options, voices: [] } }}
+ sample={draft.slots[key]}
+ label={`Speaker ${i ? "B" : "A"}`}
+ onChange={(c) => c?.kind === "sample" && setSlot(key, c.value)}
+ />
+ ))}
+ {model && opts.languages && (
+ <LanguageChip
+ languages={opts.languages}
+ value={p.targetLanguage}
+ label={(studioOp ?? op) === "dub" ? "Translate to…" : "Language"}
+ onChange={(targetLanguage) => setP({ targetLanguage })}
+ />
+ )}
{model && opts.sliders && <SlidersChip model={model} values={p.extra ?? {}} onChange={setExtra} />}
{opts.multiShot && model && <MultiShotChip model={model} params={p} onChange={setP} />}
{opts.draft && (
diff --git a/src/components/studio/mode-switch-studio.tsx b/src/components/studio/mode-switch-studio.tsx
index 32bbb004..89e56eb7 100644
--- a/src/components/studio/mode-switch-studio.tsx
+++ b/src/components/studio/mode-switch-studio.tsx
@@ -10,6 +10,9 @@ import {
SFX_STUDIO,
TRANSLATE_STUDIO,
UPSCALE_STUDIO,
+ VIDEO_DEPTH_STUDIO,
+ VIDEO_MATTE_STUDIO,
+ VIDEO_RELIGHT_STUDIO,
VIDEO_UPSCALE_STUDIO,
VOICE_CHANGE_STUDIO,
} from "@/lib/studios";
@@ -30,6 +33,11 @@ const MODES = {
{ id: "music", label: "Music", config: MUSIC_STUDIO },
{ id: "video", label: "Sound for video", config: FOLEY_STUDIO },
],
+ "video-tools": [
+ { id: "matte", label: "Remove background", config: VIDEO_MATTE_STUDIO },
+ { id: "relight", label: "Relight", config: VIDEO_RELIGHT_STUDIO },
+ { id: "depth", label: "Depth map", config: VIDEO_DEPTH_STUDIO },
+ ],
} as const;
function Inner({ kind }: { kind: keyof typeof MODES }) {
diff --git a/src/components/studio/sketch-editor.tsx b/src/components/studio/sketch-editor.tsx
index c0a89be6..948a220a 100644
--- a/src/components/studio/sketch-editor.tsx
+++ b/src/components/studio/sketch-editor.tsx
@@ -8,6 +8,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
import { Slider } from "@/components/ui/slider";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { uploadFile } from "@/lib/api";
+import type { MotionPaths } from "@/lib/motion-paths";
import { cn } from "@/lib/utils";
/**
@@ -26,6 +27,8 @@ export interface SketchResult {
overlay: string;
/** Small preview for the composer chip. */
preview: string;
+ /** draw mode: every brush stroke as a motion path, normalised to the image (Wan-Move draw-to-video). */
+ motion?: MotionPaths;
}
type Stroke =
@@ -288,7 +291,14 @@ function SketchCanvas({
drawStrokes(octx, strokes, mode, 1);
}
const overlay = await uploadFile(await canvasToFile(ov, mode === "mask" ? "mask-overlay.png" : "sketch.png"));
- onDone({ mask: maskUrl, overlay: overlay.url, preview: overlay.url });
+ const motion: MotionPaths | undefined =
+ mode === "draw"
+ ? {
+ aspect: [W, H],
+ paths: strokes.flatMap((st) => (st.type === "path" && !st.erase && st.points.length > 1 ? [st.points.map(([x, y]) => [x / W, y / H] as [number, number])] : [])),
+ }
+ : undefined;
+ onDone({ mask: maskUrl, overlay: overlay.url, preview: overlay.url, motion });
onOpenChange(false);
} catch (e) {
toast.error((e as Error).message);
diff --git a/src/components/studio/sketch-tools.tsx b/src/components/studio/sketch-tools.tsx
index c230df3b..5442cf4b 100644
--- a/src/components/studio/sketch-tools.tsx
+++ b/src/components/studio/sketch-tools.tsx
@@ -21,7 +21,12 @@ export function SketchTools({ modes, image, autoOpen }: { modes: SketchMode[]; i
}
}, [autoOpen, image, current]);
- const clear = () => setDraft((d) => ({ slots: { ...d.slots, mask: null, sketch: null } }));
+ const clear = () =>
+ setDraft((d) => {
+ const extra = { ...d.params.extra };
+ delete extra.motionPaths;
+ return { slots: { ...d.slots, mask: null, sketch: null }, params: { ...d.params, extra } };
+ });
return (
<>
@@ -69,13 +74,19 @@ export function SketchTools({ modes, image, autoOpen }: { modes: SketchMode[]; i
image={image}
mode={editing}
onDone={(r) =>
- setDraft((d) => ({
- slots: {
- ...d.slots,
- mask: r.mask ? { ref: r.mask, preview: r.preview, kind: "image" } : null,
- sketch: { ref: r.overlay, preview: r.preview, kind: "image" },
- },
- }))
+ setDraft((d) => {
+ const extra = { ...d.params.extra };
+ if (r.motion?.paths.length) extra.motionPaths = r.motion;
+ else delete extra.motionPaths;
+ return {
+ slots: {
+ ...d.slots,
+ mask: r.mask ? { ref: r.mask, preview: r.preview, kind: "image" } : null,
+ sketch: { ref: r.overlay, preview: r.preview, kind: "image" },
+ },
+ params: { ...d.params, extra },
+ };
+ })
}
/>
)}
diff --git a/src/components/train-dialog.tsx b/src/components/train-dialog.tsx
index 316539fe..5ac1a869 100644
--- a/src/components/train-dialog.tsx
+++ b/src/components/train-dialog.tsx
@@ -46,7 +46,11 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioEl
};
const start = useMutation({
mutationFn: async (target: string) => {
- const res = await fetch(`/api/elements/${element.id}/trainings`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ target }) });
+ const res = await fetch(`/api/elements/${element.id}/trainings`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ target }),
+ });
const body = await res.json();
if (!res.ok) throw new Error(body.error);
return body;
@@ -75,7 +79,11 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioEl
onError: (e) => toast.error((e as Error).message),
});
const remove = async (modelId: string) => {
- await fetch(`/api/elements/${element.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ removeIdentities: [modelId] }) });
+ await fetch(`/api/elements/${element.id}`, {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ removeIdentities: [modelId] }),
+ });
refresh();
};
@@ -89,8 +97,8 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioEl
<GraduationCap className="size-5" /> Train {element.name}
</DialogTitle>
<DialogDescription>
- Train once and {element.name} looks right every time — @{element.handle} then uses the trained identity on that model instead of reference photos. Uses all{" "}
- {photos} photos; 15–30 varied ones work best.
+ Train once and {element.name} looks right every time — @{element.handle} then uses the trained identity on that model instead of reference photos.
+ Uses all {photos} photos; 15–30 varied ones work best.
</DialogDescription>
</DialogHeader>
@@ -128,7 +136,12 @@ export function TrainDialog({ element, open, onOpenChange }: { element: StudioEl
{t.price} · {t.eta}
</p>
</div>
- <Button size="sm" variant={busy ? "secondary" : "default"} disabled={!!t.blocker || tooFew || !!busy || start.isPending} onClick={() => start.mutate(t.id)}>
+ <Button
+ size="sm"
+ variant={busy ? "secondary" : "default"}
+ disabled={!!t.blocker || tooFew || !!busy || start.isPending}
+ onClick={() => start.mutate(t.id)}
+ >
{busy ? <Loader2 className="animate-spin" /> : null}
{busy ? "Training" : job?.status === "succeeded" ? "Retrain" : "Train"}
</Button>
diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.ts
index 02f0097c..3bc3b7a1 100644
--- a/src/lib/catalog/cloud-models.generated.ts
+++ b/src/lib/catalog/cloud-models.generated.ts
@@ -6835,6 +6835,147 @@ export const CLOUD_MODELS: ModelDef[] = [
"usd": 0.6
}
},
+ {
+ "id": "birefnet-video",
+ "name": "BiRefNet video (hosted)",
+ "vendor": "ZhengPeng7",
+ "family": "birefnet",
+ "engine": "cloud",
+ "kind": "video",
+ "tagline": "Transparent WebM cut-outs of the subject",
+ "routes": [
+ {
+ "op": "bg-remove-video",
+ "provider": "fal",
+ "endpoint": "fal-ai/birefnet/v2/video",
+ "map": {
+ "prompt": false,
+ "video": "video_url",
+ "fixed": {
+ "video_output_type": "VP9 (.webm)",
+ "model": "General Use (Heavy)"
+ }
+ }
+ }
+ ],
+ "options": {},
+ "pricing": {
+ "unit": "second",
+ "usd": 0.0
+ }
+ },
+ {
+ "id": "bria-video-bg",
+ "name": "Bria video background removal",
+ "vendor": "Bria",
+ "family": "bria",
+ "engine": "cloud",
+ "kind": "video",
+ "tagline": "Production-grade video matting with audio kept",
+ "routes": [
+ {
+ "op": "bg-remove-video",
+ "provider": "fal",
+ "endpoint": "bria/video/background-removal/v3",
+ "map": {
+ "prompt": false,
+ "video": "video_url",
+ "fixed": {
+ "background_color": "Transparent",
+ "output_container_and_codec": "webm_vp9"
+ }
+ }
+ }
+ ],
+ "options": {},
+ "pricing": {
+ "unit": "second",
+ "usd": 0.05
+ }
+ },
+ {
+ "id": "depth-anything-video-cloud",
+ "name": "Video Depth Anything (hosted)",
+ "vendor": "ByteDance",
+ "family": "depth-anything",
+ "engine": "cloud",
+ "kind": "video",
+ "tagline": "Stable depth maps for every frame",
+ "routes": [
+ {
+ "op": "depth-video",
+ "provider": "fal",
+ "endpoint": "fal-ai/depth-anything-video",
+ "map": {
+ "prompt": false,
+ "video": "video_url",
+ "resolution": "resolution",
+ "fixed": {
+ "model": "VDA-Base",
+ "colormap": "grayscale"
+ }
+ }
+ }
+ ],
+ "options": {
+ "resolutions": [
+ "auto",
+ "360p",
+ "480p",
+ "720p",
+ "1080p"
+ ]
+ },
+ "pricing": {
+ "unit": "second",
+ "usd": 0.04
+ }
+ },
+ {
+ "id": "lightx-relight",
+ "name": "LightX Relight",
+ "vendor": "LightX",
+ "family": "lightx",
+ "engine": "cloud",
+ "kind": "video",
+ "tagline": "Relight a video from a description and a light direction",
+ "routes": [
+ {
+ "op": "relight-video",
+ "provider": "fal",
+ "endpoint": "fal-ai/lightx/relight",
+ "map": {
+ "prompt": "relight_parameters.relight_prompt",
+ "video": "video_url",
+ "seed": "seed",
+ "fixed": {
+ "relit_cond_type": "ic",
+ "relight_parameters.bg_source": "Left"
+ }
+ }
+ }
+ ],
+ "options": {
+ "seed": true,
+ "controls": [
+ {
+ "param": "relight_parameters.bg_source",
+ "label": "Light from",
+ "values": [
+ "Left",
+ "Right",
+ "Top",
+ "Bottom"
+ ],
+ "default": "Left"
+ }
+ ]
+ },
+ "pricing": {
+ "unit": "second",
+ "usd": 0.1
+ }
+ },
{
"id": "mmaudio-cloud",
"name": "MMAudio",
diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts
index b3cd9b45..73b2142e 100644
--- a/src/lib/catalog/index.ts
+++ b/src/lib/catalog/index.ts
@@ -60,6 +60,8 @@ function withFunCamera(p: Preset): Preset {
/** Open-source routes that need a dedicated workflow rather than an edit prompt. */
const APP_OPEN_OVERRIDES: Record<string, Preset["open"]> = {
"app-face-swap": { modelId: "oss-reactor", op: "face-swap" },
+ // Qwen-Image-Edit with the Relight LoRA beats a plain edit prompt for lighting changes.
+ "app-relight": { modelId: "oss-qwen-relight", op: "edit" },
};
export const APPS: Preset[] = RAW_APPS.map((a) => (APP_OPEN_OVERRIDES[a.id] ? { ...a, open: APP_OPEN_OVERRIDES[a.id] } : a)).map(withOssLoras);
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index bd7fe175..e85c4460 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -11,6 +11,18 @@ import type { ModelDef, ModelRoute, Operation } from "./types";
const comfy = (op: Operation, workflow: string, note?: string): ModelRoute => ({ op, provider: "comfyui", endpoint: workflow, note });
+/** Chatterbox Multilingual's language list (FL_ChatterboxMultilingualTTS). */
+const CHATTERBOX_LANGUAGES = [
+ "English (en)", "Spanish (es)", "French (fr)", "German (de)", "Italian (it)", "Portuguese (pt)", "Dutch (nl)", "Polish (pl)", "Russian (ru)",
+ "Turkish (tr)", "Arabic (ar)", "Hebrew (he)", "Hindi (hi)", "Japanese (ja)", "Korean (ko)", "Chinese (zh)", "Malay (ms)", "Swedish (sv)",
+ "Danish (da)", "Norwegian (no)", "Finnish (fi)", "Greek (el)", "Swahili (sw)",
+];
+const CHATTERBOX_SLIDERS = [
+ { param: "exaggeration", label: "Emotion", min: 0.25, max: 2, step: 0.05, default: 0.5 },
+ { param: "cfg", label: "Pace / guidance", min: 0.2, max: 1, step: 0.05, default: 0.5 },
+ { param: "temperature", label: "Variety", min: 0.05, max: 2, step: 0.05, default: 0.8 },
+];
+
const IMG_AR = ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3", "21:9", "5:4", "4:5"];
const VID_AR = ["16:9", "9:16", "1:1"];
@@ -422,7 +434,165 @@ const open: ModelDef[] = [
hidden: true,
}),
+ // ---------------- Video tools (extend, reframe, relight, draw-to-video, mattes, depth)
+ o({
+ id: "oss-wan22-vace-extend",
+ name: "Wan 2.2 Fun VACE Extend",
+ vendor: "Alibaba Wan",
+ family: "wan",
+ kind: "video",
+ tagline: "Continues a clip from its last 16 frames — same look and characters",
+ routes: [comfy("extend", "video-extend-wan22-fun-vace", "Lightx2v 4-step")],
+ options: { durations: [3, 4, 5, 6], resolutions: ["480p", "720p"], seed: true, negativePrompt: true },
+ defaults: { duration: 4, resolution: "480p" },
+ }),
+ o({
+ id: "oss-wan22-vace-reframe",
+ name: "Wan 2.2 Fun VACE Reframe",
+ vendor: "Alibaba Wan",
+ family: "wan",
+ kind: "video",
+ tagline: "Outpaints a clip to a new aspect ratio",
+ routes: [comfy("reframe", "video-reframe-wan22-fun-vace", "Lightx2v 4-step")],
+ options: { aspectRatios: ["9:16", "16:9", "1:1", "4:5", "3:4", "4:3", "21:9"], resolutions: ["480p", "720p"], seed: true, negativePrompt: true },
+ defaults: { aspectRatio: "9:16", resolution: "480p" },
+ }),
+ o({
+ id: "oss-wan-move",
+ name: "Wan-Move",
+ vendor: "Alibaba Wan",
+ family: "wan",
+ kind: "video",
+ tagline: "Draw motion paths on the first frame — things move exactly along them",
+ badges: ["new"],
+ routes: [comfy("i2v", "draw-to-video-wan-move")],
+ options: { durations: [3, 4, 5], seed: true, negativePrompt: true, motionPaths: true },
+ defaults: { duration: 5 },
+ }),
+ o({
+ id: "oss-bernini-relight",
+ name: "Bernini-R Relight",
+ vendor: "Bernini",
+ family: "wan",
+ kind: "video",
+ tagline: "Relight a video from a description of the new light",
+ routes: [comfy("relight-video", "video-relight-bernini-r", "Wan 2.2 fine-tune, 6 steps")],
+ options: { resolutions: ["480p", "720p"], seed: true, negativePrompt: true },
+ defaults: { resolution: "480p" },
+ }),
+ o({
+ id: "oss-video-matte-birefnet",
+ name: "BiRefNet video matte",
+ vendor: "ZhengPeng7",
+ family: "birefnet",
+ kind: "video",
+ tagline: "Cut the subject out of every frame — transparent WebM plus a matte",
+ routes: [comfy("bg-remove-video", "video-bg-remove-birefnet")],
+ options: {},
+ }),
+ o({
+ id: "oss-video-matte-sam3",
+ name: "SAM 3 video cutout",
+ vendor: "Meta",
+ family: "sam",
+ kind: "video",
+ tagline: "Keep just the object you name (“the dog”, “the red car”)",
+ routes: [comfy("bg-remove-video", "video-bg-remove-sam3")],
+ options: {},
+ }),
+ o({
+ id: "oss-video-depth-da3",
+ name: "Depth Anything 3",
+ vendor: "ByteDance",
+ family: "depth-anything",
+ kind: "video",
+ tagline: "Per-frame depth maps for compositing and 3D effects",
+ routes: [comfy("depth-video", "video-depth-da3")],
+ options: {},
+ }),
+ o({
+ id: "oss-video-depth-vda",
+ name: "Video Depth Anything (small)",
+ vendor: "ByteDance",
+ family: "depth-anything",
+ kind: "video",
+ tagline: "Temporally stable, flicker-free depth",
+ routes: [comfy("depth-video", "video-depth-vda-small")],
+ options: {},
+ }),
+ o({
+ id: "oss-qwen-relight",
+ name: "Qwen-Image-Edit Relight",
+ vendor: "Alibaba Qwen",
+ family: "qwen-image",
+ kind: "image",
+ tagline: "Relight a photo from a description (Relight LoRA, 4 steps)",
+ routes: [comfy("edit", "relight-qwen-edit-2509", "Relight LoRA + Lightning")],
+ options: { seed: true, negativePrompt: true, maxImages: 1 },
+ hidden: true,
+ }),
+ o({
+ id: "oss-qwen-next-scene",
+ name: "Qwen-Image-Edit Next Scene",
+ vendor: "Alibaba Qwen",
+ family: "qwen-image",
+ kind: "image",
+ tagline: "The next storyboard panel from the previous one (next-scene LoRA)",
+ routes: [comfy("edit", "storyboard-qwen-edit-2509-next-scene", "next-scene LoRA v2")],
+ options: { seed: true, negativePrompt: true, maxImages: 2 },
+ hidden: true,
+ }),
+
// ---------------- Audio
+ o({
+ id: "oss-chatterbox",
+ name: "Chatterbox Multilingual",
+ vendor: "Resemble AI",
+ family: "chatterbox",
+ kind: "audio",
+ tagline: "Clone any voice from a short sample, in 23 languages",
+ badges: ["top"],
+ routes: [comfy("tts", "tts-chatterbox-multilingual")],
+ options: { voiceClone: true, languages: CHATTERBOX_LANGUAGES, sliders: CHATTERBOX_SLIDERS, seed: true },
+ }),
+ o({
+ id: "oss-indextts2",
+ name: "IndexTTS-2",
+ vendor: "Bilibili",
+ family: "index-tts",
+ kind: "audio",
+ tagline: "Expressive zero-shot cloning (commercial use under 100M users)",
+ routes: [comfy("tts", "tts-indextts2")],
+ options: { voiceClone: true },
+ }),
+ o({
+ id: "oss-chatterbox-dialogue",
+ name: "Chatterbox Dialogue",
+ vendor: "Resemble AI",
+ family: "chatterbox",
+ kind: "audio",
+ tagline: "Two speakers, each cloned from a sample",
+ routes: [comfy("dialogue", "tts-dialogue-chatterbox")],
+ options: {
+ voiceClone: true,
+ voices: [
+ { id: "A", name: "Speaker A" },
+ { id: "B", name: "Speaker B" },
+ ],
+ sliders: CHATTERBOX_SLIDERS,
+ seed: true,
+ },
+ }),
+ o({
+ id: "oss-chatterbox-vc",
+ name: "Chatterbox Voice Conversion",
+ vendor: "Resemble AI",
+ family: "chatterbox",
+ kind: "audio",
+ tagline: "Say it in anyone's voice — keeps your timing and emotion",
+ routes: [comfy("voice-change", "voice-change-chatterbox")],
+ options: { voiceClone: true, seed: true },
+ }),
o({
id: "oss-ace-step",
name: "ACE-Step 1.5",
diff --git a/src/lib/catalog/payload.ts b/src/lib/catalog/payload.ts
index 83aa3bb6..49f2a331 100644
--- a/src/lib/catalog/payload.ts
+++ b/src/lib/catalog/payload.ts
@@ -16,7 +16,7 @@ function setPath(out: Record<string, unknown>, key: string, value: unknown) {
/** Build a provider payload from canonical input using a route's {@link FieldMap}. Pure + unit-tested. */
export function buildPayload(map: FieldMap, input: GenInput): Record<string, unknown> {
const out: Record<string, unknown> = {};
- if (map.prompt !== false && input.prompt !== undefined) out[map.prompt ?? "prompt"] = input.prompt;
+ if (map.prompt !== false && input.prompt !== undefined) setPath(out, map.prompt ?? "prompt", input.prompt);
if (map.negativePrompt && input.negativePrompt) out[map.negativePrompt] = input.negativePrompt;
const images = input.images ?? [];
@@ -76,8 +76,7 @@ export function buildPayload(map: FieldMap, input: GenInput): Record<string, unk
if (map.targetLanguage && input.targetLanguage) out[map.targetLanguage] = input.targetLanguage;
if (map.draftId && input.draftId) out[map.draftId] = input.draftId;
- Object.assign(out, map.fixed ?? {});
- Object.assign(out, input.extra ?? {});
+ for (const [k, v] of Object.entries({ ...map.fixed, ...input.extra })) setPath(out, k, v);
return out;
}
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index c0a56a04..a6304c4d 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -88,7 +88,7 @@ export interface Plan {
/** Operations that work from their inputs alone. */
const PROMPTLESS = new Set<Operation>([
- "finalize", "reframe", "dialogue", "voice-change", "dub", "upscale-image", "upscale-video", "bg-remove",
+ "finalize", "reframe", "dialogue", "voice-change", "dub", "bg-remove-video", "depth-video", "upscale-image", "upscale-video", "bg-remove",
"interpolate", "v2a", "face-swap", "motion-transfer", "lipsync", "avatar",
]);
@@ -147,6 +147,10 @@ export function planGeneration(
if (op === "finalize" && !params.draftId) throw new Error("Pick a draft to finish");
if (op === "dialogue" && !params.dialogue?.some((l) => l.text.trim())) throw new Error("Write at least one line");
if (op === "dub" && !params.targetLanguage) throw new Error("Pick a language to translate into");
+ if (model.options.motionPaths && !(params.extra?.motionPaths as { paths?: unknown[] } | undefined)?.paths?.length) {
+ throw new Error(`Draw on the start frame — ${model.name} moves things along the paths you draw`);
+ }
+ if (op === "dialogue" && model.options.voiceClone && (!req.inputs?.voiceAudio || !req.inputs?.voiceAudio2)) throw new Error("Add a voice sample for each speaker");
if ((op === "tts" || op === "voice-change") && model.options.voiceClone && !model.options.voices?.length && !req.inputs?.voiceAudio) {
throw new Error(op === "tts" ? "Pick or record the voice to speak with" : "Pick or record the voice to change into");
}
@@ -187,6 +191,9 @@ const NEEDS: Partial<Record<Operation, { images?: number; video?: boolean; audio
extend: { video: true, msg: "Add the video to continue" },
reframe: { video: true, msg: "Add a video to reframe" },
"voice-change": { audio: true, msg: "Add the recording to re-voice" },
+ "bg-remove-video": { video: true, msg: "Add a video" },
+ "depth-video": { video: true, msg: "Add a video" },
+ "relight-video": { video: true, msg: "Add a video to relight" },
};
/** Human message for the first missing input of an operation, or null. */
diff --git a/src/lib/catalog/sketch.ts b/src/lib/catalog/sketch.ts
index e89a89e9..2906d077 100644
--- a/src/lib/catalog/sketch.ts
+++ b/src/lib/catalog/sketch.ts
@@ -48,6 +48,10 @@ export function applySketch(req: GenerationRequest, model: ModelDef): { request:
},
};
}
+ // Wan-Move follows the strokes themselves (sent as motion paths) on the clean start frame.
+ if (model.kind === "video" && model.options.motionPaths) {
+ return { request: { ...req, op: "i2v", inputs: rest } };
+ }
if (model.kind === "video" && has("i2v")) {
return {
request: {
@@ -60,3 +64,11 @@ export function applySketch(req: GenerationRequest, model: ModelDef): { request:
}
return { request: { ...req, inputs: rest }, note: `${model.name} can't follow a drawing — pick an edit or image-to-video model` };
}
+
+/** Drop drawn motion paths from models that can't use them (they'd be sent as an unknown field). */
+export function stripMotionPaths(req: GenerationRequest, model: ModelDef): GenerationRequest {
+ if (model.options.motionPaths || !req.params?.extra || !("motionPaths" in req.params.extra)) return req;
+ const extra = { ...req.params.extra };
+ delete extra.motionPaths;
+ return { ...req, params: { ...req.params, extra } };
+}
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index 3349f892..de45d585 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -40,7 +40,10 @@ export type Operation =
| "finalize" // draft video → full-quality render of the same take
| "dialogue" // several speakers → one audio track
| "voice-change" // speech audio → the same speech in another voice
- | "dub"; // video (or audio) → translated, re-voiced and lip-synced
+ | "dub" // video (or audio) → translated, re-voiced and lip-synced
+ | "bg-remove-video" // video → the subject on a transparent background
+ | "depth-video" // video → depth map video
+ | "relight-video"; // video → the same shot under new lighting
export const OPERATION_LABELS: Record<Operation, string> = {
t2i: "Text to image",
@@ -71,6 +74,9 @@ export const OPERATION_LABELS: Record<Operation, string> = {
dialogue: "Dialogue",
"voice-change": "Voice change",
dub: "Translate & dub",
+ "bg-remove-video": "Video background removal",
+ "depth-video": "Video depth map",
+ "relight-video": "Video relight",
};
export const OPERATION_OUTPUT: Record<Operation, MediaKind> = {
@@ -102,6 +108,9 @@ export const OPERATION_OUTPUT: Record<Operation, MediaKind> = {
dialogue: "audio",
"voice-change": "audio",
dub: "video",
+ "bg-remove-video": "video",
+ "depth-video": "video",
+ "relight-video": "video",
};
export type ProviderId = "fal" | "replicate" | "higgsfield" | "openai" | "google" | "comfyui" | "mock" | "local";
@@ -204,6 +213,8 @@ export interface ModelOptions {
voices?: { id: string; name: string; hint?: string }[];
/** Takes a reference recording to clone a voice from. */
voiceClone?: boolean;
+ /** Follows motion paths drawn on the start frame (Wan-Move). */
+ motionPaths?: boolean;
/** Languages it can translate into. */
languages?: string[];
/** Numeric settings sent as-is (stability, similarity, speed, exaggeration…). */
@@ -291,6 +302,8 @@ export interface GenerationRequest {
audio?: string;
/** Reference recording of the voice to speak with / convert into. */
voiceAudio?: string;
+ /** Second speaker's reference voice (open-source dialogue). */
+ voiceAudio2?: string;
};
params?: GenParams;
/** Values for preset option pickers (apps). */
@@ -309,6 +322,7 @@ export interface GenInput extends GenParams {
video?: string;
audio?: string;
voiceAudio?: string;
+ voiceAudio2?: string;
loras?: LoraRef[];
}
@@ -351,7 +365,7 @@ export interface Generation {
/** Input slot a preset asks the user for. */
export interface InputSlot {
- key: "image" | "image2" | "image3" | "endImage" | "video" | "audio" | "mask" | "sketch" | "voiceAudio";
+ key: "image" | "image2" | "image3" | "endImage" | "video" | "audio" | "mask" | "sketch" | "voiceAudio" | "voiceAudio2";
label: string;
hint?: string;
accept: MediaKind;
diff --git a/src/lib/motion-paths.ts b/src/lib/motion-paths.ts
new file mode 100644
index 00000000..4c848392
--- /dev/null
+++ b/src/lib/motion-paths.ts
@@ -0,0 +1,35 @@
+/**
+ * Motion paths drawn on a start frame (Draw to Video). Stored normalised (0–1) to the image,
+ * resampled for Wan-Move as one pixel point per output frame per track.
+ */
+export interface MotionPaths {
+ /** Start image width and height (for its aspect ratio). */
+ aspect: [number, number];
+ /** Each path is a list of [x, y] in 0–1, in drawing order. */
+ paths: [number, number][][];
+}
+
+/** Evenly spaced points along a polyline (constant speed over the clip). */
+export function resample(path: [number, number][], count: number): [number, number][] {
+ if (!path.length) return [];
+ if (path.length === 1 || count === 1) return Array.from({ length: count }, () => path[0]);
+ const cum = [0];
+ for (let i = 1; i < path.length; i++) cum.push(cum[i - 1] + Math.hypot(path[i][0] - path[i - 1][0], path[i][1] - path[i - 1][1]));
+ const total = cum[cum.length - 1] || 1;
+ const out: [number, number][] = [];
+ let j = 0;
+ for (let k = 0; k < count; k++) {
+ const d = (total * k) / (count - 1);
+ while (j < cum.length - 2 && cum[j + 1] < d) j++;
+ const seg = cum[j + 1] - cum[j] || 1;
+ const t = Math.min(1, Math.max(0, (d - cum[j]) / seg));
+ out.push([path[j][0] + (path[j + 1][0] - path[j][0]) * t, path[j][1] + (path[j + 1][1] - path[j][1]) * t]);
+ }
+ return out;
+}
+
+export function tracksFor(m: MotionPaths, width: number, height: number, frames: number): { x: number; y: number }[][] {
+ return m.paths
+ .filter((p) => p.length)
+ .map((p) => resample(p, frames).map(([x, y]) => ({ x: Math.round(x * (width - 1)), y: Math.round(y * (height - 1)) })));
+}
diff --git a/src/lib/studios.ts b/src/lib/studios.ts
index df37282b..f5dc4e3e 100644
--- a/src/lib/studios.ts
+++ b/src/lib/studios.ts
@@ -130,7 +130,7 @@ export const AUDIO_STUDIO: StudioConfig = {
ops: ["tts"],
feed: { kind: "audio", features: ["audio"] },
slots: [],
- defaultModels: { cloud: "elevenlabs-v4", open: "" },
+ defaultModels: { cloud: "elevenlabs-v4", open: "oss-chatterbox" },
suggestions: ["Welcome to Fuobe — make anything, with any model.", "[whispers] Don't look now… but I think it's following us.", "Breaking news: the robots have learned to paint."],
};
@@ -144,7 +144,7 @@ export const DIALOGUE_STUDIO: StudioConfig = {
ops: ["dialogue"],
feed: { kind: "audio", features: ["audio"] },
slots: [],
- defaultModels: { cloud: "elevenlabs-dialogue", open: "" },
+ defaultModels: { cloud: "elevenlabs-dialogue", open: "oss-chatterbox-dialogue" },
promptOptional: true,
hidePrompt: true,
};
@@ -159,7 +159,7 @@ export const VOICE_CHANGE_STUDIO: StudioConfig = {
ops: ["voice-change"],
feed: { kind: "audio", features: ["audio"] },
slots: [{ key: "audio", label: "Recording", accept: "audio", required: true }],
- defaultModels: { cloud: "elevenlabs-voice-changer", open: "" },
+ defaultModels: { cloud: "elevenlabs-voice-changer", open: "oss-chatterbox-vc" },
promptOptional: true,
hidePrompt: true,
};
@@ -286,7 +286,7 @@ export const EXTEND_STUDIO: StudioConfig = {
ops: ["extend"],
feed: { features: ["extend"] },
slots: [{ key: "video", label: "Video", accept: "video", required: true }],
- defaultModels: { cloud: "seedance-2-5", open: "" },
+ defaultModels: { cloud: "seedance-2-5", open: "oss-wan22-vace-extend" },
suggestions: ["The camera pulls back to reveal the whole city", "She turns and smiles at the camera", "A storm rolls in and lightning hits"],
};
@@ -300,6 +300,41 @@ export const REFRAME_STUDIO: StudioConfig = {
ops: ["reframe"],
feed: { features: ["reframe"] },
slots: [{ key: "video", label: "Video", accept: "video", required: true }],
- defaultModels: { cloud: "luma-ray-3-2", open: "" },
+ defaultModels: { cloud: "luma-ray-3-2", open: "oss-wan22-vace-reframe" },
promptOptional: true,
};
+
+export const VIDEO_MATTE_STUDIO: StudioConfig = {
+ feature: "video-tools",
+ title: "Video tools",
+ hero: "Cut out the subject",
+ subtitle: "Every frame matted — a transparent WebM you can drop over anything.",
+ placeholder: "Optional (SAM 3): what to keep, e.g. “the dog”",
+ kind: "video",
+ ops: ["bg-remove-video"],
+ feed: { features: ["video-tools"] },
+ slots: [{ key: "video", label: "Video", accept: "video", required: true }],
+ defaultModels: { cloud: "bria-video-bg", open: "oss-video-matte-birefnet" },
+ promptOptional: true,
+};
+
+export const VIDEO_DEPTH_STUDIO: StudioConfig = {
+ ...VIDEO_MATTE_STUDIO,
+ hero: "A depth map for every frame",
+ subtitle: "For compositing, fog, parallax and 3D effects.",
+ placeholder: "",
+ ops: ["depth-video"],
+ defaultModels: { cloud: "depth-anything-video-cloud", open: "oss-video-depth-vda" },
+ hidePrompt: true,
+};
+
+export const VIDEO_RELIGHT_STUDIO: StudioConfig = {
+ ...VIDEO_MATTE_STUDIO,
+ hero: "Relight the shot",
+ subtitle: "Describe the new light — golden hour, neon, a single window, a campfire.",
+ placeholder: "e.g. “warm sunset light from the left, long soft shadows”",
+ ops: ["relight-video"],
+ defaultModels: { cloud: "lightx-relight", open: "oss-bernini-relight" },
+ promptOptional: false,
+ suggestions: ["Warm golden-hour sun from the left", "Pink and blue neon from the street", "A single cold window light, dark room", "Flickering campfire light from below"],
+};
diff --git a/src/server/generations.ts b/src/server/generations.ts
index 05743797..1647a982 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -4,7 +4,7 @@ import path from "node:path";
import { nanoid } from "nanoid";
import { getModel, getPreset } from "@/lib/catalog";
import { applyMentions } from "@/lib/catalog/elements";
-import { applySketch } from "@/lib/catalog/sketch";
+import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";
import { estimateCost, planGeneration, routesFor } from "@/lib/catalog/plan";
import {
OPERATION_OUTPUT,
@@ -168,7 +168,7 @@ export function chooseRoute(candidates: ModelRoute[]): { route: ModelRoute; demo
export function createGenerations(original: GenerationRequest): Generation[] {
// @element mentions become reference images / LoRAs; the stored request keeps the mentions for "Reuse".
const model = getModel(original.modelId);
- const req = model ? applySketch(applyMentions(original, model, listElements()).request, model).request : original;
+ const req = model ? stripMotionPaths(applySketch(applyMentions(original, model, listElements()).request, model).request, model) : original;
const plan = planGeneration(req, getModel, getPreset);
const mode = engineMode();
if (mode !== "both" && plan.model.engine !== mode) {
@@ -264,6 +264,7 @@ async function submit(
video: await prep(req.inputs?.video),
audio: await prep(req.inputs?.audio),
voiceAudio: await prep(req.inputs?.voiceAudio),
+ voiceAudio2: await prep(req.inputs?.voiceAudio2),
loras: plan.loras,
// Vary seeds across a batch so N jobs don't return N identical results.
seed: plan.params.seed !== undefined && plan.params.seed >= 0 ? plan.params.seed + index : undefined,
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index 6a010840..c7d20606 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -1,6 +1,7 @@
import "server-only";
import fs from "node:fs";
import path from "node:path";
+import { tracksFor, type MotionPaths } from "@/lib/motion-paths";
import { nanoid } from "nanoid";
import {
applyBindings,
@@ -202,10 +203,22 @@ export const comfyProvider: ProviderAdapter = {
audio: input.audio,
seed: input.seed !== undefined && input.seed >= 0 ? input.seed : randomSeed(),
};
+ // Voice workflows: "audio" is the voice to speak with (TTS), speaker A (dialogue) or the speech to convert
+ // (voice change, whose target voice is "audio2").
+ if (route.op === "tts") values.audio = input.voiceAudio ?? input.audio;
+ if (route.op === "dialogue") {
+ values.audio = input.voiceAudio;
+ values.audio2 = input.voiceAudio2;
+ values.prompt = (input.dialogue ?? []).filter((l) => l.text.trim()).map((l) => `SPEAKER ${l.voice === "B" ? "B" : "A"}: ${l.text.trim()}`).join("\n");
+ }
+ if (route.op === "voice-change") values.audio2 = input.voiceAudio;
+ if (manifest.bindings.language && input.targetLanguage) values.language = input.targetLanguage;
if (manifest.bindings.width || manifest.bindings.height) {
const multiple = Number(manifest.limits?.dimensionMultiple ?? 16);
+ // With motion paths the frame keeps the start image's shape, so the paths need no cropping.
+ const srcAspect = (input.extra?.motionPaths as MotionPaths | undefined)?.aspect;
const dims = computeDimensions(
- input.aspectRatio === "auto" ? undefined : input.aspectRatio,
+ srcAspect ? `${srcAspect[0]}:${srcAspect[1]}` : input.aspectRatio === "auto" ? undefined : input.aspectRatio,
input.resolution,
{ width: Number(d.width ?? 1024), height: Number(d.height ?? 1024) },
multiple,
@@ -221,10 +234,18 @@ export const comfyProvider: ProviderAdapter = {
const fps = Number(d.fps ?? 16);
values.frames = computeFrames(input.duration, fps, Number(d.frameStep ?? 4), manifest.limits?.maxFrames);
}
+ // Drawn motion paths (normalised to the start frame) → one pixel point per output frame (Wan-Move).
+ const extra = { ...(input.extra ?? {}) };
+ const paths = extra.motionPaths as MotionPaths | undefined;
+ delete extra.motionPaths;
+ if (manifest.bindings.tracks && paths?.paths.length) {
+ const frames = Number(values.frames ?? d.frames ?? 81);
+ values.tracks = JSON.stringify(tracksFor(paths, Number(values.width ?? d.width ?? 832), Number(values.height ?? d.height ?? 480), frames));
+ }
if (manifest.bindings.duration && input.duration) values.duration = input.duration;
if (manifest.bindings.tags && !manifest.bindings.prompt) values.tags = input.prompt;
if (manifest.bindings.filenamePrefix) values.filenamePrefix = `fuobe/${generationId}`;
- for (const [k, v] of Object.entries(input.extra ?? {})) values[k as BindingKey] = v;
+ for (const [k, v] of Object.entries(extra)) values[k as BindingKey] = v;
const bound = applyBindings(workflow, manifest.bindings, values);
const missing = bound.missing;
diff --git a/tests/open-engine.test.ts b/tests/open-engine.test.ts
new file mode 100644
index 00000000..9c0a4f17
--- /dev/null
+++ b/tests/open-engine.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from "vitest";
+import { getModel, getPreset } from "@/lib/catalog";
+import { planGeneration } from "@/lib/catalog/plan";
+import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";
+import { resample, tracksFor } from "@/lib/motion-paths";
+
+describe("motion paths (Wan-Move draw to video)", () => {
+ it("resamples a path to evenly spaced points, one per frame", () => {
+ const pts = resample([[0, 0], [1, 0], [1, 1]], 5);
+ expect(pts.map(([x, y]) => [Number(x.toFixed(2)), Number(y.toFixed(2))])).toEqual([[0, 0], [0.5, 0], [1, 0], [1, 0.5], [1, 1]]);
+ });
+
+ it("scales normalised paths to the workflow's pixel grid", () => {
+ const t = tracksFor({ aspect: [16, 9], paths: [[[0, 0], [1, 1]]] }, 833, 481, 3);
+ expect(t).toEqual([[{ x: 0, y: 0 }, { x: 416, y: 240 }, { x: 832, y: 480 }]]);
+ });
+
+ it("keeps the clean start frame for Wan-Move and drops paths for other models", () => {
+ const req = { feature: "video", prompt: "the boat sails off", inputs: { images: ["/a.png"], sketch: "/drawn.png" }, params: { extra: { motionPaths: { aspect: [1, 1], paths: [[[0, 0], [1, 1]]] } } } };
+ const wm = getModel("oss-wan-move")!;
+ const r = applySketch({ ...req, modelId: wm.id }, wm).request;
+ expect(r.inputs?.images).toEqual(["/a.png"]);
+ expect(r.prompt).toBe("the boat sails off");
+ expect(planGeneration(r, getModel, getPreset).op).toBe("i2v");
+ const kling = getModel("kling-2-5-turbo")!;
+ expect(stripMotionPaths({ ...req, modelId: kling.id }, kling).params?.extra).toEqual({});
+ expect(() => planGeneration({ feature: "video", modelId: wm.id, prompt: "x", inputs: { images: ["/a.png"] } }, getModel, getPreset)).toThrow(/Draw on the start frame/);
+ });
+});
+
+describe("open-source voice", () => {
+ it("needs a sample per speaker for Chatterbox dialogue", () => {
+ const req = { feature: "audio", modelId: "oss-chatterbox-dialogue", params: { dialogue: [{ text: "Hi", voice: "A" }] } };
+ expect(() => planGeneration(req, getModel, getPreset)).toThrow(/each speaker/);
+ expect(planGeneration({ ...req, inputs: { voiceAudio: "/a.wav", voiceAudio2: "/b.wav" } }, getModel, getPreset).op).toBe("dialogue");
+ });
+ it("routes the relight app to the Relight LoRA workflow on the open engine", () => {
+ expect(getPreset("app-relight")?.open?.modelId).toBe("oss-qwen-relight");
+ });
+});