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.

Foley covers the whole clip, old app ids resolve, titled tool results, TRIBE v2 worker doc

Claude7edad8dbd2a4
diff --git a/docs/workers/tribe-v2.md b/docs/workers/tribe-v2.md
new file mode 100644
index 00000000..6ec7bd51
--- /dev/null
+++ b/docs/workers/tribe-v2.md
@@ -0,0 +1,59 @@
+# TRIBE v2 worker (optional, non-commercial)
+
+Higgsfield's Virality Predictor returns a per-second engagement curve, a peak, a hook score for the first
+3 seconds and five cortical regions on the fsaverage mesh. That output matches Meta's open brain-encoding
+model **TRIBE v2** (`facebook/tribev2`). Fuobe does not bundle it, and no cloud provider hosts it. The
+`/virality` page shows Fuobe's labelled heuristic hook check and never shows a score.
+
+This page describes the worker Fuobe would call if you run TRIBE v2 yourself.
+
+## Licence
+
+- TRIBE v2 weights: **CC BY-NC 4.0**. Non-commercial use only. You can't use its scores for client or
+ paid work.
+- TRIBE v2 is built from V-JEPA2 (video), Wav2Vec-BERT (audio) and **Llama-3.2-3B** (text). Llama-3.2-3B
+ is gated on Hugging Face. Accept Meta's licence on the model page and give the worker a Hugging Face
+ token that has access.
+- The scores are predictive proxies of modelled brain responses. They are not view forecasts or clinical
+ measures. Higgsfield shows the same disclaimer.
+
+## Worker contract
+
+The worker is a separate HTTP service on your own GPU, outside ComfyUI, like the isolated LatentSync
+worker described in `scripts/comfy/README.md`.
+
+`POST {TRIBE_URL}/analyze`, with `multipart/form-data` field `video` (MP4, up to 60 s), returns this JSON:
+
+```json
+{
+ "duration": 12.4,
+ "engagement": [41, 58, 72, 66],
+ "peak_t": 2,
+ "peak_val": 72,
+ "hook_score": 57,
+ "regions": {
+ "visual_occipital": [0.42, 0.61, 0.70, 0.55],
+ "frontoparietal_attention": [0.30, 0.48, 0.52, 0.47],
+ "auditory_temporal": [0.22, 0.35, 0.41, 0.38],
+ "language_frontotemporal": [0.18, 0.20, 0.33, 0.29],
+ "default_mode": [0.51, 0.40, 0.31, 0.36]
+ },
+ "model": "facebook/tribev2",
+ "disclaimer": "Predictive proxy metrics, not guaranteed performance or clinical measures."
+}
+```
+
+| Field | Meaning |
+|---|---|
+| `duration` | Length of the analysed video, in seconds. |
+| `engagement` | One value per second, normalised to 0–100. |
+| `peak_t`, `peak_val` | The second with the highest engagement, and that value. |
+| `hook_score` | Mean engagement over 0–3 s, 0–100. |
+| `regions` | Mean activation per second for each of the 5 fsaverage regions. For `default_mode` ("focus drift"), lower is better. |
+
+`GET {TRIBE_URL}/health` returns `{ "ok": true, "model": "facebook/tribev2" }`.
+
+## Status in Fuobe
+
+The contract is documented only. Fuobe has no setting for `TRIBE_URL` yet. Until there is one, `/virality`
+keeps its heuristic analysis in the browser, and the page says so on both engines.
diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.ts
index 52380ddd..bbc1b09f 100644
--- a/src/app/api/generations/route.ts
+++ b/src/app/api/generations/route.ts
@@ -55,6 +55,9 @@ const RequestSchema = z.object({
presetOptions: z.record(z.string(), z.string()).optional(),
presetStrength: z.number().min(0).max(1).optional(),
mix: z.object({ presetId: z.string().max(120), strength: z.number().min(0).max(1) }).optional(),
+ // What a tool calls its result (Trim · 0:01.0–0:02.5, Captions · Karaoke), shown instead of the prompt.
+ title: z.string().max(200).optional(),
+ batchTitle: z.string().max(200).optional(),
});
/**
diff --git a/src/components/av/trim-tool.tsx b/src/components/av/trim-tool.tsx
index 4089cd7d..91498b01 100644
--- a/src/components/av/trim-tool.tsx
+++ b/src/components/av/trim-tool.tsx
@@ -43,6 +43,7 @@ export function TrimTool({ tabs }: { tabs?: React.ReactNode }) {
op: "trim",
inputs: { video: video.ref },
params: { startTime: Math.round(range[0] * 100) / 100, endTime: Math.round(range[1] * 100) / 100 },
+ title: `Trim · ${formatCueTime(range[0])}–${formatCueTime(range[1])}`,
},
{ onSuccess: () => toast.success("Trimming"), onError: (e) => toast.error((e as Error).message) },
);
diff --git a/src/components/virality/virality-studio.tsx b/src/components/virality/virality-studio.tsx
index 02c37a5f..5c14bec9 100644
--- a/src/components/virality/virality-studio.tsx
+++ b/src/components/virality/virality-studio.tsx
@@ -10,8 +10,8 @@ import { Progress } from "@/components/ui/progress";
import type { SlotValue } from "@/components/studio/media-slot";
import { MediaDrop } from "@/components/av/media-drop";
import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";
-import { uploadFile, useEngine } from "@/lib/api";
-import { HOOK_SECONDS, hookSignals, hookSummary, SILENCE_DB, VIRALITY_PARITY, type HookSignal, type SignalId, type Verdict } from "@/lib/av/virality";
+import { uploadFile } from "@/lib/api";
+import { HOOK_SECONDS, hookSignals, hookSummary, SILENCE_DB, TRIBE_WORKER, VIRALITY_PARITY, type HookSignal, type SignalId, type Verdict } from "@/lib/av/virality";
import { cn } from "@/lib/utils";
import { measureHook, type HookMeasure } from "./measure";
@@ -84,7 +84,7 @@ export function ViralityStudio() {
}
function ParityNote() {
- const [engine] = useEngine();
+ // The page has no engine switch, so both routes are spelled out.
return (
<aside className="rounded-2xl border bg-muted/40 p-3 text-[13px] sm:p-4" aria-labelledby="virality-parity">
<div className="flex items-start gap-2.5">
@@ -94,7 +94,33 @@ function ParityNote() {
{VIRALITY_PARITY.title}
</p>
<p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.body}</p>
- <p className="text-pretty text-muted-foreground">{engine === "open" ? VIRALITY_PARITY.open : VIRALITY_PARITY.cloud}</p>
+ <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.cloud}</p>
+ <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.open}</p>
+ <details className="group pt-1">
+ <summary className="cursor-pointer text-[12px] font-medium text-foreground marker:text-muted-foreground">Run TRIBE v2 yourself (non-commercial)</summary>
+ <div className="mt-2 space-y-2 text-[12px] text-muted-foreground">
+ <p>
+ <span className="font-medium text-foreground">Worker:</span> <span className="font-mono break-words">{TRIBE_WORKER.endpoint}</span>
+ </p>
+ <div>
+ <p className="font-medium text-foreground">It returns</p>
+ <ul className="mt-0.5 list-disc space-y-0.5 pl-4">
+ {TRIBE_WORKER.output.map((x) => (
+ <li key={x}>{x}</li>
+ ))}
+ </ul>
+ </div>
+ <div>
+ <p className="font-medium text-foreground">It needs</p>
+ <ul className="mt-0.5 list-disc space-y-0.5 pl-4">
+ {TRIBE_WORKER.needs.map((x) => (
+ <li key={x}>{x}</li>
+ ))}
+ </ul>
+ </div>
+ <p>{TRIBE_WORKER.status} The full contract is in docs/workers/tribe-v2.md.</p>
+ </div>
+ </details>
</div>
</div>
</aside>
diff --git a/src/lib/av/captions.ts b/src/lib/av/captions.ts
index 60cc81f6..af5d5833 100644
--- a/src/lib/av/captions.ts
+++ b/src/lib/av/captions.ts
@@ -148,7 +148,9 @@ export function burnRequest(o: { route: BurnRoute; video: string; cues: Cue[]; l
const style = styleById(o.look.style);
const color = o.look.color ?? style.color;
const cues = upper(o.cues.filter((c) => c.text.trim()), style.upper);
- const base = { feature: CAPTIONS_FEATURE, modelId: BURN_MODELS[o.route], op: "captions" as const, inputs: { video: o.video } };
+ // The feed names it by the style (Captions · Karaoke) rather than "Captions · VEED Subtitles".
+ const title = `Captions · ${o.route === "auto" ? "Quick karaoke" : style.name}`;
+ const base = { feature: CAPTIONS_FEATURE, modelId: BURN_MODELS[o.route], op: "captions" as const, inputs: { video: o.video }, title };
if (o.route === "open") {
if (!cues.length) throw new Error("There are no lines to burn in");
return {
diff --git a/src/lib/av/virality.ts b/src/lib/av/virality.ts
index 68fc8940..e23c59fb 100644
--- a/src/lib/av/virality.ts
+++ b/src/lib/av/virality.ts
@@ -27,6 +27,23 @@ export const VIRALITY_PARITY = {
open: "Open engine: TRIBE v2 can run on your own GPU as an optional, non-commercial worker; Fuobe doesn't bundle it.",
};
+/** The optional TRIBE v2 worker's contract (docs/workers/tribe-v2.md), as the page summarises it. */
+export const TRIBE_WORKER = {
+ endpoint: "POST {TRIBE_URL}/analyze · multipart field “video” (MP4, up to 60 s)",
+ output: [
+ "engagement: one value per second, 0–100",
+ "peak_t / peak_val: the strongest second",
+ "hook_score: mean engagement over 0–3 s",
+ "regions: visual, attention, auditory, language and default mode (focus drift, lower is better), per second",
+ ],
+ needs: [
+ "facebook/tribev2 weights — CC BY-NC 4.0, non-commercial use only",
+ "Llama-3.2-3B (gated on Hugging Face: accept Meta's licence, give the worker a token)",
+ "V-JEPA2 and Wav2Vec-BERT (TRIBE v2's video and audio encoders) on your own GPU",
+ ],
+ status: "Documented only: Fuobe has no TRIBE_URL setting yet, so this page keeps its browser heuristics.",
+};
+
export type Verdict = "strong" | "ok" | "weak" | "unknown";
export type SignalId = "motion" | "change" | "faces" | "text" | "sound" | "contrast" | "format";
diff --git a/src/lib/catalog/apps.ts b/src/lib/catalog/apps.ts
index b67cfe1c..da817708 100644
--- a/src/lib/catalog/apps.ts
+++ b/src/lib/catalog/apps.ts
@@ -104,6 +104,12 @@ const opt = (key: string, label: string, choices: [string, string][]): PresetOpt
choices: choices.map(([l, p]) => ({ value: slug(l), label: l, prompt: p })),
});
+/**
+ * Old app ids still stored on generations (their Reuse / Retry look the preset up by id): the app they
+ * became. The Virality Predictor app is the Hook Frame app since /virality took its name and URL.
+ */
+export const APP_ALIASES: Record<string, string> = { "app-virality-predictor": "app-hook-frame" };
+
export const APPS: Preset[] = [
// ---------------- Identity & people
app({
diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts
index 1db3ee63..7d7c80cb 100644
--- a/src/lib/catalog/index.ts
+++ b/src/lib/catalog/index.ts
@@ -1,4 +1,4 @@
-import { APPS as RAW_APPS } from "./apps";
+import { APP_ALIASES, APPS as RAW_APPS } from "./apps";
import { EFFECTS as RAW_EFFECTS, MOTIONS as RAW_MOTIONS } from "./motions";
import { MODELS } from "./models";
import { LLM_MODELS } from "./llm-models";
@@ -91,7 +91,7 @@ export function getModel(id: string): ModelDef | undefined {
}
export function getPreset(id: string): Preset | undefined {
- return presetIndex.get(id);
+ return presetIndex.get(id) ?? (APP_ALIASES[id] ? presetIndex.get(APP_ALIASES[id]) : undefined);
}
export function modelsFor(opts: { kind?: MediaKind; ops?: Operation[]; engine?: Engine | "all" }): ModelDef[] {
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index 175ea71c..7b5aded8 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -864,11 +864,11 @@ const open: ModelDef[] = [
vendor: "Tencent",
family: "hunyuan",
kind: "video",
- tagline: "48 kHz foley in sync with your clip, laid under the untouched picture · 12 GB GPU · licence excludes the EU, UK and South Korea",
+ tagline: "48 kHz foley in sync with your whole clip (up to 30 s), laid under the untouched picture · 12 GB GPU · licence excludes the EU, UK and South Korea",
badges: ["new"],
- routes: [comfy("v2a", "v2a-hunyuan-foley", "frames at 8 fps → HunyuanFoleySampler; picture stream-copied")],
- options: { durations: [4, 8, 10, 15, 20, 30], seed: true, negativePrompt: true },
- defaults: { duration: 8 },
+ // No length to pick: the sound is as long as the clip (the provider reads it from the MP4 header).
+ routes: [comfy("v2a", "v2a-hunyuan-foley", "frames at 8 fps → HunyuanFoleySampler; picture stream-copied; sound as long as the clip")],
+ options: { seed: true, negativePrompt: true },
}),
o({
id: "oss-mmaudio-sfx",
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index 771b13c6..5d58d128 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -493,12 +493,18 @@ export async function prepareWorkflow(endpointTemplate: string, input: GenInput,
if (input.endTime !== undefined && input.endTime <= start) throw new ProviderError("The end time must be after the start time");
if (clipLength && start >= clipLength) throw new ProviderError(`The start time is past the end of the clip (it is ${seconds(clipLength)} s long)`);
}
- const span = input.endTime !== undefined ? Math.max(0, input.endTime - start) : input.duration;
+ // Sound for a video with no length asked for: as long as the clip (up to 30 s, and what the frame cap holds).
+ const soundLength =
+ ctx.op === "v2a" && b.duration && input.endTime === undefined && !input.duration && clipLength
+ ? Math.min(30, Number(manifest.limits?.maxFrames ?? Infinity) / fps, Math.ceil(clipLength * 10) / 10)
+ : undefined;
+ const span = input.endTime !== undefined ? Math.max(0, input.endTime - start) : (input.duration ?? soundLength);
if (b.startTime && input.startTime !== undefined) values.startTime = start;
if (b.startFrame && input.startTime !== undefined) values.startFrame = Math.round(start * fps);
if (b.duration) {
if (input.endTime !== undefined) values.duration = span;
else if (input.duration) values.duration = input.duration;
+ else if (soundLength) values.duration = soundLength;
else if (ctx.op === "trim") values.duration = 0; // from the start time to the end
}
if (b.width || b.height) {
diff --git a/tests/av-tools.test.ts b/tests/av-tools.test.ts
index 60bbf609..fbfc6215 100644
--- a/tests/av-tools.test.ts
+++ b/tests/av-tools.test.ts
@@ -92,6 +92,15 @@ describe("caption style → burn params", () => {
expect(CAPTION_STYLES.filter((s) => burnPricePerMinute("veed", s.id) === 0.2).map((s) => s.id)).toEqual(["karaoke", "boxed", "neon"]);
expect(burnPricePerMinute("veed", "clean")).toBe(0.1);
expect(burnPricePerMinute("open", "karaoke")).toBe(0);
+ // The feed names a burn by its style.
+ expect(burnRequest({ route: "open", video: "/v.mp4", cues, look: look({ style: "karaoke" }) }).title).toBe("Captions · Karaoke");
+ expect(burnRequest({ route: "auto", video: "/v.mp4", cues: [], look: look() }).title).toBe("Captions · Quick karaoke");
+ });
+
+ it("an old app id still finds its app (generations made before the rename keep Reuse and Retry)", () => {
+ expect(getPreset("app-virality-predictor")?.id).toBe("app-hook-frame");
+ expect(getPreset("app-hook-frame")?.name).toBe("Hook Frame");
+ expect(getPreset("app-nope")).toBeUndefined();
});
});
diff --git a/tests/av-virality.test.ts b/tests/av-virality.test.ts
index 20d61260..282c1caf 100644
--- a/tests/av-virality.test.ts
+++ b/tests/av-virality.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { hookSignals, hookSummary, hookTimes, loudnessSeries, lumaStats, meanDb, VIRALITY_PARITY, type HookInput } from "@/lib/av/virality";
+import { hookSignals, hookSummary, hookTimes, loudnessSeries, lumaStats, meanDb, TRIBE_WORKER, VIRALITY_PARITY, type HookInput } from "@/lib/av/virality";
import { getPreset } from "@/lib/catalog";
const base: HookInput = {
@@ -89,10 +89,15 @@ describe("virality heuristic", () => {
expect(VIRALITY_PARITY.body).toMatch(/TRIBE v2/);
expect(VIRALITY_PARITY.body).toMatch(/CC BY-NC/);
expect(VIRALITY_PARITY.open).toMatch(/non-commercial/);
+ // The optional worker is documented: its endpoint, output, the gated Llama and the licence.
+ expect(TRIBE_WORKER.endpoint).toMatch(/\/analyze/);
+ expect(TRIBE_WORKER.output.join(" ")).toMatch(/hook_score.*0–3 s/);
+ expect(TRIBE_WORKER.needs.join(" ")).toMatch(/Llama-3\.2-3B.*gated/);
+ expect(TRIBE_WORKER.needs.join(" ")).toMatch(/CC BY-NC/);
});
- it("the app that used to be Virality Predictor is the Hook Frame step", () => {
- expect(getPreset("app-virality-predictor")).toBeUndefined();
+ it("the app that used to be Virality Predictor is the Hook Frame step (old generations still find it)", () => {
+ expect(getPreset("app-virality-predictor")?.id).toBe("app-hook-frame");
expect(getPreset("app-hook-frame")?.name).toBe("Hook Frame");
});
});
diff --git a/tests/av-workflows.test.ts b/tests/av-workflows.test.ts
index f8bcad7d..f354feb4 100644
--- a/tests/av-workflows.test.ts
+++ b/tests/av-workflows.test.ts
@@ -73,6 +73,15 @@ describe("av-tools workflows", () => {
for (const n of ["4", "8"]) expect(r.workflow[n].inputs.filename_prefix).toBe("fuobe/gen1");
});
+ it("Foley with no length asked for covers the whole clip (its header's length)", async () => {
+ const r = await prepare("v2a-hunyuan-foley", "v2a", { video: "clip.mp4", prompt: "rain on a window" });
+ expect(r.workflow["3"].inputs.duration).toBe(6);
+ expect(r.workflow["5"].inputs.frame_load_cap).toBe(computeFrames(6, 8, 4, 481));
+ // The model offers no length to pick, so nothing overrides it.
+ expect(getModel("oss-hunyuan-foley-video")!.options.durations).toBeUndefined();
+ expect(getModel("oss-hunyuan-foley-video")!.defaults?.duration).toBeUndefined();
+ });
+
it("Voice timeline: every line at its cue on silence as long as the video, cut where the next starts", async () => {
const timeline = { length: 30, clips: [{ start: 0, duration: 6 }, { start: 6, duration: 18 }, { start: 24, duration: 6 }] };
const r = await prepare("audio-timeline", "timeline", { audios: ["l0.flac", "l1.flac", "l2.flac"], duration: 30, extra: { timeline } });