The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Merge origin/claude/fuobe-parity-4 into o/dbs-d7
Claude1c1d15a36eb5
diff --cc src/components/genjutsu/genjutsu-studio.tsxindex 689443ba,9f12724b..d2f43170--- a/src/components/genjutsu/genjutsu-studio.tsx+++ b/src/components/genjutsu/genjutsu-studio.tsx@@@ -59,11 -59,9 +59,11 @@@ import { downloadHref, downloadName } fimport { keepOffered, offered } from "@/lib/model-access";import { cn } from "@/lib/utils";import { refusalShown, toastError } from "@/lib/refusals";- import { CharacterControls, CharacterFacts } from "./character-panel";+ import { CharacterControls, CharacterFacts, qualityOff } from "./character-panel";import { useDescribeCharacter, useGenjutsuEstimate, useGenjutsuRun, useTranscribeClip, waitForGeneration, type GenjutsuBody } from "./hooks";import { LookPicker, type LookSource } from "./look-picker";+import { OriginalSoundField, soundBody } from "@/components/studio/original-sound-field";+import { defaultSound, type SoundChoice } from "@/lib/av/original-sound";import { SetupCode } from "./setup-code";import { useClipCuts } from "./use-cuts";diff --cc src/components/remove-object/hooks.tsindex 3f325809,c232fc7a..f93bf4fc--- a/src/components/remove-object/hooks.ts+++ b/src/components/remove-object/hooks.ts@@@ -20,8 -19,8 +20,10 @@@ export interface RemovalBodymask?: string;source: { url: string; name?: string; duration?: number; fps?: number; width?: number; height?: number; hasAudio?: boolean };range?: { start: number; end: number };+ /** Original sound (unset = Everything). */+ sound?: SoundChoice;+ /** H3 Person Removal: the person's mask grown by this many pixels. */+ maskGrow?: number;/** Client nonce: a repeat of it gets the first answer (see useSubmitGuard). */requestId?: string;}diff --cc src/components/remove-object/remove-object-tool.tsxindex c8de0283,ceca880f..38674b7c--- a/src/components/remove-object/remove-object-tool.tsx+++ b/src/components/remove-object/remove-object-tool.tsx@@@ -86,8 -96,11 +98,12 @@@ export function RemoveObjectTool({ tabsconst [mode, setMode] = useState<RemoveMode>("type");const [prompt, setPrompt] = useState("");const [effects, setEffects] = useState(false);+ const [soundPick, setSoundPick] = useState<SoundChoice | null>(null);+ // "Remove a person" (its own Video tools tab, or ?person=1 from a result's menu): H3 Person Removal on your GPU.+ const personLinked = useSyncExternalStore(noSubscribe, personInUrl, () => false);+ const personAsked = person || personLinked;const [picked, setPicked] = useState<Record<string, string>>({});+ const [maskGrow, setMaskGrow] = useState<number>(REMOVE.maskGrow.default);const [points, setPoints] = useState<PixelPoint[]>([]);const [pointLabel, setPointLabel] = useState<"positive" | "negative">("positive");const [paint, setPaint] = useState<Paint | null>(null);@@@ -188,9 -215,9 +221,10 @@@...(mode === "click" ? { points } : {}),...(mode === "paint" && paint ? { mask: paint.mask } : {}),...(mode !== "type" && frame ? { frame: { width: frame.width, height: frame.height } } : {}),+ ...(h3 ? { maskGrow } : {}),source: { url: clip.url!, name: clip.name, duration, fps: clip.info?.fps, width: size.width, height: size.height, hasAudio: clip.info?.hasAudio },range: { start: range.startTime, end: range.endTime },+ ...soundBody(engine, sound),}: null;const estimate = useRemovalEstimate(body);@@@ -449,7 -480,47 +487,48 @@@</p>)}+ {clip && <OriginalSoundField engine={engine} value={sound} onChange={setSoundPick} hasAudio={clip.info?.hasAudio} suggested={soundSuggested} />}+ {personOnCloud && (+ <div className="space-y-2 rounded-xl bg-muted/60 p-3 text-[13px]" role="status">+ <p className="flex gap-1.5">+ <Cpu className="mt-0.5 size-3.5 shrink-0" />+ <span>+ Removing a person with MiniMax H3 runs on your GPU (open source): the person is filled green and the scene rebuilt behind them. In the cloud, Kling O3 Omni or Bria erase who you name, and LTX+ Clean Plate removes everyone.+ </span>+ </p>+ {engineMode === "both" && (+ <Button size="sm" variant="outline" className="rounded-full" onClick={() => setEngine("open")}>+ <Cpu className="size-3.5" /> Use your GPU+ </Button>+ )}+ </div>+ )}++ {personOff && (+ <p className="flex gap-1.5 rounded-xl bg-muted/60 p-3 text-[13px]" role="status">+ <Cpu className="mt-0.5 size-3.5 shrink-0" />+ <span>Person removal with MiniMax H3 is turned off here{eraser ? `, so ${eraser.label} is used instead` : ""}.</span>+ </p>+ )}++ {h3 && (+ <Field label="Mask expansion" htmlFor="remove-grow" hint={`${REMOVE.maskGrow.min}–${REMOVE.maskGrow.max} px`}>+ <div className="flex items-center gap-2">+ <Input+ id="remove-grow"+ type="number"+ inputMode="numeric"+ min={REMOVE.maskGrow.min}+ max={REMOVE.maskGrow.max}+ value={maskGrow}+ onChange={(e) => setMaskGrow(Math.max(REMOVE.maskGrow.min, Math.min(REMOVE.maskGrow.max, Math.round(Number(e.target.value) || 0))))}+ className="h-9 w-24"+ />+ <span className="text-[12px] leading-snug text-muted-foreground">Grow it if a hand, hair or shadow shows outside the green; more makes H3 invent more background.</span>+ </div>+ </Field>+ )}<div className="space-y-3 border-t pt-3">{body && est?.previewUsd != null && (diff --cc src/components/swap-studio/hooks.tsindex 10962367,5626910e..b30bee2a--- a/src/components/swap-studio/hooks.ts+++ b/src/components/swap-studio/hooks.ts@@@ -3,9 -3,9 +3,10 @@@import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { studioHandOff, type HandOffInput, type QueueMode, type StudioEstimate, type SwapProject, type SwapProjectCard, type SwapProjectView } from "@/lib/catalog/swap-studio";import type { SwapEdit } from "@/lib/catalog/swap-studio-edit";+ import type { SharpenTier } from "@/lib/catalog/sharpen";import type { Engine, PixelPoint } from "@/lib/catalog/types";import { responseError } from "@/lib/refusals";+import type { SoundChoice } from "@/lib/av/original-sound";/** React Query hooks for /api/swap-studio/** (Character Swap Studio). */@@@ -125,8 -125,9 +126,9 @@@ export const useMakeAnchor = (id: strinexport const useQueue = (id: string) => useAction<{ clipId: string; shotId: string; segmentId: string; mode: QueueMode }, QueueAnswer>(id, "queue");export const useStopTake = (id: string) => useAction<{ clipId: string; shotId: string; segmentId: string; takeId: string }>(id, "takes/stop");export const useStopJob = (id: string) =>- useAction<{ kind: "mask" | "anchor" | "assembly" | "normalize" | "transcribe"; clipId: string; shotId?: string; segmentId?: string; jobId?: string }>(id, "stop");+ useAction<{ kind: "mask" | "anchor" | "assembly" | "normalize" | "transcribe" | "finish"; clipId: string; shotId?: string; segmentId?: string; jobId?: string }>(id, "stop");-export const useAssemble = (id: string) => useAction<{ clipId: string }>(id, "assemble");+export const useAssemble = (id: string) => useAction<{ clipId: string; sound?: SoundChoice }>(id, "assemble");+ export const useSharpen = (id: string) => useAction<{ clipId: string; tier: SharpenTier }>(id, "sharpen");/*** Genjutsu's "Open in Character Swap Studio": a new project with the character, and the clip added (the clip'sdiff --cc src/components/swap-studio/stage-review.tsxindex f7cd77d2,c9344185..a3cd0ec3--- a/src/components/swap-studio/stage-review.tsx+++ b/src/components/swap-studio/stage-review.tsx@@@ -14,9 -30,7 +30,10 @@@ import { STUDIO_MODELS } from "@/lib/caimport { downloadHref } from "@/lib/library";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";- import { decisionsHref, useAssemble, useStopJob } from "./hooks";+++import { OriginalSoundField, soundBody } from "@/components/studio/original-sound-field";+import { defaultSound, sameSound, type SoundChoice } from "@/lib/av/original-sound";+ import { decisionsHref, useAssemble, useSharpen, useStopJob } from "./hooks";import { GenChip, JobError, Note, priceText, SavedText } from "./parts";import type { StageProps } from "./workbench";diff --cc src/lib/catalog/faceless.tsindex e73eaebd,d624a03c..493cd0ca--- a/src/lib/catalog/faceless.ts+++ b/src/lib/catalog/faceless.ts@@@ -891,9 -876,7 +900,15 @@@ export function resolveModels(settingsvideo,resolution: wanted,narration,- // A clip's soundtrack as the bed: DBS on your GPU (no hosted DBS; the cloud makes its own bed).- music: settings.music ? (settings.engine === "open" && settings.musicClip ? SPLIT_MODEL : m.music) : null,- music: settings.music ? (settings.musicModel && m.musicChoices.includes(settings.musicModel) ? settings.musicModel : m.music) : null,++ // A clip's soundtrack as the bed: DBS on your GPU (no hosted DBS; the cloud makes its own bed). Otherwise the chosen music model.++ music: settings.music++ ? settings.engine === "open" && settings.musicClip++ ? SPLIT_MODEL++ : settings.musicModel && m.musicChoices.includes(settings.musicModel)++ ? settings.musicModel++ : m.music++ : null,+ ...(settings.music && settings.engine === "open" && settings.musicClip && { bedClip: settings.musicClip }),loop: settings.music ? m.loop : null,level: settings.music ? (m.levelMusic ?? null) : null,mux: settings.music ? m.mixMusic : m.mux,diff --cc src/lib/catalog/genjutsu.tsindex f1de44e2,9ed479ba..e2c44835--- a/src/lib/catalog/genjutsu.ts+++ b/src/lib/catalog/genjutsu.ts@@@ -59,8 -63,8 +63,9 @@@ import { firstFramePrompt, getShortsPreimport { getModel } from "./index";import { REPLACED_BY } from "./replaced";import { soulLook } from "./soul";+ import { filmSize, SHARPEN_COPY, sharpenPrompt, sharpenSteps, sharpenTierFor, type SharpenTier } from "./sharpen";import type { ChainSlot, Engine, GenerationRequest, PixelPoint } from "./types";+import { originalSoundProblem, separates, type SoundChoice } from "../av/original-sound";export type GenjutsuMode = "motion" | "character" | "swap" | "restyle" | "insert";/** How you say what changes (Object swap and Insert) or who (Character swap): words, clicks on the first frame, or paint on it. */@@@ -1282,14 -1368,9 +1374,23 @@@ function planCharacterSwap(input: Genju},...(anchorOn ? { after: ["anchor"], chain: [anchorSlot()] } : {}),});- // The graph keeps the clip's sound; Original sound other than Everything lays the chosen stems over it instead.- if (input.source.hasAudio && separates("open", input.sound)) {- const swap = steps.find((s) => s.key === "swap")!;- swap.request = { ...swap.request, ...helper };- const final = joinWithSound(steps, { engine: "open", title: input.title, base, helper, source: input.source, range: input.range, pieces: ["swap"], sound: true, choice: input.sound });- if (!sharpen) return { steps, final: "swap", pieces: 1, sound: false, tracked: false, anchors: anchorOn ? 1 : 0 };- const done = sharpen(steps, promptWith(anchorOn));- return { steps, final: done.final, pieces: 1, sound: done.sound, tracked: false, anchors: anchorOn ? 1 : 0 };++ // Original sound other than Everything lays the chosen stems over the picture instead of the clip's own sound.++ const split = !!input.source.hasAudio && separates("open", input.sound);++ let picture = "swap";++ if (sharpen) {++ // The finish puts the part's whole sound back itself; with a split choice it is left silent and the stems go on below.++ const finishOf = split ? openFinish({ ...input, source: { ...input.source, hasAudio: false } }, finish!, quality) : sharpen;++ const done = finishOf(steps, promptWith(anchorOn));++ if (!split) return { steps, final: done.final, pieces: 1, sound: done.sound, tracked: false, anchors: anchorOn ? 1 : 0 };++ picture = done.final;++ }++ if (split) {++ const last = steps.find((s) => s.key === picture)!;++ last.request = { ...last.request, ...helper };++ const final = joinWithSound(steps, { engine: "open", title: input.title, base, helper, source: input.source, range: input.range, pieces: [picture], sound: true, choice: input.sound });+ return { steps, final, pieces: 1, sound: true, tracked: false, anchors: anchorOn ? 1 : 0 };+ }+ return { steps, final: "swap", pieces: 1, sound: false, tracked: false, anchors: anchorOn ? 1 : 0 };}// Cloud: fal's H3 takes 5–15 s of reference video and whole seconds of output, and needs a swap LoRA.diff --cc src/lib/catalog/remove-object.tsindex 5e9121b3,2ea8274f..3703b49e--- a/src/lib/catalog/remove-object.ts+++ b/src/lib/catalog/remove-object.ts@@@ -569,8 -570,8 +571,10 @@@ export interface RemovalPlanInput/** Paint it: the mask of the range's first frame (white = remove). */mask?: string;seed?: number;+ /** Original sound: what of the clip's sound goes back (src/lib/av/original-sound.ts; unset = Everything). */+ sound?: SoundChoice;+ /** H3 Person Removal: how far the person's mask is grown, in pixels (default REMOVE.maskGrow.default). */+ maskGrow?: number;}export interface RemovalPlan {diff --cc src/lib/catalog/swap-studio.tsindex 7eafd705,6583c01d..23153bad--- a/src/lib/catalog/swap-studio.ts+++ b/src/lib/catalog/swap-studio.ts@@@ -15,9 -15,9 +15,10 @@@*/import { CHARACTER_SWAP, h3Canvas, HISTORY_CHOICES, WINDOW_CHOICES, whoWords, type SwapLora, type SwapWho } from "./character-swap";import { STUDIO_FPS } from "@/lib/av/scene-cuts";+ import { filmSize, type SharpenTier } from "./sharpen";import { wholeClipBudget } from "@/lib/av/video-finish";import type { Engine, PixelPoint } from "./types";+import type { SoundChoice } from "../av/original-sound";export const SWAP_STUDIO = {feature: "swap-studio",diff --cc src/server/remove-object.tsindex 71b135ed,52c406ae..1a9f5497--- a/src/server/remove-object.ts+++ b/src/server/remove-object.ts@@@ -62,8 -68,8 +70,10 @@@ export interface RemovalBodysource: { url: string; name?: string; duration?: number; fps?: number; width?: number; height?: number; hasAudio?: boolean };range?: RemoveRange;seed?: number;+ /** Original sound (unset = Everything). */+ sound?: SoundChoice;+ /** H3 Person Removal: how far the person's mask is grown, in pixels. */+ maskGrow?: number;}const fileUrl = z.string().startsWith("/api/files/").max(500);@@@ -92,7 -98,7 +102,8 @@@ export const RemovalBodySchema = z.obje}),range: z.object({ start: seconds, end: seconds }).optional(),seed: z.number().int().min(0).max(2 ** 48).optional(),+ sound: SoundChoiceSchema.optional(),+ maskGrow: z.number().int().min(REMOVE.maskGrow.min).max(REMOVE.maskGrow.max).optional(),/** A client nonce for one submit: a repeat gets the first answer (see once()). */requestId: z.string().trim().min(8).max(64).optional(),});@@@ -246,7 -256,7 +265,8 @@@ function planInputNow(body: RemovalBodypoints,mask: body.mode === "paint" && eraser.engine === "open" ? body.mask : undefined,...(body.seed !== undefined ? { seed: body.seed } : {}),+ ...(split && body.sound && { sound: body.sound }),+ ...(eraser.cleanFrame && body.maskGrow !== undefined ? { maskGrow: body.maskGrow } : {}),},};}diff --cc src/server/swap-studio.tsindex 059be78e,6ea0a918..09fadcb4--- a/src/server/swap-studio.ts+++ b/src/server/swap-studio.ts@@@ -1,8 -1,7 +1,8 @@@import "server-only";+import { originalSoundProblem, sameSound, soundOf, type SoundChoice } from "@/lib/av/original-sound";import { z } from "zod";import { getModel } from "@/lib/catalog";- import { ANCHOR_MODELS, anchorModel, characterLicenceLine, SWAP_LORAS, swapLoraRef, TURBO_LORA } from "@/lib/catalog/character-swap";+ import { ANCHOR_MODELS, anchorModel, CHARACTER_SWAP, characterLicenceLine, h3Canvas, SWAP_LORAS, swapLoraRef, TURBO_LORA } from "@/lib/catalog/character-swap";import { scalePoints } from "@/lib/catalog/remove-object";import type { PlanStep } from "@/lib/catalog/shorts";import {@@@ -1004,10 -1019,15 +1024,15 @@@ export function assemble(projectId: strexisting[`take-${piece.take.id}`] = g!.id;return url;};- const plan = planAssembly({ engine: p.engine, clip, pieces: found.pieces, videoOf });+ const plan = planAssembly({ engine: p.engine, clip, pieces: found.pieces, videoOf, ...(choice && { sound: choice }) });+ // A silent clip's cloud assembly ends on its silence: the WAV is written now (silenceRef, as Genjutsu and Canvas do).+ const withSilence = silenceWriter();// The takes count as steps already made: a demo join of real takes is refused.- const pipe = run(plan.steps, existing);+ const pipe = run(+ plan.steps.map((s) => ({ ...s, request: withSilence(s.request) })),+ existing,+ );- const assembly = { genId: pipe.byKey[plan.final].id, stepIds: pipe.items.map((g) => g.id), takes, createdAt: Date.now() };+ const assembly = { genId: pipe.byKey[plan.final].id, stepIds: pipe.items.map((g) => g.id), takes, createdAt: Date.now(), ...(choice && { sound: choice }) };return mutate(projectId, (cur) => mapClip(cur, clipId, (c) => ({ ...c, assembly })));}