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.

Remove dialogue and Split soundtrack: visitors learn up front they run on a self-hosted Fuobe

Claude6fa4b77fba75
diff --git a/docs/public-signup.md b/docs/public-signup.md
index d19a4ec2..7f482a46 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -191,8 +191,10 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188
(Canvas, Cinema, Shorts, Assist, Marketing…) answer 403 with `code: "own-gpu-tool"`, because they
plan with the studio's own AI helpers or keep projects of their own. Image to 3D and text to 3D
answer the same for now: a 3D model is finished on the server. So do the Audio hub's Split
- soundtrack (`POST /api/audio-tools`) and the turnaround video (`POST /api/turnaround`), though
- their price checks work, priced for the account's own GPU.
+ soundtrack and Video tools → Remove dialogue (both `POST /api/audio-tools`) and the turnaround
+ video (`POST /api/turnaround`), though their price checks work, priced for the account's own
+ GPU. Split soundtrack's and Remove dialogue's pages say so up front ("runs on a self-hosted
+ Fuobe for now", "Self-hosted only"), with their upload and run off.
- **Files a run takes.** A run on your GPU takes only files you uploaded here, or your own results.
A link or a `data:` URI answers 400 with `code: "input-not-allowed"`, someone else's file 403
(`input-not-yours`), and a file that has expired 404 (`input-gone`, "That file has expired.
diff --git a/src/components/audio-tools/remove-dialogue-tool.tsx b/src/components/audio-tools/remove-dialogue-tool.tsx
index c3b4a8fd..7ee66471 100644
--- a/src/components/audio-tools/remove-dialogue-tool.tsx
+++ b/src/components/audio-tools/remove-dialogue-tool.tsx
@@ -37,23 +37,29 @@ import {
import { Segmented } from "@/components/faceless/controls";
import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";
import { useGeneration } from "@/components/av/use-generation";
-import { useAskBeforeUpload, useEngine, useGenerations } from "@/lib/api";
-import type { AudioToolPreview } from "@/lib/av/audio-tools";
+import { SelfHostNote } from "@/components/self-host-note";
+import {
+ useAskBeforeUpload,
+ useEngine,
+ useGenerations,
+ useLikelyVisitor,
+} from "@/lib/api";
import {
CLOUD_ONLY_REMOVE_PROBLEM,
CLOUD_REMOVE_PROBLEM,
- KEPT_STEM,
LOWER_DEFAULT_DB,
LOWER_MAX_DB,
LOWER_MIN_DB,
OUTCOMES,
REMOVE_DIALOGUE_FEATURE,
REMOVED_STEM,
+ requestedOutcome,
type DialogueOutcome,
} from "@/lib/av/remove-dialogue";
import {
clock,
durationWords,
+ openToolPrice,
QUALITY_LABELS,
stemLabel,
type SplitQuality,
@@ -98,6 +104,12 @@ const RUN_LABEL: Record<DialogueOutcome, string> = {
const COPY =
"Takes the talking out and keeps the music and sound effects. The picture is not re-encoded.";
+/**
+ * Why a guest or an account can't run it: POST /api/audio-tools answers them own-gpu-tool (docs/public-signup.md), so
+ * the page says so up front and its upload and run are off, instead of a run the server refuses.
+ */
+const SELF_HOSTED = "Remove dialogue runs on a self-hosted Fuobe for now";
+
/** ?video= from a result's "Remove dialogue", read once after hydration. */
function useHandoff(take: (s: Source) => void) {
useEffect(() => {
@@ -117,9 +129,12 @@ function useHandoff(take: (s: Source) => void) {
function AddVideo({
onPick,
onUpdate,
+ disabled,
}: {
onPick: (s: Source) => void;
onUpdate: (next: (cur: Source | null) => Source | null) => void;
+ /** A visitor (the tool doesn't run here for them): nothing is uploaded or picked only to be refused. */
+ disabled?: boolean;
}) {
const input = useRef<HTMLInputElement>(null);
const [over, setOver] = useState(false);
@@ -127,7 +142,7 @@ function AddVideo({
// A guest, or an account with neither its own GPU nor its own key, gets its card instead of the file chooser.
const askFirst = useAskBeforeUpload();
const take = (f: File | undefined) => {
- if (!f || askFirst()) return;
+ if (!f || disabled || askFirst()) return;
if (kindOfFile(f) !== "video")
return void toast("Video only — drop a clip here (MP4, MOV or WebM)");
// Shown at once with its local preview, then given its address, or taken away when the upload is refused or fails
@@ -151,13 +166,14 @@ function AddVideo({
};
return (
<div
+ aria-disabled={disabled || undefined}
className={cn(
"flex flex-col items-center justify-center gap-3 rounded-2xl border-2 border-dashed border-border-strong bg-background px-4 py-10 text-center transition-colors sm:py-14",
over && "border-primary bg-brand-faint",
)}
onDragOver={(e) => {
e.preventDefault();
- setOver(true);
+ if (!disabled) setOver(true);
}}
onDragLeave={() => setOver(false)}
onDrop={(e) => {
@@ -181,13 +197,19 @@ function AddVideo({
<Button
size="sm"
className="rounded-full"
+ disabled={disabled}
onClick={() => askFirst() || input.current?.click()}
>
<Upload className="size-3.5" /> Upload a video
</Button>
- <Popover open={picking} onOpenChange={setPicking}>
+ <Popover open={picking && !disabled} onOpenChange={setPicking}>
<PopoverTrigger asChild>
- <Button variant="ghost" size="sm" className="rounded-full">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="rounded-full"
+ disabled={disabled}
+ >
<Library className="size-3.5" /> From library
</Button>
</PopoverTrigger>
@@ -220,6 +242,7 @@ function AddVideo({
type="file"
accept={ACCEPT.video}
hidden
+ disabled={disabled}
aria-label="Upload a video"
onChange={(e) => {
take(e.target.files?.[0]);
@@ -230,8 +253,6 @@ function AddVideo({
);
}
-const money = (p: AudioToolPreview) =>
- p.demo ? "Placeholder · free" : "Free · runs on your ComfyUI";
const onDevice = (device?: string) =>
device === "cuda" ? "on your GPU" : device ? "on your CPU" : "on a CPU";
@@ -354,17 +375,10 @@ function ResultPanel({
);
}
-/** What a run of the tool was asked for, from its result's request (the mux step: its chain says which stems). */
-function outcomeOf(g: Generation): DialogueOutcome {
- const chain = g.request.chain ?? [];
- if (chain.some((c) => c.slot === "audio2")) return "lower-music";
- return chain[0]?.stem === KEPT_STEM["dialogue-only"]
- ? "dialogue-only"
- : "no-dialogue";
-}
-
export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
const [engine, setEngine, mode] = useEngine();
+ // A guest or an account: the run answers own-gpu-tool, so the page says so and the upload and run are off.
+ const visitor = useLikelyVisitor();
const run = useAudioToolRun();
const [source, setSource] = useState<Source | null>(null);
const [outcome, setOutcome] = useState<DialogueOutcome>("no-dialogue");
@@ -409,19 +423,22 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
const picked: SplitQuality = quality ?? p?.hostPick ?? "fast";
const cloudProblem =
mode === "cloud" ? CLOUD_ONLY_REMOVE_PROBLEM : CLOUD_REMOVE_PROBLEM;
- const blocker = !source
- ? "Add a video"
- : source.uploading
- ? "Uploading…"
- : engine === "cloud"
- ? cloudProblem
- : null;
+ const blocker = visitor
+ ? SELF_HOSTED
+ : !source
+ ? "Add a video"
+ : source.uploading
+ ? "Uploading…"
+ : engine === "cloud"
+ ? cloudProblem
+ : null;
const error = preview.error ? (preview.error as Error).message : null;
const g = result.data;
const busy =
run.isPending || g?.status === "queued" || g?.status === "running";
const go = () => {
if (blocker) return void toast(blocker);
+ if (!body) return;
if (error) return void toast.error(error);
run.mutate(body!, {
onSuccess: (r) => {
@@ -450,12 +467,20 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
: null;
return (
- <ToolShell title="Video tools" tabs={tabs}>
+ <ToolShell title="Video tools" tabs={tabs} selfHostedOnly>
{!source && (
<ToolHero
title="Remove dialogue"
- subtitle={`${COPY} Runs on your ComfyUI with DBS (open source, 23 MB, CPU or GPU): free.`}
- />
+ subtitle={
+ visitor
+ ? `${COPY} Runs with DBS (open source, 23 MB, CPU or GPU).`
+ : `${COPY} Runs on your ComfyUI with DBS (open source, 23 MB, CPU or GPU): free.`
+ }
+ >
+ {visitor && (
+ <SelfHostNote className="mt-3 max-w-xl">{SELF_HOSTED}.</SelfHostNote>
+ )}
+ </ToolHero>
)}
<div
className={cn(
@@ -464,7 +489,7 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
)}
>
{!source ? (
- <AddVideo onPick={take} onUpdate={setSource} />
+ <AddVideo onPick={take} onUpdate={setSource} disabled={visitor} />
) : (
<Panel
title={
@@ -626,7 +651,14 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
)}
aria-live="polite"
>
- {blocker && engine !== "cloud" ? (
+ {visitor && engine !== "cloud" ? (
+ <>
+ <span className="font-mono text-foreground">
+ {openToolPrice(p, true)}
+ </span>
+ {` · ${SELF_HOSTED}`}
+ </>
+ ) : blocker && engine !== "cloud" ? (
blocker
) : engine === "cloud" ? (
mode === "cloud" ? (
@@ -639,7 +671,7 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
) : p ? (
<>
<span className="font-mono text-foreground">
- {money(p)}
+ {openToolPrice(p)}
</span>
{p.estimate && !p.demo
? ` · ${durationWords(p.estimate)} ${onDevice(p.device)}`
@@ -657,7 +689,7 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
"bg-muted text-subtle-foreground hover:bg-muted",
)}
onClick={go}
- disabled={busy}
+ disabled={busy || visitor}
>
{busy ? (
<Loader2 className="size-4 animate-spin" />
@@ -702,10 +734,14 @@ export function RemoveDialogueTool({ tabs }: { tabs?: React.ReactNode }) {
if (!video) return;
const name = r.request.title?.replace(/^.* · /, "") || "Video";
setSource({ ref: video, preview: video, id: r.id, name });
+ // The controls show what that run was asked for, so the button runs it again, not what was on screen.
+ const was = requestedOutcome(r.request);
+ setOutcome(was.outcome);
+ if (was.outcome === "lower-music") setMusicDb(was.musicDb);
setRan({
result: r.id,
split: splitStep?.id,
- outcome: outcomeOf(r),
+ outcome: was.outcome,
before: video,
name,
});
diff --git a/src/components/audio-tools/split-tool.tsx b/src/components/audio-tools/split-tool.tsx
index 4f497e7a..7e237ba6 100644
--- a/src/components/audio-tools/split-tool.tsx
+++ b/src/components/audio-tools/split-tool.tsx
@@ -14,8 +14,8 @@ import { ACCEPT, fileToSlot, kindOfFile, LibraryGrid, type SlotValue } from "@/c
import { Segmented } from "@/components/faceless/controls";
import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";
import { useGeneration } from "@/components/av/use-generation";
-import { useAskBeforeUpload, useEngine, useGenerations } from "@/lib/api";
-import type { AudioToolPreview } from "@/lib/av/audio-tools";
+import { SelfHostNote } from "@/components/self-host-note";
+import { useAskBeforeUpload, useEngine, useGenerations, useLikelyVisitor } from "@/lib/api";
import {
backgroundLowered,
clock,
@@ -23,6 +23,7 @@ import {
CLOUD_SPLIT_PROBLEM,
dbLabel,
durationWords,
+ openToolPrice,
exportProblem,
headroomGain,
LEVEL_MAX,
@@ -136,27 +137,29 @@ export function uploadSource(f: File, kind: "audio" | "video", put: (s: Source)
);
}
-function AddMedia({ onPick, onUpdate }: { onPick: (s: Source) => void; onUpdate: (next: (cur: Source | null) => Source | null) => void }) {
+/** disabled: a visitor (the split doesn't run here for them), so nothing is uploaded or picked only to be refused. */
+function AddMedia({ onPick, onUpdate, disabled }: { onPick: (s: Source) => void; onUpdate: (next: (cur: Source | null) => Source | null) => void; disabled?: boolean }) {
const input = useRef<HTMLInputElement>(null);
const [over, setOver] = useState(false);
const [picking, setPicking] = useState(false);
// A guest, or an account with neither its own GPU nor its own key, gets its card instead of the file chooser.
const askFirst = useAskBeforeUpload();
const take = (f: File | undefined) => {
- if (!f || askFirst()) return;
+ if (!f || disabled || askFirst()) return;
const kind = kindOfFile(f);
if (kind !== "audio" && kind !== "video") return void toast("Audio or video only — drop a sound file or a clip here");
void uploadSource(f, kind, onPick, onUpdate);
};
return (
<div
+ aria-disabled={disabled || undefined}
className={cn(
"flex flex-col items-center justify-center gap-3 rounded-2xl border-2 border-dashed border-border-strong bg-background px-4 py-10 text-center transition-colors sm:py-14",
over && "border-primary bg-brand-faint",
)}
onDragOver={(e) => {
e.preventDefault();
- setOver(true);
+ if (!disabled) setOver(true);
}}
onDragLeave={() => setOver(false)}
onDrop={(e) => {
@@ -171,12 +174,12 @@ function AddMedia({ onPick, onUpdate }: { onPick: (s: Source) => void; onUpdate:
<p className="mt-1 text-[13px] text-muted-foreground">A song, podcast, film clip or video, up to 200 MB</p>
</div>
<div className="flex flex-wrap items-center justify-center gap-1.5">
- <Button size="sm" className="rounded-full" onClick={() => askFirst() || input.current?.click()}>
+ <Button size="sm" className="rounded-full" disabled={disabled} onClick={() => askFirst() || input.current?.click()}>
<Upload className="size-3.5" /> Upload audio or video
</Button>
- <Popover open={picking} onOpenChange={setPicking}>
+ <Popover open={picking && !disabled} onOpenChange={setPicking}>
<PopoverTrigger asChild>
- <Button variant="ghost" size="sm" className="rounded-full">
+ <Button variant="ghost" size="sm" className="rounded-full" disabled={disabled}>
<Library className="size-3.5" /> From library
</Button>
</PopoverTrigger>
@@ -199,6 +202,7 @@ function AddMedia({ onPick, onUpdate }: { onPick: (s: Source) => void; onUpdate:
type="file"
accept={`${ACCEPT.audio},${ACCEPT.video}`}
hidden
+ disabled={disabled}
onChange={(e) => {
take(e.target.files?.[0]);
e.target.value = "";
@@ -650,7 +654,11 @@ function Mixer({ stems, source, engine }: { stems: Stem[]; source: Source; engin
// ---------------------------------------------------------------------------
// The tool
-const money = (p: AudioToolPreview) => (p.demo ? "Placeholder · free" : "Free · runs on your ComfyUI");
+/**
+ * Why a guest or an account can't split: POST /api/audio-tools answers them own-gpu-tool (docs/public-signup.md), so the
+ * page says so up front and its upload and run are off, instead of a run the server refuses.
+ */
+const SELF_HOSTED = "Split soundtrack runs on a self-hosted Fuobe for now";
/** Where the time estimate is for: the host's device when it said; else a CPU's, the figures the estimate then uses. */
const onDevice = (device?: string) => (device === "cuda" ? "on your GPU" : device ? "on your CPU" : "on a CPU");
@@ -669,6 +677,7 @@ function stemsOf(outputs: OutputFile[]): Stem[] {
export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {
const [engine, setEngine, mode] = useEngine();
+ const visitor = useLikelyVisitor();
const run = useAudioToolRun();
const [source, setSource] = useState<Source | null>(null);
const [quality, setQuality] = useState<SplitQuality | null>(null);
@@ -716,12 +725,13 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {
const channels = p?.channels ?? source?.channels;
const picked: SplitQuality = quality ?? p?.hostPick ?? "fast";
const cloudProblem = mode === "cloud" ? CLOUD_ONLY_PROBLEM : CLOUD_SPLIT_PROBLEM;
- const blocker = !source ? "Add a soundtrack to split" : source.uploading ? "Uploading…" : engine === "cloud" ? cloudProblem : null;
+ const blocker = visitor ? SELF_HOSTED : !source ? "Add a soundtrack to split" : source.uploading ? "Uploading…" : engine === "cloud" ? cloudProblem : null;
const error = preview.error ? (preview.error as Error).message : null;
const go = () => {
if (blocker) return void toast(blocker);
if (error) return void toast.error(error);
- run.mutate(body!, {
+ if (!body) return;
+ run.mutate(body, {
onSuccess: (r) => {
setResultId(r.result.id);
toast.success("Splitting on your ComfyUI");
@@ -733,16 +743,22 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {
const stems = useMemo(() => (g?.status === "succeeded" ? stemsOf(g.outputs) : []), [g]);
return (
- <ToolShell title="Audio" tabs={tabs}>
+ <ToolShell title="Audio" tabs={tabs} selfHostedOnly>
{!source && (
<ToolHero
title="Split any soundtrack"
- subtitle="Dialogue, music and effects from a song, podcast, film clip or video, with a free live mixer. Runs on your ComfyUI with DBS (open source, 23 MB, CPU or GPU): free."
- />
+ subtitle={
+ visitor
+ ? "Dialogue, music and effects from a song, podcast, film clip or video, with a free live mixer. Runs with DBS (open source, 23 MB, CPU or GPU)."
+ : "Dialogue, music and effects from a song, podcast, film clip or video, with a free live mixer. Runs on your ComfyUI with DBS (open source, 23 MB, CPU or GPU): free."
+ }
+ >
+ {visitor && <SelfHostNote className="mt-3 max-w-xl">{SELF_HOSTED}.</SelfHostNote>}
+ </ToolHero>
)}
<div className={cn("mx-auto max-w-[860px] space-y-3", source ? "pt-4" : "mt-8")}>
{!source ? (
- <AddMedia onPick={take} onUpdate={setSource} />
+ <AddMedia onPick={take} onUpdate={setSource} disabled={visitor} />
) : (
<SourcePanel
source={source}
@@ -811,7 +827,12 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {
)}
<div className="flex flex-wrap items-center gap-3">
<p className={cn("min-w-0 flex-1 text-[13px]", error && !blocker ? "text-destructive" : "text-muted-foreground")} aria-live="polite">
- {blocker && engine !== "cloud" ? (
+ {visitor && engine !== "cloud" ? (
+ <>
+ <span className="font-mono text-foreground">{openToolPrice(p, true)}</span>
+ {` · ${SELF_HOSTED}`}
+ </>
+ ) : blocker && engine !== "cloud" ? (
blocker
) : engine === "cloud" ? (
mode === "cloud" ? (
@@ -823,14 +844,14 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {
error
) : p ? (
<>
- <span className="font-mono text-foreground">{money(p)}</span>
+ <span className="font-mono text-foreground">{openToolPrice(p)}</span>
{p.estimate && !p.demo ? ` · ${durationWords(p.estimate)} ${onDevice(p.device)}` : ""}
</>
) : (
"Checking…"
)}
</p>
- <Button size="lg" className={cn("rounded-full", (blocker || error) && "bg-muted text-subtle-foreground hover:bg-muted")} onClick={go} disabled={run.isPending || g?.status === "queued" || g?.status === "running"}>
+ <Button size="lg" className={cn("rounded-full", (blocker || error) && "bg-muted text-subtle-foreground hover:bg-muted")} onClick={go} disabled={visitor || run.isPending || g?.status === "queued" || g?.status === "running"}>
{run.isPending || g?.status === "queued" || g?.status === "running" ? <Loader2 className="size-4 animate-spin" /> : <SlidersVertical className="size-4" />} Split it
</Button>
</div>
diff --git a/src/lib/av/remove-dialogue.ts b/src/lib/av/remove-dialogue.ts
index 4939abec..093d87bd 100644
--- a/src/lib/av/remove-dialogue.ts
+++ b/src/lib/av/remove-dialogue.ts
@@ -137,6 +137,19 @@ const MUX_LABEL: Record<DialogueOutcome, string> = {
"lower-music": "Dialogue over the lowered music · picture copied",
};
+/**
+ * What an earlier run was asked for, read back from its mux step's request (its chain says which stems, its extra the
+ * level): Compare puts these back in the controls, so the button runs that again, not what was on screen before.
+ */
+export function requestedOutcome(r: Pick<GenerationRequest, "chain" | "params">): { outcome: DialogueOutcome; musicDb: number } {
+ const chain = r.chain ?? [];
+ if (chain.some((c) => c.slot === "audio2")) {
+ const db = r.params?.extra?.backgroundVolumeDb;
+ return { outcome: "lower-music", musicDb: clampLowerDb(typeof db === "number" ? db : undefined) };
+ }
+ return { outcome: chain[0]?.stem === KEPT_STEM["dialogue-only"] ? "dialogue-only" : "no-dialogue", musicDb: LOWER_DEFAULT_DB };
+}
+
/** Two steps on the open engine (split, then the stream-copy mux); throws what's in the way (in words the page shows). */
export function planRemoveDialogue(i: RemoveDialogueInput): RemoveDialoguePlan {
const problem = removeDialogueProblem(i);
diff --git a/src/lib/av/split.ts b/src/lib/av/split.ts
index 465d83cd..eaf3e5ba 100644
--- a/src/lib/av/split.ts
+++ b/src/lib/av/split.ts
@@ -157,6 +157,17 @@ export function splitTime(o: { seconds: number; quality: SplitQuality; mode: Dbs
};
}
+/**
+ * The price line of an open-engine audio tool (Split soundtrack, Remove dialogue). A guest or an account reads
+ * "Self-hosted only": POST /api/audio-tools answers them own-gpu-tool, so "Free · runs on your ComfyUI" would promise a
+ * run that is refused (docs/public-signup.md).
+ */
+export function openToolPrice(p: { demo: boolean } | undefined, visitor?: boolean): string {
+ if (visitor) return "Self-hosted only";
+ if (!p) return "…";
+ return p.demo ? "Placeholder · free" : "Free · runs on your ComfyUI";
+}
+
/** "about 1–2 min", "under a minute" */
export function durationWords(r: { low: number; high: number }): string {
if (r.high < 60) return "under a minute";
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index d118ff47..848a2cdd 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -11,6 +11,7 @@ import { downloadHref, downloadName, extensionOf } from "./library";
import { PRESETS as GRADE_PRESETS } from "./grade";
import { storedPath } from "./share";
import { decodeMoss, LAYOUT_PARAM, readLayout, type LayoutDraft } from "./layout-prompt";
+import { REMOVE_DIALOGUE_FEATURE } from "./av/remove-dialogue";
export type OutputActionId =
| "animate"
@@ -177,8 +178,15 @@ const NEXT_STEPS: Partial<Record<OutputFile["kind"], OutputActionId[]>> = {
video: ["extend", "upscale", "add-sound"],
audio: ["lipsync", "voice-change", "split-soundtrack"],
};
-/** Clips made with their sound (or keeping the source's): Remove dialogue and Split soundtrack instead of Upscale and Add sound. */
+/** Clips made with their sound (or keeping the source's): Split soundtrack instead of Add sound. */
const SOUNDED_VIDEO_OPS = new Set<Generation["op"]>(["v2a", "mux", "lipsync", "trim", "captions"]);
+/**
+ * Sounded clips likely to carry speech also offer Remove dialogue (after Upscale, so it stays): not Sound for video
+ * (v2a: generated effects), and not a Remove dialogue result itself.
+ */
+function likelySpeech(g: Generation): boolean {
+ return g.op !== "v2a" && g.feature !== REMOVE_DIALOGUE_FEATURE;
+}
/**
* Up to `max` next steps for output `index` (Animate, Upscale, Edit for a picture), taken from
@@ -189,7 +197,10 @@ export function nextSteps(g: Generation, index: number, max = 3): OutputAction[]
if (!o || g.status !== "succeeded") return [];
const all = outputActions(g, index);
// A clip with a grade still to apply (a Fuobe DoP colour-grade effect) offers it first.
- const video: OutputActionId[] | undefined = o.kind === "video" && g.op && SOUNDED_VIDEO_OPS.has(g.op) ? ["extend", "remove-dialogue", "split-soundtrack"] : NEXT_STEPS.video;
+ const sounded = o.kind === "video" && !!g.op && SOUNDED_VIDEO_OPS.has(g.op);
+ const video: OutputActionId[] | undefined = sounded
+ ? ["extend", "upscale", ...(likelySpeech(g) ? (["remove-dialogue"] as const) : []), "split-soundtrack"]
+ : NEXT_STEPS.video;
const order: OutputActionId[] = o.kind === "video" ? [...(gradeOf(o) ? (["grade"] as const) : []), ...(video ?? [])] : (NEXT_STEPS[o.kind] ?? []);
return order
.map((id) => all.find((a) => a.id === id && a.href))
diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.ts
index c90e631b..a58a8fed 100644
--- a/tests/public-signup-tools.test.ts
+++ b/tests/public-signup-tools.test.ts
@@ -255,6 +255,40 @@ describe("Remove dialogue (DBS D2) on /api/audio-tools", () => {
});
});
+describe("Split soundtrack's and Remove dialogue's pages tell a visitor up front (their runs are own-gpu-tool)", () => {
+ const src = (f: string) => fs.readFileSync(path.join(__dirname, "..", f), "utf8");
+ it("read 'Self-hosted only', not 'Free · runs on your ComfyUI', to a guest or an account", async () => {
+ const { openToolPrice } = await import("@/lib/av/split");
+ expect(openToolPrice({ demo: false })).toBe("Free · runs on your ComfyUI");
+ expect(openToolPrice({ demo: true })).toBe("Placeholder · free");
+ expect(openToolPrice(undefined)).toBe("…");
+ for (const p of [{ demo: false }, { demo: true }, undefined]) expect(openToolPrice(p, true)).toBe("Self-hosted only");
+ });
+
+ it("say it runs on a self-hosted Fuobe, and turn off the upload, the library pick and the run (as Remove object does)", () => {
+ for (const [file, tool] of [
+ ["src/components/audio-tools/split-tool.tsx", "Split soundtrack"],
+ ["src/components/audio-tools/remove-dialogue-tool.tsx", "Remove dialogue"],
+ ] as const) {
+ const page = src(file).replace(/\s+/g, " ");
+ expect(page).toContain("const visitor = useLikelyVisitor();");
+ expect(page).toContain(`const SELF_HOSTED = "${tool} runs on a self-hosted Fuobe for now";`);
+ expect(page).toMatch(/blocker = visitor \? SELF_HOSTED/);
+ expect(page).toMatch(/\{visitor && (\( ?)?<SelfHostNote className="mt-3 max-w-xl">\{SELF_HOSTED\}\.<\/SelfHostNote> ?\)?\}/);
+ expect(page).toMatch(/<ToolShell title="[^"]+" tabs=\{tabs\} selfHostedOnly>/);
+ expect(page).toMatch(/onUpdate=\{setSource\} disabled=\{visitor\}/);
+ // The upload button, From library, the hidden file input and the drop all honour it.
+ expect(page.match(/disabled=\{disabled\}/g)?.length).toBe(3);
+ expect(page).toMatch(/if \(!f \|\| disabled \|\| askFirst\(\)\) return;/);
+ expect(page).toMatch(/open=\{picking && !disabled\}/);
+ expect(page).toMatch(/disabled=\{(busy \|\| visitor|visitor \|\| run\.isPending)/);
+ expect(page).toContain("openToolPrice(p, true)");
+ // The owner's words only for the owner: "on your ComfyUI … free" leaves the hero for a visitor.
+ expect(page).toMatch(/visitor \? "?`?[^:]*Runs with DBS \(open source, 23 MB, CPU or GPU\)\.`?"? :/);
+ }
+ });
+});
+
describe("the GPU pre-flight board lists PR #15's tools like main's studios", () => {
const idx = loadIndex();
const row = (href: string) => STUDIO_ROWS.find((r) => r.href === href)!;
diff --git a/tests/remove-dialogue.test.ts b/tests/remove-dialogue.test.ts
index 8eb589b7..1ba2d3dc 100644
--- a/tests/remove-dialogue.test.ts
+++ b/tests/remove-dialogue.test.ts
@@ -16,6 +16,7 @@ import {
REMOVE_DIALOGUE_MAX_SECONDS,
REMOVED_STEM,
removeDialogueProblem,
+ requestedOutcome,
removeDialogueTime,
} from "@/lib/av/remove-dialogue";
import { splitTime } from "@/lib/av/split";
@@ -228,6 +229,39 @@ describe("the plan per outcome (open engine)", () => {
).toBe(true);
});
+ it("reads an earlier run's outcome and level back from its mux step's request (Compare puts them in the controls)", () => {
+ for (const o of OUTCOMES) {
+ const mux = planRemoveDialogue({
+ engine: "open",
+ video: VIDEO,
+ outcome: o.id,
+ musicDb: -20,
+ }).steps[1];
+ expect(
+ requestedOutcome({ chain: mux.chain, params: mux.request.params }),
+ ).toEqual({
+ outcome: o.id,
+ musicDb: o.id === "lower-music" ? -20 : LOWER_DEFAULT_DB,
+ });
+ }
+ // A level missing or out of range reads as the slider would show it.
+ const lower = muxChain("lower-music");
+ expect(requestedOutcome({ chain: lower })).toEqual({
+ outcome: "lower-music",
+ musicDb: LOWER_DEFAULT_DB,
+ });
+ expect(
+ requestedOutcome({
+ chain: lower,
+ params: { extra: { backgroundVolumeDb: -45 } },
+ }).musicDb,
+ ).toBe(-30);
+ expect(requestedOutcome({})).toEqual({
+ outcome: "no-dialogue",
+ musicDb: LOWER_DEFAULT_DB,
+ });
+ });
+
it("passes the model asked for and the channel count; a surround file is split in mono", () => {
const best = planRemoveDialogue({
engine: "open",
@@ -466,13 +500,13 @@ describe("Remove dialogue in Video tools", () => {
});
it("is a hand-off from any video, and a next step under a clip that has its sound", () => {
- const gen = (op: Generation["op"]): Generation =>
+ const gen = (op: Generation["op"], feature = "video"): Generation =>
({
id: "g1",
status: "succeeded",
kind: "video",
op,
- feature: "video",
+ feature,
outputs: [{ kind: "video", url: "/api/files/clip.mp4" }],
request: { modelId: "x" },
createdAt: 1,
@@ -485,11 +519,31 @@ describe("Remove dialogue in Video tools", () => {
placement: "menu",
href: "/video-tools/remove-dialogue?video=%2Fapi%2Ffiles%2Fclip.mp4",
});
- expect(nextSteps(gen("lipsync"), 0).map((a) => a.id)).toEqual([
+ // A clip likely to carry speech keeps Upscale and adds Remove dialogue (Split soundtrack follows, in the menu).
+ for (const [op, feature] of [
+ ["lipsync", "lipsync"],
+ ["mux", "dub"],
+ ["trim", "video"],
+ ["captions", "video"],
+ ] as const)
+ expect(nextSteps(gen(op, feature), 0).map((a) => a.id)).toEqual([
+ "extend",
+ "upscale",
+ "remove-dialogue",
+ ]);
+ expect(nextSteps(gen("lipsync"), 0, 4).map((a) => a.id)).toEqual([
"extend",
+ "upscale",
"remove-dialogue",
"split-soundtrack",
]);
+ // Sound for video (generated effects) and a Remove dialogue result itself don't offer it.
+ for (const g of [gen("v2a"), gen("mux", REMOVE_DIALOGUE_FEATURE)])
+ expect(nextSteps(g, 0).map((a) => a.id)).toEqual([
+ "extend",
+ "upscale",
+ "split-soundtrack",
+ ]);
expect(nextSteps(gen("t2v"), 0).map((a) => a.id)).toEqual([
"extend",
"upscale",
@@ -570,6 +624,11 @@ describe("POST /api/audio-tools remove-dialogue (demo mode)", () => {
expect(run.result.request.params.extra).toEqual({
backgroundVolumeDb: -15,
});
+ // The stored request reads back as what was asked (Compare).
+ expect(requestedOutcome(run.result.request)).toEqual({
+ outcome: "lower-music",
+ musicDb: -15,
+ });
const g = await finished(run.result.id);
expect(g.status).toBe("succeeded");
expect(g.outputs[0].kind).toBe("video");
diff --git a/tests/ux-flows.test.ts b/tests/ux-flows.test.ts
index 61d017f0..c759fda0 100644
--- a/tests/ux-flows.test.ts
+++ b/tests/ux-flows.test.ts
@@ -61,14 +61,17 @@ describe("next steps under a fresh result", () => {
const vid = nextSteps(gen([{ kind: "video", url: "/api/files/clip.mp4" }], { kind: "video", op: "t2v" }), 0);
expect(vid.map((a) => a.label)).toEqual(["Extend", "Upscale", "Add sound"]);
expect(nextSteps(gen([{ kind: "audio", url: "/api/files/a.mp3" }], { kind: "audio", op: "tts" }), 0).map((a) => a.id)).toEqual(["lipsync", "voice-change", "split-soundtrack"]);
- // A clip that has its sound (Sound for video, a soundtrack mux) offers Remove dialogue and Split soundtrack in place
- // of Upscale and Add sound.
+ // A clip that has its sound (Sound for video, a soundtrack mux) offers Split soundtrack in place of Add sound; Sound
+ // for video's generated effects rarely carry speech, so it isn't offered Remove dialogue.
const sounded = nextSteps(gen([{ kind: "video", url: "/api/files/clip.mp4" }], { kind: "video", op: "v2a" }), 0);
expect(sounded.map((a) => [a.label, a.href])).toEqual([
["Extend", "/extend?video=%2Fapi%2Ffiles%2Fclip.mp4"],
- ["Remove dialogue", "/video-tools/remove-dialogue?video=%2Fapi%2Ffiles%2Fclip.mp4"],
+ ["Upscale", "/upscale/video?video=%2Fapi%2Ffiles%2Fclip.mp4"],
["Split soundtrack", "/audio/split?video=%2Fapi%2Ffiles%2Fclip.mp4"],
]);
+ // A lip-synced clip (speech) keeps Upscale and adds Remove dialogue.
+ const spoken = nextSteps(gen([{ kind: "video", url: "/api/files/clip.mp4" }], { kind: "video", op: "lipsync" }), 0);
+ expect(spoken.map((a) => a.label)).toEqual(["Extend", "Upscale", "Remove dialogue"]);
});
it("has none for what doesn't hand off (text, vectors) or isn't done", () => {