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
Upscale hub: FPS Boost, SDR to HDR and Export tabs, with the clip's facts, a format picker and prices by the clip's length
Claude84b04f84bc67
diff --git a/src/components/home-view.tsx b/src/components/home-view.tsxindex 4810c49f..19e46588 100644--- a/src/components/home-view.tsx+++ b/src/components/home-view.tsx@@ -55,7 +55,7 @@ const tools = (c: Counts) => [{ href: "/canvas", label: "Canvas", desc: "Chain steps into a flow", icon: Network, hue: 260 },{ href: "/lipsync", label: "Lipsync", desc: "Talking avatars", icon: Mic2, hue: 150 },{ href: "/elements", label: "Elements", desc: "@ characters, places, props", icon: ScanFace, hue: 320 },- { href: "/upscale", label: "Upscale", desc: "Images & video", icon: ZoomIn, hue: 240 },+ { href: "/upscale", label: "Upscale", desc: "Video, FPS, HDR & images", icon: ZoomIn, hue: 240 },{ href: "/audio", label: "Audio", desc: "Voice, SFX, music", icon: AudioLines, hue: 60 },];diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 1e09e908..9ec2d79f 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -2,17 +2,19 @@import { ArrowUp, AtSign, Loader2, Sparkles, X } from "lucide-react";import dynamic from "next/dynamic";+import Link from "next/link";import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";import { Kbd } from "@/components/ui/kbd";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { estimateCost, planGeneration, routesFor } from "@/lib/catalog/plan";-import type { GenerationRequest, MediaKind, ModelDef, Operation, Preset } from "@/lib/catalog/types";-import { enhance, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";+import type { GenerationRequest, MediaKind, ModelDef, Operation, Preset, VideoFormat } from "@/lib/catalog/types";+import { formatsOf } from "@/lib/av/formats";+import { enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";import { applyMentions, type StudioElement } from "@/lib/catalog/elements";import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";-import { blockerFor, costLabel, filterModels, firstMissingSlot, namedImageSlots, PLACEHOLDER, pushRecent, settingsShape } from "@/lib/composer";+import { blockerFor, clipOutcome, costLabel, filterModels, firstMissingSlot, namedImageSlots, PLACEHOLDER, pushRecent, settingsShape } from "@/lib/composer";import { formatCost } from "@/lib/format";import { cn } from "@/lib/utils";import { AttachMenu } from "./attach-menu";@@ -117,9 +119,9 @@ function pulseSlot(root: HTMLElement | null, key: string, retried = false) {}export function Composer({ docked }: { docked: boolean }) {- const { config, draft, setDraft, setSlot } = useStudio();+ const { config, draft: typed, setDraft, setSlot } = useStudio();const catalog = useCatalog();- const [engine, setEngine] = useEngine();+ const [engine, setEngine, engineMode] = useEngine();const create = useCreateGeneration();const [enhancing, setEnhancing] = useState(false);const [focused, setFocused] = useState(false);@@ -129,6 +131,13 @@ export function Composer({ docked }: { docked: boolean }) {const hydrated = useHydrated();const liveStatus = useStatus().data;const status = hydrated ? liveStatus : undefined;+ // Upscale hub: the attached clip's header (length, size, frame rate). Its length prices per-second tools and+ // travels with the request (params.sourceDuration); a clip swapped since a Reuse never keeps the old one's.+ const facts = useClipFacts(config.clipFacts && !typed.slots.video?.uploading ? typed.slots.video?.ref : undefined).data;+ const draft = useMemo(+ () => (config.clipFacts ? { ...typed, params: { ...typed.params, sourceDuration: typed.slots.video?.ref ? facts?.duration : undefined } } : typed),+ [config.clipFacts, typed, facts?.duration],+ );const liveElements = useElements().data;const elements = (hydrated && liveElements) || EMPTY;const [, setRecent] = useStoredList(RECENT_MODELS);@@ -230,7 +239,7 @@ export function Composer({ docked }: { docked: boolean }) {const { request: planned } = prepare({ ...draft, slots: planSlots, refs: draft.refs.map((r) => stand(r, r.kind) as SlotValue) });const plan = planGeneration({ ...planned, prompt: planned.prompt || (config.promptOptional ? " " : "") }, catalog.getModel, catalog.getPreset);op = plan.op;- cost = estimateCost(plan.model, plan.params, plan.jobs);+ cost = estimateCost(plan.model, plan.params, plan.jobs, plan.op);} catch (e) {planError = (e as Error).message;}@@ -307,7 +316,27 @@ export function Composer({ docked }: { docked: boolean }) {const opNote = op && model ? routesFor(model, op)[0]?.note : undefined;const showPrompt = !config.hidePrompt && preset?.userPrompt !== "none" && !opts.promptless;const effectiveOp = studioOp ?? op;- const shape = settingsShape(model, effectiveOp, config.kind, showPrompt, p, config.ops);+ // SDR to HDR, Export: every format the studio's models on this engine write; picking one this model doesn't+ // write moves the request to the model that does (EXR frames → LTX 2.3 HDR on the cloud).+ const engineModels = useMemo(() => models.filter((m) => m.engine === (model?.engine ?? engine)), [models, model?.engine, engine]);+ const studioFormats = useMemo(() => (config.formatPicker ? formatsOf(engineModels) : undefined), [config.formatPicker, engineModels]);+ const writerOf = (f: VideoFormat) => (model?.options.formats?.includes(f) ? model : engineModels.find((m) => m.options.formats?.includes(f)));+ const pickFormat = (f: VideoFormat) => {+ const m = writerOf(f);+ if (!m || m.id === model?.id) return setP({ format: f });+ setDraft((d) => ({ modelId: m.id, params: { ...m.defaults, format: f, numOutputs: d.params.numOutputs, seed: d.params.seed } }));+ };+ const formatVia = (f: VideoFormat) => {+ const m = writerOf(f);+ return m && m.id !== model?.id ? `via ${m.name}` : undefined;+ };+ const shape = settingsShape(model, effectiveOp, config.kind, showPrompt, p, config.ops, studioFormats);+ const outcome = config.clipFacts && draft.slots.video?.ref ? clipOutcome(effectiveOp, facts, p, model) : null;+ // Export without a ComfyUI to write it (none connected, or the install runs cloud APIs only): say so and offer the cloud route.+ const comfyMissing = !!config.comfyOnly && !!status && (engineMode === "cloud" || !status.providers.comfyui?.configured);+ const video = draft.slots.video?.ref;+ const alternative = config.comfyOnly?.alternative;+ const alternativeHref = alternative && `${alternative.href}${video?.startsWith("/api/files/") ? `&video=${encodeURIComponent(video)}` : ""}`;const demo = !!(model && status && status.demoMode !== "off" && !model.routes.some((r) => status.providers[r.provider]?.configured));const costText = costLabel({ demo, cost }, formatCost);@@ -384,7 +413,7 @@ export function Composer({ docked }: { docked: boolean }) {/>)}{opts.presets && !soulStyles && <ProviderPresetChip spec={opts.presets} value={p.extra?.[opts.presets.param] as string | undefined} onChange={(id) => setExtra(opts.presets!.param, id)} />}- {opts.controls && <ControlsChip controls={opts.controls} values={p.extra ?? {}} onChange={setExtra} />}+ {opts.controls && <ControlsChip controls={opts.controls} values={p.extra ?? {}} onChange={setExtra} title={config.controlsTitle} />}</>);const hasSecondary =@@ -627,6 +656,8 @@ export function Composer({ docked }: { docked: boolean }) {enhancing={enhancing}onRewrite={runEnhance}opNote={opNote}+ onFormat={pickFormat}+ formatVia={formatVia}className="max-sm:order-1"extras={hasSecondary ? (@@ -674,6 +705,30 @@ export function Composer({ docked }: { docked: boolean }) {</TooltipContent></Tooltip></div>+ {outcome && (+ <p className="px-2 pt-1 text-[12px] text-muted-foreground tabular-nums" aria-live="polite">+ {outcome}+ </p>+ )}+ {comfyMissing && (+ <div role="note" className="mx-1 mt-2 space-y-1 rounded-xl border border-dashed px-3 py-2 text-[12px] leading-snug text-muted-foreground">+ <p>+ {engineMode === "cloud"+ ? "This install runs paid cloud APIs only (Settings → Engine mode), and no cloud API re-encodes a finished clip: export formats are written by ComfyUI on your own machine."+ : config.comfyOnly!.note}{" "}+ <Link href="/settings" className="font-medium text-brand-text underline-offset-2 hover:underline">+ Open Settings+ </Link>+ </p>+ {alternative && alternativeHref && engineMode !== "open" && (+ <p>+ <Link href={alternativeHref} onClick={() => setEngine("cloud")} className="font-medium text-brand-text underline-offset-2 hover:underline">+ {alternative.label}+ </Link>+ </p>+ )}+ </div>+ )}{sketched.note && <p className="px-2 pt-1 text-[12px] text-muted-foreground">{sketched.note}</p>}{signed.notes.length > 0 && <p className="px-2 pt-1 text-[12px] text-muted-foreground">{signed.notes.join(" · ")}</p>}{model && op && model.options.endFrame === undefined && draft.slots.endImage?.ref && (diff --git a/src/components/studio/mode-switch-studio.tsx b/src/components/studio/mode-switch-studio.tsxindex a2e72a12..05e7f2eb 100644--- a/src/components/studio/mode-switch-studio.tsx+++ b/src/components/studio/mode-switch-studio.tsx@@ -5,13 +5,16 @@ import {AUDIO_STUDIO,DIALOGUE_STUDIO,FOLEY_STUDIO,+ FPS_BOOST_STUDIO,JOIN_CLIPS_STUDIO,MUSIC_STUDIO,+ SDR_TO_HDR_STUDIO,SFX_STUDIO,TRANSLATE_STUDIO,UPSCALE_STUDIO,VIDEO_COLOR_MATCH_STUDIO,VIDEO_DEPTH_STUDIO,+ VIDEO_EXPORT_STUDIO,VIDEO_MATTE_STUDIO,VIDEO_RELIGHT_STUDIO,VIDEO_UPSCALE_STUDIO,@@ -26,7 +29,7 @@ import { ModeStudio, ModeTabs } from "./mode-studio";import type { StudioConfig } from "./studio-context";const CONFIGS: Record<HubKind, Record<string, StudioConfig>> = {- upscale: { image: UPSCALE_STUDIO, video: VIDEO_UPSCALE_STUDIO },+ upscale: { image: UPSCALE_STUDIO, video: VIDEO_UPSCALE_STUDIO, fps: FPS_BOOST_STUDIO, hdr: SDR_TO_HDR_STUDIO, export: VIDEO_EXPORT_STUDIO },audio: {speech: AUDIO_STUDIO,dialogue: DIALOGUE_STUDIO,diff --git a/src/components/studio/model-controls.tsx b/src/components/studio/model-controls.tsxindex 2fec3de8..d8c8066e 100644--- a/src/components/studio/model-controls.tsx+++ b/src/components/studio/model-controls.tsx@@ -1,7 +1,7 @@"use client";import { useQuery } from "@tanstack/react-query";-import { Ban, Check, Clapperboard, Loader2, Palette } from "lucide-react";+import { Ban, Check, Clapperboard, Loader2, Palette, Settings2 } from "lucide-react";import { useMemo, useState } from "react";import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";@@ -187,21 +187,24 @@ export function ControlsChip({controls,values,onChange,+ title = "Director",}: {controls: NonNullable<ModelOptions["controls"]>;values: Record<string, unknown>;onChange: (param: string, v?: string | number) => void;+ /** The chip's name: "Director" (Cinema's genre, lens, light…), "Options" for a tool's model settings (Upscale). */+ title?: string;}) {const set = controls.filter((c) => values[c.param] !== undefined);return (<Popover><PopoverTrigger asChild>- <Chip icon={Clapperboard} active={set.length > 0}>- {set.length ? `Director · ${set.length}` : "Director"}+ <Chip icon={title === "Director" ? Clapperboard : Settings2} active={set.length > 0}>+ {set.length ? `${title} · ${set.length}` : title}</Chip></PopoverTrigger><PopoverContent className="w-[min(92vw,420px)] space-y-2 p-3" align="start" side="top" collisionPadding={12}>- <p className="text-[13px] font-medium">Director controls</p>+ <p className="text-[13px] font-medium">{title === "Director" ? "Director controls" : `Model ${title.toLowerCase()}`}</p><p className="text-[12px] text-muted-foreground">Leave one on Auto and the model decides.</p><div className="grid grid-cols-2 gap-2">{controls.map((c) => (@@ -213,10 +216,10 @@ export function ControlsChip({</SelectTrigger><SelectContent className="max-h-72">{/* Auto sends nothing: the model's default, named when it's known (Leffa: Upper body). */}- <SelectItem value="__auto">{c.default !== undefined ? `Auto · ${label(c.default)}` : "Auto"}</SelectItem>+ <SelectItem value="__auto">{c.default !== undefined ? `Auto · ${c.labels?.[String(c.default)] ?? label(c.default)}` : "Auto"}</SelectItem>{c.values.map((v) => (<SelectItem key={String(v)} value={String(v)}>- {label(v)}+ {c.labels?.[String(v)] ?? label(v)}</SelectItem>))}</SelectContent>diff --git a/src/components/studio/result-actions.tsx b/src/components/studio/result-actions.tsxindex 47ae5bae..62eecc6c 100644--- a/src/components/studio/result-actions.tsx+++ b/src/components/studio/result-actions.tsx@@ -10,6 +10,7 @@ import {Crop,Download,FastForward,+ FileArchive,FileDown,FolderDown,Heart,@@ -77,6 +78,7 @@ export const ACTION_ICONS: Record<OutputActionId, LucideIcon> = {"download-srt": FileDown,"download-vtt": FileDown,"download-all": FolderDown,+ "download-exr": FileArchive,favorite: Heart,finalize: Sparkles,compare: Columns2,diff --git a/src/components/studio/result-media.tsx b/src/components/studio/result-media.tsxindex c1e203f9..2d9b1d35 100644--- a/src/components/studio/result-media.tsx+++ b/src/components/studio/result-media.tsx@@ -1,9 +1,11 @@"use client";-import { AudioLines, Box, FileText, Layers } from "lucide-react";+import { AudioLines, Box, FileText, Film, Layers } from "lucide-react";import { createElement, useEffect, useState } from "react";-import type { Generation, OutputFile } from "@/lib/catalog/types";-import { cuesOf, cueTime, isLayered, layerInfo, modelPreview, textOf } from "@/lib/output-actions";+import { FORMAT_INFO } from "@/lib/av/formats";+import type { Generation, OutputFile, VideoFormat } from "@/lib/catalog/types";+import { extensionOf } from "@/lib/library";+import { cuesOf, cueTime, editOnlyFormat, isLayered, layerInfo, modelPreview, textOf } from "@/lib/output-actions";import { cn } from "@/lib/utils";/** Any result as a tile picture: image, video (plays on hover), audio, text card, 3D preview. */@@ -15,8 +17,8 @@ export function MediaThumb({fit,}: {output: OutputFile;- /** The generation it belongs to (3D models show a sibling turntable or poster). */- g?: Pick<Generation, "outputs">;+ /** The generation it belongs to (3D models show a sibling turntable or poster; pro exports a file card). */+ g?: Pick<Generation, "outputs"> & Partial<Pick<Generation, "op" | "request">>;className?: string;autoPlay?: boolean;/** Letterbox instead of crop (Library "Fit"). */@@ -24,21 +26,9 @@ export function MediaThumb({}) {const object = fit ? "object-contain" : "object-cover";if (output.kind === "video") {- return (- <video- src={`${output.url}#t=0.1`}- muted- loop- playsInline- preload="metadata"- autoPlay={autoPlay}- onMouseEnter={(e) => void e.currentTarget.play().catch(() => {})}- onMouseLeave={(e) => {- if (!autoPlay) e.currentTarget.pause();- }}- className={cn("size-full", object, className)}- />- );+ const pro = editOnlyFormat(g, output);+ if (pro) return <VideoFileCard output={output} format={pro} className={className} />;+ return <TileVideo output={output} autoPlay={autoPlay} className={cn("size-full", object, className)} />;}if (output.kind === "audio") {return (@@ -70,6 +60,42 @@ export function MediaThumb({return <img src={output.url} alt="" loading="lazy" decoding="async" className={cn("size-full", object, className)} />;}+/** A muted tile video that plays on hover; a file card when the browser can't decode it (a 10-bit or HEVC file). */+function TileVideo({ output, autoPlay, className }: { output: OutputFile; autoPlay?: boolean; className?: string }) {+ const [failed, setFailed] = useState(false);+ if (failed) return <VideoFileCard output={output} className={className} />;+ return (+ <video+ src={`${output.url}#t=0.1`}+ muted+ loop+ playsInline+ preload="metadata"+ autoPlay={autoPlay}+ onError={() => setFailed(true)}+ onMouseEnter={(e) => void e.currentTarget.play().catch(() => {})}+ onMouseLeave={(e) => {+ if (!autoPlay) e.currentTarget.pause();+ }}+ className={className}+ />+ );+}++/** A video the browser doesn't play (ProRes, FFV1, some 10-bit files) as what it is: a file for an editor or player. */+export function VideoFileCard({ output, format, className }: { output: Pick<OutputFile, "url" | "kind">; format?: VideoFormat; className?: string }) {+ const info = format ? FORMAT_INFO[format] : undefined;+ return (+ <div className={cn("flex size-full flex-col items-center justify-center gap-1.5 bg-muted p-4 text-center text-muted-foreground", className)}>+ <Film className="size-7" aria-hidden />+ <span className="text-[13px] font-medium text-foreground">{info?.label ?? "Video file"}</span>+ <span className="max-w-56 text-[12px] leading-snug">+ .{extensionOf(output)} · {info ? "made for your editor; browsers don't play it. Download it to use it" : "this browser can't play it here. Download it to watch"}+ </span>+ </div>+ );+}+/** A 56 px thumbnail for list rows: media where it reads at that size, an icon where it doesn't. */export function SmallThumb({ g, output }: { g: Generation; output: OutputFile }) {if (output.kind === "audio" || output.kind === "text") {diff --git a/src/components/studio/settings-panel.tsx b/src/components/studio/settings-panel.tsxindex f1b2ac3c..c5c6dc2e 100644--- a/src/components/studio/settings-panel.tsx+++ b/src/components/studio/settings-panel.tsx@@ -5,8 +5,9 @@ import { useId, useState } from "react";import { Button } from "@/components/ui/button";import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";import { Switch } from "@/components/ui/switch";-import { OPERATION_LABELS, type GenParams, type ModelDef, type Operation } from "@/lib/catalog/types";-import { durationLabel, hiddenChanges, settingsSummary, type SettingsShape } from "@/lib/composer";+import { FORMAT_INFO } from "@/lib/av/formats";+import { OPERATION_LABELS, type GenParams, type ModelDef, type Operation, type VideoFormat } from "@/lib/catalog/types";+import { durationLabel, formatOf, hiddenChanges, settingsSummary, type SettingsShape } from "@/lib/composer";import { ratioValue } from "@/lib/format";import { cn } from "@/lib/utils";import { SliderControls } from "./audio-controls";@@ -119,6 +120,10 @@ export interface SettingsPanelProps {className?: string;/** Chips the toolbar has no room for on phones (voice, motion, style…): shown at the top of the sheet there. */extras?: React.ReactNode;+ /** Picking a format (SDR to HDR, Export): another model may write it (the composer moves the request there). */+ onFormat?: (f: VideoFormat) => void;+ /** The model that writes a format, when it isn't the one picked ("via LTX 2.3 HDR"). */+ formatVia?: (f: VideoFormat) => string | undefined;}/**@@ -160,7 +165,40 @@ export function SettingsChip(props: SettingsPanelProps) {);}-function SettingsBody({ model, op, shape, params: p, setP, setExtra, negativePrompt, setNegativePrompt, kind, enhancing, onRewrite, opNote, extras }: SettingsPanelProps) {+/** Output formats as a list of choices, each with what it's for (Higgsfield's SDR to HDR copy). */+function FormatChoices({ formats, value, onChange, via }: { formats: VideoFormat[]; value: VideoFormat; onChange: (f: VideoFormat) => void; via?: (f: VideoFormat) => string | undefined }) {+ return (+ <div role="radiogroup" aria-label="Format" onKeyDown={radioKeys} className="grid gap-1">+ {formats.map((f) => {+ const sel = value === f;+ const info = FORMAT_INFO[f];+ const other = via?.(f);+ return (+ <button+ key={f}+ type="button"+ role="radio"+ aria-checked={sel}+ tabIndex={radioTab(sel)}+ onClick={() => onChange(f)}+ className={cn(+ "flex flex-col items-start gap-0.5 rounded-lg border px-2.5 py-2 text-left transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50",+ sel && "border-primary bg-brand-faint hover:bg-brand-faint-hover",+ )}+ >+ <span className={cn("text-[13px] font-medium", sel && "text-brand-text")}>+ {info?.label ?? f}+ {other && <span className="font-normal text-muted-foreground"> · {other}</span>}+ </span>+ <span className="text-[12px] leading-snug text-muted-foreground">{info?.hint}</span>+ </button>+ );+ })}+ </div>+ );+}++function SettingsBody({ model, op, shape, params: p, setP, setExtra, negativePrompt, setNegativePrompt, kind, enhancing, onRewrite, opNote, extras, onFormat, formatVia }: SettingsPanelProps) {const opts = model?.options ?? {};const d = model?.defaults ?? {};const [advanced, setAdvanced] = useState(p.seed !== undefined || !!negativePrompt);@@ -195,9 +233,36 @@ function SettingsBody({ model, op, shape, params: p, setP, setExtra, negativePro</div></Section>)}+ {shape.formats && (+ <Section label="Format">+ <FormatChoices formats={shape.formats} value={formatOf(p, model, shape.formats)!} onChange={(f) => (onFormat ? onFormat(f) : setP({ format: f }))} via={formatVia} />+ </Section>+ )}{shape.resolution && (- <Section label="Quality">- <Segmented label="Quality" options={shape.resolution} value={p.resolution ?? d.resolution ?? shape.resolution[0]} onChange={(v) => setP({ resolution: v })} />+ <Section label={op?.startsWith("upscale") ? "Resolution" : "Quality"}>+ <Segmented+ label={op?.startsWith("upscale") ? "Resolution" : "Quality"}+ options={shape.resolution}+ value={p.resolution ?? d.resolution ?? shape.resolution[0]}+ onChange={(v) => setP({ resolution: v })}+ />+ </Section>+ )}+ {shape.fps && (+ <Section label="Frame rate">+ {/* 0 stands for the clip's own frame rate (nothing sent). */}+ <Segmented+ label="Frame rate"+ options={shape.fps.original ? [0, ...shape.fps.values] : shape.fps.values}+ value={p.targetFps ?? d.targetFps ?? (shape.fps.original ? 0 : shape.fps.values[0])}+ onChange={(v) => setP({ targetFps: v || undefined })}+ format={(v) => (v ? `${v}` : "Original")}+ />+ </Section>+ )}+ {shape.slowdown && (+ <Section label="Slow motion">+ <Segmented label="Slow motion" options={shape.slowdown} value={p.slowdown ?? 1} onChange={(v) => setP({ slowdown: v > 1 ? v : undefined })} format={(v) => (v > 1 ? `${v}×` : "Off")} /></Section>)}{shape.duration && (diff --git a/src/components/studio/studio-context.tsx b/src/components/studio/studio-context.tsxindex b087f4a6..fa723f35 100644--- a/src/components/studio/studio-context.tsx+++ b/src/components/studio/studio-context.tsx@@ -45,6 +45,20 @@ export interface StudioConfig {signature?: boolean;/** Models the studio can be moved to (by the signature chips) beyond its picker list and defaults: kept in its model slice. */extraModels?: string[];+ /**+ * Read the attached clip's header (length, size, frame rate): prices count its seconds and the composer+ * says what comes out ("24 → 60 fps", "1280×720 → 3840×2160"). Upscale hub video modes.+ */+ clipFacts?: boolean;+ /** Offer every output format of the studio's models on this engine; picking one another model writes moves the request there (SDR to HDR, Export). */+ formatPicker?: boolean;+ /** The models' enum settings chip ("Director" by default; "Options" for a tool's settings such as Topaz's model). */+ controlsTitle?: string;+ /**+ * Tools only ComfyUI runs (Export): what to say when none is connected or the install runs cloud APIs only,+ * and a cloud route to offer instead (`href` gets `&video=<the attached clip>`).+ */+ comfyOnly?: { note: string; alternative?: { label: string; href: string } };}export interface Draft {diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsxindex 065976ff..69473eea 100644--- a/src/components/studio/studio-page.tsx+++ b/src/components/studio/studio-page.tsx@@ -58,11 +58,13 @@ function initialDraft(}if (sp.get("video")) slots.video = slot(sp.get("video"));if (sp.get("audio")) slots.audio = slot(sp.get("audio"));+ // An output format handed over in the link (Export → "ProRes in the cloud"), when the model writes it.+ const format = model?.options.formats?.find((f) => f === sp.get("format"));return {prompt: sp.get("prompt") ?? "",negativePrompt: "",modelId,- params: { ...model?.defaults, ...(preset?.type === "app" ? presetRoute?.params : {}) },+ params: { ...model?.defaults, ...(preset?.type === "app" ? presetRoute?.params : {}), ...(format && { format }) },slots,refs,presetId: sp.get("preset") ?? config.preset?.id,diff --git a/src/components/studio/viewer.tsx b/src/components/studio/viewer.tsxindex bc0e345e..7cb7c8cb 100644--- a/src/components/studio/viewer.tsx+++ b/src/components/studio/viewer.tsx@@ -12,11 +12,11 @@ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "import { OPERATION_LABELS, type Generation, type OutputFile } from "@/lib/catalog/types";import { formatCost, timeAgo } from "@/lib/format";import { trashDaysLeft, userTitle } from "@/lib/library";-import { isLayered, layerInfo, outputActions, type OutputAction } from "@/lib/output-actions";+import { editOnlyFormat, isLayered, layerInfo, outputActions, type OutputAction } from "@/lib/output-actions";import { cn } from "@/lib/utils";import { CompareSlider } from "./compare-slider";import { ACTION_ICONS, downloadUrl, SaveElementForm, useActionRunner } from "./result-actions";-import { LayersStack, ModelViewer, TextReader } from "./result-media";+import { LayersStack, ModelViewer, TextReader, VideoFileCard } from "./result-media";function Row({ label, value, mono }: { label: string; value?: React.ReactNode; mono?: boolean }) {@@ -145,6 +145,8 @@ export function Viewer({const [allLayers, setAllLayers] = useState(layered);const [drawer, setDrawer] = useState(false);const [saving, setSaving] = useState(false);+ // A video this browser can't decode (HEVC or 10-bit H.264 on some systems): shown as a file to download instead.+ const [failedVideo, setFailedVideo] = useState<string | null>(null);const run = useActionRunner({ onReuse: onReuse && ((x) => (onReuse(x), onClose())), onCompare: () => setComparing((v) => !v), onDeleted: onClose });const list = useMemo(() => outputActions(g, index, { reuse: !!onReuse, compare: !!source, inViewer: true }), [g, index, onReuse, source]);@@ -256,9 +258,16 @@ export function Viewer({);};+ const pro = editOnlyFormat(g, o);const media =o.kind === "video" ? (- <video key={o.url} src={o.url} controls autoPlay loop playsInline className="max-h-full max-w-full" />+ pro || failedVideo === o.url ? (+ <div className="aspect-video w-[min(90%,560px)] overflow-hidden rounded-xl">+ <VideoFileCard output={o} format={pro} />+ </div>+ ) : (+ <video key={o.url} src={o.url} controls autoPlay loop playsInline onError={() => setFailedVideo(o.url)} className="max-h-full max-w-full" />+ )) : o.kind === "audio" ? (<audio key={o.url} src={o.url} controls autoPlay className="w-[min(90%,560px)]" />) : o.kind === "text" ? (diff --git a/src/lib/api.ts b/src/lib/api.tsindex 4bf366d4..21ef3528 100644--- a/src/lib/api.ts+++ b/src/lib/api.ts@@ -681,6 +681,27 @@ export function useStatus() {});}+/** What an uploaded clip's header says: length, size, frame rate and sound (empty for formats the server can't read). */+export interface ClipFacts {+ duration?: number;+ width?: number;+ height?: number;+ fps?: number;+ hasAudio?: boolean;+}++/** The attached clip's facts (Upscale hub: prices by its length, "24 → 60 fps"). Only for uploads and results on this server. */+export function useClipFacts(url: string | undefined) {+ return useQuery({+ queryKey: ["clip-facts", url],+ enabled: !!url && url.startsWith("/api/files/"),+ queryFn: async () =>+ json<ClipFacts>(await fetch("/api/media/probe", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ url }) })),+ staleTime: Infinity,+ retry: false,+ });+}+export async function enhance(prompt: string, kind: MediaKind, op: string): Promise<string> {return (await json<{ prompt: string }>(diff --git a/src/lib/composer.ts b/src/lib/composer.tsindex 01ac129f..566a0970 100644--- a/src/lib/composer.ts+++ b/src/lib/composer.ts@@ -3,7 +3,10 @@* blocker messages, attachment placement and model-picker grouping. No catalog import here, so* nothing in this file pulls the model list into the browser bundle.*/-import type { Engine, GenParams, InputSlot, MediaKind, ModelDef, Operation } from "./catalog/types";+import { FORMAT_INFO } from "./av/formats";+import { fpsPlan, fpsSummary } from "./av/fps";+import { targetShortEdge, upscaledSize } from "./av/upscale";+import type { Engine, GenParams, InputSlot, MediaKind, ModelDef, Operation, VideoFormat } from "./catalog/types";// ---------------------------------------------------------------------------// Settings summary ("16:9 · 720p · 5s · ×1")@@ -11,7 +14,7 @@ import type { Engine, GenParams, InputSlot, MediaKind, ModelDef, Operation } fro/** Operations that transform one input into one result — no batch count. */export const SINGLE_TAKE = new Set<Operation>(["lipsync", "avatar", "upscale-video", "upscale-image", "dub", "extend", "reframe", "finalize", "v2a", "interpolate",- "bg-remove", "bg-remove-video", "depth-video", "concat", "color-match", "frame",+ "bg-remove", "bg-remove-video", "depth-video", "concat", "color-match", "frame", "sdr-to-hdr", "export-video",]);export const durationLabel = (v: number) => (v >= 1000 ? `${Math.round(v / 1000)}s` : `${v}s`);@@ -29,6 +32,12 @@ export interface SettingsShape {enhance: boolean;sliders: boolean;negativePrompt: boolean;+ /** Frame rates to reach (FPS Boost, upscalers): `original` adds the clip's own rate as the first choice. */+ fps: { values: number[]; original: boolean } | null;+ /** Slow-motion factors (1 = off). */+ slowdown: number[] | null;+ /** Output formats (SDR to HDR, export): the model's, or every format the studio's models write. */+ formats: VideoFormat[] | null;}/**@@ -37,14 +46,16 @@ export interface SettingsShape {* transforms (Lipsync), there's still no batch count.*/export function settingsShape(- model: Pick<ModelDef, "options"> | undefined,+ model: Pick<ModelDef, "options" | "defaults"> | undefined,op: Operation | undefined,kind: MediaKind,showPrompt: boolean,params: GenParams = {},studioOps: Operation[] = [],+ studioFormats?: VideoFormat[],): SettingsShape {const o = model?.options ?? {};+ const formats = studioFormats?.length ? studioFormats : o.formats;const many = <T,>(xs: T[] | undefined) => (xs && xs.length > 1 ? xs : null);const single = op ? SINGLE_TAKE.has(op) : studioOps.length > 0 && studioOps.every((x) => SINGLE_TAKE.has(x));return {@@ -58,6 +69,9 @@ export function settingsShape(enhance: showPrompt,sliders: !!o.sliders?.length,negativePrompt: !!o.negativePrompt,+ fps: o.fpsTargets?.length ? { values: o.fpsTargets, original: model?.defaults?.targetFps === undefined } : null,+ slowdown: many(o.slowdowns),+ formats: formats && formats.length > 0 ? formats : null,};}@@ -76,10 +90,81 @@ export function settingsSummary(shape: SettingsShape, params: GenParams, model?:if (shape.multiShot && !params.shots && params.multiShot === "auto") parts.push("Multi-shot");if (shape.draft && params.draft) parts.push("Draft");if (shape.audio && params.generateAudio === false) parts.push("No audio");+ if (shape.fps) {+ const fps = params.targetFps ?? d.targetFps;+ if (fps) parts.push(`${fps} fps`);+ else if (!shape.fps.original) parts.push(`${shape.fps.values[0]} fps`);+ }+ if (shape.slowdown && (params.slowdown ?? 1) > 1) parts.push(`${params.slowdown}× slow`);+ if (shape.formats) {+ const f = formatOf(params, model, shape.formats);+ if (f) parts.push(FORMAT_INFO[f]?.short ?? f);+ }if (shape.enhance && params.enhancePrompt) parts.push("Enhance");return parts;}+/** The output format a request writes: the one picked, else the model's default or first, else the studio's first. */+export function formatOf(params: GenParams, model: Pick<ModelDef, "options" | "defaults"> | undefined, studio: VideoFormat[] = []): VideoFormat | undefined {+ return params.format ?? model?.defaults?.format ?? model?.options.formats?.[0] ?? studio[0];+}++// ---------------------------------------------------------------------------+// What a video tool makes of the attached clip (Upscale hub), from its header.++const clipSeconds = (n: number) => (n >= 60 ? `${Math.floor(n / 60)}:${String(Math.round(n % 60)).padStart(2, "0")}` : `${Math.round(n * 10) / 10} s`);+const round2 = (n: number) => Math.round(n * 100) / 100;++/**+ * One line under the clip saying what comes out: "1280×720 → 3840×2160", "24 → 60 fps · 2× slow motion ·+ * 5 s → 10 s", "1920×1080 · 12 s → ProRes 422 HQ (.mov)". Null when the header told nothing (or the tool isn't one of these).+ */+export function clipOutcome(+ op: Operation | undefined,+ facts: { width?: number; height?: number; fps?: number; duration?: number } | undefined,+ params: GenParams,+ model: Pick<ModelDef, "engine" | "options" | "defaults"> | undefined,+): string | null {+ if (!facts || !model) return null;+ const { width, height, fps, duration } = facts;+ const size = width && height ? `${width}×${height}` : "";+ const length = duration ? clipSeconds(duration) : "";+ if (op === "upscale-video") {+ if (!size) return null;+ const res = params.resolution ?? model.defaults?.resolution;+ const target = targetShortEdge(res);+ const short = Math.min(width!, height!);+ const rate = params.targetFps ? ` · ${params.targetFps} fps` : "";+ if (res?.toLowerCase() === "original") return `${size}, cleaned up at its own size${rate}`;+ if (target && target <= short) return `This clip is already ${short}p — pick a higher resolution${model.options.resolutions?.some((r) => r.toLowerCase() === "original") ? ", or Original to only clean it up" : ""}`;+ const out = upscaledSize({ width: width!, height: height! }, res);+ return out ? `${size} → ${out.width}×${out.height}${rate}` : null;+ }+ if (op === "interpolate") {+ const slowdown = Math.max(1, params.slowdown ?? 1);+ const longer = duration && slowdown > 1 ? ` · ${clipSeconds(duration)} → ${clipSeconds(duration * slowdown)}` : "";+ const target = params.targetFps ?? model.defaults?.targetFps;+ // A route with no frame-rate field (hosted RIFE) doubles the frames at the clip's speed.+ if (!model.options.fpsTargets?.length) return fps ? `Twice the frames: ${round2(fps)} → ${round2(fps * 2)} fps` : null;+ if (!target) return null;+ // The open engine reaches the target as source × m / n: say so when this clip's rate doesn't divide into it.+ if (model.engine === "open" && fps) {+ const plan = fpsPlan(fps, target, slowdown);+ if (!plan.exact) return `${round2(fps)} → about ${plan.fps} fps (the nearest this clip's rate allows)${slowdown > 1 ? ` · ${slowdown}× slow motion` : ""}${longer}`;+ }+ return `${fpsSummary(fps, target, slowdown)}${longer}`;+ }+ if (op === "sdr-to-hdr" || op === "export-video") {+ const f = formatOf(params, model);+ const info = f ? FORMAT_INFO[f] : undefined;+ const frames = f === "exr" && duration && fps ? ` (${Math.round(duration * fps)} frames)` : "";+ const head = [size, length].filter(Boolean).join(" · ");+ if (!head) return null;+ return info ? `${head} → ${info.short}${frames}, .${info.ext}` : head;+ }+ return null;+}+/** How many settings differ from their defaults beyond what the summary shows (seed, negative prompt, sliders). */export function hiddenChanges(params: GenParams, negativePrompt: string, model?: Pick<ModelDef, "options">): number {let n = 0;@@ -311,7 +396,7 @@ export function acceptedKinds(slots: InputSlot[], multiRef?: { kind?: MediaKind// Hand-off params ("/video?image=…") arriving after the first paint/** The URL params a studio prefills its draft from; anything else in the query is ignored. */-export const HANDOFF_PARAMS = ["image", "ref", "video", "audio", "prompt", "preset", "model"] as const;+export const HANDOFF_PARAMS = ["image", "ref", "video", "audio", "prompt", "preset", "model", "format"] as const;/** A stable key for the hand-off part of a query string ("" when there's none). */export function handoffKey(search: string | URLSearchParams | null | undefined): string {diff --git a/src/lib/hubs.ts b/src/lib/hubs.tsindex d3da001a..dbe95e74 100644--- a/src/lib/hubs.ts+++ b/src/lib/hubs.ts@@ -1,6 +1,6 @@/*** Studio hubs: Audio, Video tools and Upscale group several studios, one path per mode- * (/audio/music, /video-tools/join, /upscale/video). The hub's own path is its first mode.+ * (/audio/music, /video-tools/join, /upscale/video, /upscale/fps). The hub's own path is its first mode.* Pure data (client and server). Old `/audio?mode=music` links redirect in next.config.ts.*/export type HubKind = "audio" | "video-tools" | "upscale";@@ -9,6 +9,9 @@ export const HUB_MODES: Record<HubKind, { id: string; label: string }[]> = {upscale: [{ id: "image", label: "Image" },{ id: "video", label: "Video" },+ { id: "fps", label: "FPS Boost" },+ { id: "hdr", label: "SDR to HDR" },+ { id: "export", label: "Export" },],audio: [{ id: "speech", label: "Speech" },diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.tsindex 56948458..c2156f4d 100644--- a/src/lib/output-actions.ts+++ b/src/lib/output-actions.ts@@ -5,7 +5,7 @@* placement: "primary" = the labelled pill (Animate / Extend …), "bar" = icon buttons on tiles* (Download, Favorite), "menu" = the ⋯ menu. The viewer shows them all as labelled buttons.*/-import type { Generation, OutputFile } from "./catalog/types";+import type { Generation, OutputFile, VideoFormat } from "./catalog/types";import { cueText, type Cue } from "./cues";import { downloadHref, downloadName, extensionOf } from "./library";@@ -29,6 +29,7 @@ export type OutputActionId =| "download-srt"| "download-vtt"| "download-all"+ | "download-exr"| "favorite"| "finalize"| "compare"@@ -87,15 +88,23 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =link("layers", "Open in Layers", layersHref(g, o.url));out.push({ id: "save-character", label: "Save as character", placement: "menu" });break;- case "video":+ case "video": {link("extend", "Extend", `/extend?video=${q(o.url)}`, "primary");- out.push(file, { id: "favorite", label: g.favorite ? "Unfavorite" : "Favorite", placement: "bar" });+ out.push(file);+ // An HDR or export job's EXR frames ride along on its preview clip (meta.artifacts.exr, a stored zip).+ const exr = (o.meta?.artifacts as Record<string, unknown> | undefined)?.exr;+ if (typeof exr === "string" && exr.startsWith("/api/files/")) {+ const zip = name.replace(/\.[^.]+$/, "-exr.zip");+ out.push({ id: "download-exr", label: "Download EXR frames (.zip)", placement: "bar", href: downloadHref(exr, zip), download: zip });+ }+ out.push({ id: "favorite", label: g.favorite ? "Unfavorite" : "Favorite", placement: "bar" });link("reframe", "Reframe", `/reframe?video=${q(o.url)}`);link("lipsync", "Lipsync", `/lipsync?video=${q(o.url)}`);link("upscale", "Upscale", `/upscale/video?video=${q(o.url)}`);link("add-sound", "Add sound", `/audio/video?video=${q(o.url)}`);link("grade", "Color grade", `/color-grade?video=${q(o.url)}`);break;+ }case "audio":link("lipsync", "Lipsync", `/lipsync?audio=${q(o.url)}`, "primary");out.push(file, { id: "favorite", label: g.favorite ? "Unfavorite" : "Favorite", placement: "bar" });@@ -186,6 +195,20 @@ export function isLayered(g: Pick<Generation, "op" | "outputs">): boolean {return (g.op === "layers" || g.op === "text-layers" || g.outputs.some((o) => !!(o.meta && ("layer" in o.meta || "z" in o.meta)))) && g.outputs.length > 1;}+/**+ * A pro export browsers don't play (ProRes in a .mov, FFV1 in a .mkv): its tile is a file card, not a black+ * player. Judged by the request (an export or HDR job's format) and the file's extension.+ */+export function editOnlyFormat(g: Partial<Pick<Generation, "op" | "request">> | undefined, o: Pick<OutputFile, "url" | "kind">): VideoFormat | undefined {+ if (o.kind !== "video") return undefined;+ const ext = extensionOf(o);+ if (ext === "mkv") return "ffv1";+ const f = g?.request?.params?.format;+ // A demo run's placeholder is a plain .mp4, whatever the format asked for.+ if ((g?.op === "export-video" || g?.op === "sdr-to-hdr") && ext === "mov" && (f === "prores_422_hq" || f === "prores_4444")) return f;+ return undefined;+}+/** A 3D model's still and turntable: meta.poster / meta.preview, meta.video / meta.turntable, or a sibling output. */export function modelPreview(g: Pick<Generation, "outputs">, o: OutputFile): { poster?: string; video?: string } {const m = (o.meta ?? {}) as Record<string, unknown>;diff --git a/src/lib/studios.ts b/src/lib/studios.tsindex 3274b84f..68e76bb0 100644--- a/src/lib/studios.ts+++ b/src/lib/studios.ts@@ -119,13 +119,79 @@ export const UPSCALE_STUDIO: StudioConfig = {defaultModels: { cloud: "topaz-image", open: "oss-upscale-image" },promptOptional: true,hidePrompt: true,+ controlsTitle: "Options",};+/** Upscale → Video: Topaz Video and Starlight, ByteDance (to 8K), FLUX.3, SeedVR2; SeedVR2 or ESRGAN in passes on the open engine. */export const VIDEO_UPSCALE_STUDIO: StudioConfig = {...UPSCALE_STUDIO,kind: "video",+ hero: "Sharper, bigger, cleaner video",+ subtitle: "Upscale a clip to 1080p, 4K or up to 8K, and restore faces, textures and text.",slots: [{ key: "video", label: "Video", accept: "video", required: true }],defaultModels: { cloud: "topaz-video", open: "oss-seedvr2" },+ clipFacts: true,+};++/** Upscale → FPS Boost: frame interpolation to 24–120 fps, or slow motion (Topaz, RIFE / FILM). */+export const FPS_BOOST_STUDIO: StudioConfig = {+ feature: "fps-boost",+ title: "Upscale",+ hero: "Smoother motion, or slow motion",+ subtitle: "New in-between frames take a clip to 24–120 fps, or stretch it up to 8× slower.",+ placeholder: "",+ kind: "video",+ ops: ["interpolate"],+ feed: { features: ["fps-boost"] },+ slots: [{ key: "video", label: "Video", accept: "video", required: true }],+ defaultModels: { cloud: "topaz-fps-boost", open: "oss-rife" },+ promptOptional: true,+ hidePrompt: true,+ clipFacts: true,+ controlsTitle: "Options",+};++/** Upscale → SDR to HDR: Topaz Hyperion (HDR10 H.265, ProRes), LTX (EXR frames), or ComfyUI's tone map (HLG, PQ, EXR). */+export const SDR_TO_HDR_STUDIO: StudioConfig = {+ feature: "sdr-to-hdr",+ title: "Upscale",+ hero: "Take it to HDR",+ subtitle: "Expands SDR footage to 10-bit HDR: an HDR10 video, ProRes for grading, or 16-bit EXR frames for compositing.",+ placeholder: "",+ kind: "video",+ ops: ["sdr-to-hdr"],+ feed: { features: ["sdr-to-hdr"] },+ slots: [{ key: "video", label: "Video", accept: "video", required: true }],+ defaultModels: { cloud: "topaz-sdr-to-hdr", open: "oss-sdr-to-hdr" },+ promptOptional: true,+ hidePrompt: true,+ clipFacts: true,+ formatPicker: true,+ controlsTitle: "Options",+};++/** Upscale → Export: pro codecs written by ComfyUI (no cloud API transcodes a finished clip). */+export const VIDEO_EXPORT_STUDIO: StudioConfig = {+ feature: "export-video",+ title: "Upscale",+ hero: "Export for the edit",+ subtitle: "ProRes 422 HQ or 4444, H.265 10-bit, lossless FFV1 or EXR frames, written by ComfyUI on your machine for free.",+ placeholder: "",+ kind: "video",+ ops: ["export-video"],+ feed: { features: ["export-video"] },+ slots: [{ key: "video", label: "Video", accept: "video", required: true }],+ defaultModels: { cloud: "", open: "oss-export-video" },+ promptOptional: true,+ hidePrompt: true,+ clipFacts: true,+ formatPicker: true,+ controlsTitle: "Options",+ // No cloud API transcodes a finished clip, and the server runs no ffmpeg of its own.+ comfyOnly: {+ note: "Export formats are written by ComfyUI on your own machine, for free, and no ComfyUI is connected. Connect one under Settings → Open-source engine.",+ alternative: { label: "ProRes 422 HQ in the cloud: Topaz SDR to HDR (also converts it to HDR)", href: "/upscale/hdr?model=topaz-sdr-to-hdr&format=prores_422_hq" },+ },};export const AUDIO_STUDIO: StudioConfig = {