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.

Original sound: the note about the split shows only when the clip's sound is split

Claudee7c37064be87
diff --git a/src/server/mixed-media.ts b/src/server/mixed-media.ts
index 4d6fe6ed..6d5caa38 100644
--- a/src/server/mixed-media.ts
+++ b/src/server/mixed-media.ts
@@ -178,7 +178,8 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
if (reach) notes.push(...reach.notes);
const soundProblem = originalSoundProblem(body.engine, body.sound);
if (soundProblem) throw new ShortsError(soundProblem, 422);
- const split = separates(body.engine, body.sound) && info.hasAudio !== false;
+ // Sound we couldn't read counts as none (below), so no split is planned for it either; unread (an estimate), it's split once read.
+ const split = separates(body.engine, body.sound) && (opts.probe ? info.hasAudio === true : info.hasAudio !== false);
if (split) notes.push(`Original sound: ${soundLine(body.sound)} — your GPU splits the clip's sound first (free)`);
const name = (body.source.name ?? "").replace(/\.[a-z0-9]{2,4}$/i, "").trim().slice(0, 40);
return {
diff --git a/src/server/shorts.ts b/src/server/shorts.ts
index 599049e8..1306c41d 100644
--- a/src/server/shorts.ts
+++ b/src/server/shorts.ts
@@ -322,7 +322,8 @@ export interface ShortsEstimate {
notes: string[];
}
-function notesFor(input: ShortsPlanInput, segments: number): string[] {
+/** `read`: whether the clip's header was read (else its sound is unknown, and a split is planned once it's read). */
+function notesFor(input: ShortsPlanInput, segments: number, read: boolean): string[] {
const notes: string[] = [];
const refs = input.look.references?.length ?? 0;
const original = input.modelId === SHORTS_ORIGINAL;
@@ -336,7 +337,8 @@ function notesFor(input: ShortsPlanInput, segments: number): string[] {
if (vaceDownsample(fps)) notes.push(`Wan 2.2 Fun VACE works this ${Math.round(fps!)} fps clip at ${Math.round(fps! / (vaceDownsample(fps) + 1))} fps and brings it back to its own rate`);
} else notes.push("Fuobe Shorts on your GPU renders 480p at 16 fps, 5 s a segment");
}
- if (separates(input.engine, input.sound)) notes.push(`Original sound: ${soundLine(input.sound)} — your GPU splits the clip's sound first (free)`);
+ // planStitch splits only a clip that has sound to split.
+ if ((!read || input.source.hasAudio) && separates(input.engine, input.sound)) notes.push(`Original sound: ${soundLine(input.sound)} — your GPU splits the clip's sound first (free)`);
if (input.engine === "cloud") {
const { width: w, height: h } = input.source;
if (!input.reframes && w && h && needsFit(input.source, input.aspectRatio)) notes.push(`Your ${w}×${h} clip is centre-cropped to ${input.aspectRatio} before the restyle`);
@@ -346,11 +348,11 @@ function notesFor(input: ShortsPlanInput, segments: number): string[] {
/** What a session would cost and how it would run, without creating anything. */
export async function estimateShorts(body: ShortsBody): Promise<ShortsEstimate> {
- return estimateWith(body, {});
+ return estimateWith(body, {}, false);
}
/** estimateShorts for a clip whose header was read already (Assist prices with its sound and length). */
-export function estimateWith(body: ShortsBody, info: SourceInfo): ShortsEstimate {
+export function estimateWith(body: ShortsBody, info: SourceInfo, read = true): ShortsEstimate {
const { input } = planWith(body, info);
const plan = planShorts(input);
const all = priceSteps(plan.steps);
@@ -361,7 +363,7 @@ export function estimateWith(body: ShortsBody, info: SourceInfo): ShortsEstimate
segments: plan.segments.length,
seconds: Math.round((input.range.end - input.range.start) * 10) / 10,
refsSent: input.engine === "open" ? Math.min(SHORTS.openReferences, input.look.references?.length ?? 0) : Math.min(input.maxRefs, input.look.references?.length ?? 0),
- notes: notesFor(input, plan.segments.length),
+ notes: notesFor(input, plan.segments.length, read),
};
}
diff --git a/tests/shorts-api.test.ts b/tests/shorts-api.test.ts
index ced9e2aa..2b273e2a 100644
--- a/tests/shorts-api.test.ts
+++ b/tests/shorts-api.test.ts
@@ -273,6 +273,15 @@ describe("Shorts sessions", () => {
expect(shorts.getSession(s.id).settings.sound).toEqual({ sound: "dialogue-only" });
});
+ it("Original sound: a clip read as silent gets no split, and no note about one", () => {
+ const b = body({ engine: "open", source: { url: clip, duration: 12 }, sound: { sound: "no-dialogue" } }) as never;
+ const note = /your GPU splits the clip's sound first/;
+ expect(shorts.estimateWith(b, { duration: 12, hasAudio: true }).notes.join(" ")).toMatch(note);
+ expect(shorts.estimateWith(b, { duration: 12, hasAudio: false }).notes.join(" ")).not.toMatch(note);
+ // Sound the header reader couldn't find counts as none, as the stitch plans it.
+ expect(shorts.estimateWith(b, { duration: 12 }).notes.join(" ")).not.toMatch(note);
+ });
+
it("runs the open engine: segment (+ first frame) → Qwen first-frame restyle → Wan VACE → join → soundtrack", async () => {
const s = await shorts.createSession(body({ engine: "open" }) as never);
// Fuobe Shorts is the open engine's restyle model (the same graph oss-wan22-vace-restyle ran), on the GPU.