Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Per-shot film look tuning, saved looks, 16:9 players; fix repeated frames, intercut over locked shots, and the GPU film look on footage (#11602)
[._.]/cc0c3abf88f5
diff --git a/client/src/components/media/FilmLookControls.jsx b/client/src/components/media/FilmLookControls.jsxindex 739798e625..333420e41d 100644--- a/client/src/components/media/FilmLookControls.jsx+++ b/client/src/components/media/FilmLookControls.jsx@@ -1,7 +1,7 @@import { useId, useState } from 'react';-import { Copy, RotateCcw } from 'lucide-react';+import { Copy, RotateCcw, Save, Trash2 } from 'lucide-react';import {- FILM_LOOK_CONTROLS, FILM_LOOK_GROUPS, FILM_LOOK_PRESETS, describeFilmLook, filmLookPreset, normalizeFilmLook,+ FILM_LOOK_CONTROLS, FILM_LOOK_GROUPS, FILM_LOOK_PRESETS, describeFilmLook, filmLookPreset, isFilmLookNeutral, normalizeFilmLook, sameFilmLook, scaleFilmLook,} from '../../lib/filmLook.js';import { copyToClipboard } from '../../lib/clipboard';@@ -32,6 +32,62 @@ function Slider({ control, value, onChange, onCommit, id }) {);}+const chipCls = (on) => `min-h-[44px] rounded-full border px-3 py-1 sm:min-h-0 ${on ? 'border-port-accent bg-port-accent/20 text-port-accent' : 'border-port-border bg-port-bg text-port-text-muted hover:text-port-text'}`;++// The install's saved looks: tap one to apply it, save the current look under a+// name, or delete the saved look the controls currently match.+function SavedLooks({ look, saved, matched, onApply }) {+ const nameId = useId();+ const [naming, setNaming] = useState(false);+ const [name, setName] = useState('');+ const [confirming, setConfirming] = useState(false);+ const submit = (event) => {+ event.preventDefault();+ if (!name.trim()) return;+ saved.save(name, look);+ setNaming(false);+ setName('');+ };+ if (!saved.loaded) return null;+ return (+ <div className="space-y-1.5">+ {saved.presets.length > 0 && (+ <div className="flex flex-wrap gap-1.5" role="group" aria-label="Your saved looks">+ {saved.presets.map((preset) => (+ <button key={preset.id} type="button" onClick={() => { setConfirming(false); onApply(preset.look); }} aria-pressed={matched?.id === preset.id}+ className={chipCls(matched?.id === preset.id)}>{preset.label}</button>+ ))}+ </div>+ )}+ {naming ? (+ <form onSubmit={submit} className="flex flex-wrap items-center gap-2">+ <label htmlFor={nameId} className="text-port-text-muted">Name</label>+ <input id={nameId} value={name} onChange={(event) => setName(event.target.value)} maxLength={60} autoFocus+ className="min-h-[44px] min-w-0 flex-1 rounded border border-port-border bg-port-bg px-2 sm:min-h-0 sm:py-1" />+ <button type="submit" disabled={!name.trim()} className="min-h-[44px] rounded bg-port-accent px-3 text-port-bg disabled:opacity-50 sm:min-h-0 sm:py-1">Save</button>+ <button type="button" onClick={() => setNaming(false)} className="min-h-[44px] px-2 sm:min-h-0">Cancel</button>+ </form>+ ) : matched ? (+ confirming ? (+ <div className="flex flex-wrap items-center gap-2">+ <span>Delete “{matched.label}”?</span>+ <button type="button" onClick={() => { saved.remove(matched.id); setConfirming(false); }} className="min-h-[44px] px-2 text-port-error sm:min-h-0">Delete</button>+ <button type="button" onClick={() => setConfirming(false)} className="min-h-[44px] px-2 sm:min-h-0">Keep</button>+ </div>+ ) : (+ <button type="button" onClick={() => setConfirming(true)} className="inline-flex min-h-[44px] items-center gap-1 px-1 text-port-text-muted hover:text-port-text sm:min-h-0">+ <Trash2 size={12} aria-hidden="true" /> Delete saved look+ </button>+ )+ ) : !isFilmLookNeutral(look) && (+ <button type="button" onClick={() => { setName(''); setNaming(true); }} className="inline-flex min-h-[44px] items-center gap-1 px-1 text-port-accent sm:min-h-0">+ <Save size={12} aria-hidden="true" /> Save as preset+ </button>+ )}+ </div>+ );+}+/*** The film look's controls: preset chips, then every slider, color and toggle* grouped the way a colorist thinks (focus & glow, color, texture, frame).@@ -42,19 +98,34 @@ function Slider({ control, value, onChange, onCommit, id }) {* `onChange(look)` fires on every slider move (for a live preview);* `onCommit(look)` fires when a control is released (to save). Both receive the* whole normalized look. Controlled: `look` is the current value (null = clean).+ * `saved` (from `useFilmLookPresets`) adds the install's saved looks and the+ * Save as preset action.*/-export default function FilmLookControls({ look: given, onChange, onCommit, compact = false }) {+export default function FilmLookControls({ look: given, onChange, onCommit, compact = false, saved = null }) {const look = normalizeFilmLook(given) || filmLookPreset('none');const base = useId();+ // Strength scales the look as it stood after the last preset pick or control+ // edit (its anchor), so dragging it back to 100% restores that look exactly.+ const [anchor, setAnchor] = useState(() => ({ look, amount: 1 }));+ const anchored = sameFilmLook(scaleFilmLook(anchor.look, anchor.amount), look) ? anchor : { look, amount: 1 };const [openGroups, setOpenGroups] = useState(() => new Set(compact ? [] : FILM_LOOK_GROUPS.map((group) => group.id)));const set = (patch, { commit = true } = {}) => {const next = normalizeFilmLook({ ...look, ...patch, preset: 'custom' });+ setAnchor({ look: next, amount: 1 });onChange?.(next);if (commit) onCommit?.(next);};const live = (patch) => set(patch, { commit: false });const commit = () => onCommit?.(look);- const applyPreset = (id) => { const next = filmLookPreset(id); onChange?.(next); onCommit?.(next); };+ const applyLook = (next) => { setAnchor({ look: next, amount: 1 }); onChange?.(next); onCommit?.(next); };+ const strengthId = `${base}-strength`;+ const setStrength = (amount) => {+ const next = amount === 1 ? anchored.look : { ...scaleFilmLook(anchored.look, amount), preset: 'custom' };+ setAnchor({ look: anchored.look, amount });+ onChange?.(next);+ };+ const applyPreset = (id) => applyLook(filmLookPreset(id));+ const matched = saved?.presets.find((preset) => sameFilmLook(preset.look, look)) || null;const words = describeFilmLook(look);const toggleGroup = (id) => setOpenGroups((current) => {const next = new Set(current);@@ -73,13 +144,26 @@ export default function FilmLookControls({ look: given, onChange, onCommit, comp<div className="flex flex-wrap gap-1.5" role="group" aria-label="Film look presets">{FILM_LOOK_PRESETS.filter((preset) => preset.id !== 'none').map((preset) => (<button key={preset.id} type="button" onClick={() => applyPreset(preset.id)} title={preset.summary} aria-pressed={look.preset === preset.id}- className={`min-h-[44px] rounded-full border px-3 py-1 sm:min-h-0 ${look.preset === preset.id ? 'border-port-accent bg-port-accent/20 text-port-accent' : 'border-port-border bg-port-bg text-port-text-muted hover:text-port-text'}`}>+ className={chipCls(look.preset === preset.id)}>{preset.label}</button>))}</div>- {look.preset !== 'none' && <p className="mt-1 text-port-text-muted">{FILM_LOOK_PRESETS.find((preset) => preset.id === look.preset)?.summary || 'A custom look. Save it to keep it on this project.'}</p>}+ {look.preset !== 'none' && !matched && <p className="mt-1 text-port-text-muted">{FILM_LOOK_PRESETS.find((preset) => preset.id === look.preset)?.summary || 'A custom look.'}</p>}</div>+ {!isFilmLookNeutral(anchored.look) && (+ <div className="space-y-0.5">+ <div className="flex items-baseline justify-between gap-2">+ <label htmlFor={strengthId} className="text-port-text">Strength <span className="ml-1.5 text-port-text-muted">the whole look, lighter</span></label>+ <span className="tabular-nums text-port-text-muted">{Math.round(anchored.amount * 100)}%</span>+ </div>+ <input id={strengthId} type="range" min={0} max={1} step={0.05} value={anchored.amount}+ onChange={(event) => setStrength(Number(event.target.value))}+ onPointerUp={commit} onKeyUp={commit} onBlur={commit}+ className="block h-6 w-full accent-port-accent" />+ </div>+ )}+ {saved && <SavedLooks look={look} saved={saved} matched={matched} onApply={(value) => applyLook(normalizeFilmLook({ ...value, preset: 'custom' }))} />}{FILM_LOOK_GROUPS.map((group) => {const controls = groupControls(group.id).filter((control) => shown(control, look));diff --git a/client/src/components/media/FilmLookEditor.jsx b/client/src/components/media/FilmLookEditor.jsxindex 2e30fd54ea..1bb696590d 100644--- a/client/src/components/media/FilmLookEditor.jsx+++ b/client/src/components/media/FilmLookEditor.jsx@@ -4,6 +4,7 @@ import Modal from '../ui/Modal';import toast from '../ui/Toast';import FilmLookControls from './FilmLookControls.jsx';import FilmLookPreview from './FilmLookPreview.jsx';+import useFilmLookPresets from '../../hooks/useFilmLookPresets.js';import { applyImageFilmLook } from '../../services/apiImageVideo';import { filmLookPreset, isFilmLookNeutral, normalizeFilmLook } from '../../lib/filmLook.js';@@ -21,6 +22,7 @@ export default function FilmLookEditor({ item, open, onClose, onComplete, projecconst start = () => normalizeFilmLook(projectLook?.look) || normalizeFilmLook(item?.filmLook) || filmLookPreset('none');const [look, setLook] = useState(start);const [saving, setSaving] = useState(false);+ const saved = useFilmLookPresets();const [savingProject, setSavingProject] = useState(false);// A different image (or a reopen) starts over from the project's look, never from the last session's sliders.useEffect(() => { if (open) setLook(start()); }, [open, item?.key]); // eslint-disable-line react-hooks/exhaustive-deps@@ -65,7 +67,7 @@ export default function FilmLookEditor({ item, open, onClose, onComplete, projec</div><div className="flex min-h-0 w-full flex-col border-t border-port-border md:w-96 md:border-l md:border-t-0"><div className="min-h-0 flex-1 overflow-y-auto p-3">- <FilmLookControls look={look} onChange={setLook} />+ <FilmLookControls look={look} onChange={setLook} saved={saved} /></div><div className="flex flex-wrap gap-2 border-t border-port-border p-2"><button type="button" onClick={saveCopy} disabled={saving || neutral} title={neutral ? 'Move a control first' : 'Render this look into a new image; the original stays as it is'}diff --git a/client/src/components/media/MediaLightboxOrganization.test.jsx b/client/src/components/media/MediaLightboxOrganization.test.jsxindex 34dd8a9538..55246d5c0f 100644--- a/client/src/components/media/MediaLightboxOrganization.test.jsx+++ b/client/src/components/media/MediaLightboxOrganization.test.jsx@@ -7,6 +7,7 @@ import BulkTargetPicker from './BulkTargetPicker';// Keep the actual lightbox and organization pickers together: mocking those// children hid the portal's interaction with the viewer's focus/Escape trap.+vi.mock('../../hooks/useFilmLookPresets.js', () => ({ default: () => ({ presets: [], loaded: true, save: vi.fn(), remove: vi.fn() }) }));vi.mock('./PromptRefineModal', () => ({ default: () => null }));vi.mock('./PromptFromMedia', () => ({ PromptFromMediaModal: () => null }));const api = vi.hoisted(() => ({diff --git a/client/src/components/musicVideo/CompositionPanel.jsx b/client/src/components/musicVideo/CompositionPanel.jsxindex 401ab300f0..ed0638fef8 100644--- a/client/src/components/musicVideo/CompositionPanel.jsx+++ b/client/src/components/musicVideo/CompositionPanel.jsx@@ -35,7 +35,7 @@ export default function CompositionPanel({ board }) {</p>)}<GradePanel project={project} onSave={board.saveCompositionGrade} />- <FilmLookPanel project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />+ <FilmLookPanel project={project} activeSceneId={board.activeSceneId} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />{mode !== 'eidoverse' && <TypographyPanel project={project} onEditLocal={board.editProjectLocal} onSave={board.saveProjectFields} />}{mode === 'eidoverse' && <EidoverseVideoPanel key={project.id} project={project} onProject={board.replaceProject} productionReadiness={board.productionReadiness} />}{mode === 'code' && (diff --git a/client/src/components/musicVideo/FilmLookPanel.jsx b/client/src/components/musicVideo/FilmLookPanel.jsxindex 81e3a2bb1f..37795294f0 100644--- a/client/src/components/musicVideo/FilmLookPanel.jsx+++ b/client/src/components/musicVideo/FilmLookPanel.jsx@@ -1,7 +1,35 @@+import { useId, useState } from 'react';import { Aperture } from 'lucide-react';import FilmLookControls from '../media/FilmLookControls.jsx';+import FilmLookPreview from '../media/FilmLookPreview.jsx';+import useFilmLookPresets from '../../hooks/useFilmLookPresets.js';import { isFilmLookNeutral } from '../../lib/filmLook.js';+// The look on one shot's still, right above the sliders: a single SVG filter+// evaluation per change, which a phone can afford where a playing video can't.+function ShotSample({ project, activeSceneId }) {+ const selectId = useId();+ const shots = (project.scenes || []).map((scene, index) => ({ scene, number: index + 1 })).filter(({ scene }) => scene.referenceImageId);+ const [pickedId, setPickedId] = useState(null);+ if (!shots.length) return null;+ const sample = shots.find(({ scene }) => scene.sceneId === (pickedId || activeSceneId)) || shots[0];+ return (+ <div className="sticky top-0 z-10 space-y-1 bg-port-card pb-1">+ <div className="flex items-center gap-2 text-xs">+ <label htmlFor={selectId} className="text-port-text-muted">Sample</label>+ <select id={selectId} value={sample.scene.sceneId} onChange={(event) => setPickedId(event.target.value)}+ className="min-h-[44px] min-w-0 flex-1 rounded border border-port-border bg-port-bg px-2 py-1 sm:min-h-0">+ {shots.map(({ scene, number }) => (+ <option key={scene.sceneId} value={scene.sceneId}>Shot {number}{scene.sectionLabel ? ` · ${scene.sectionLabel}` : ''}</option>+ ))}+ </select>+ </div>+ <FilmLookPreview src={`/data/images/${sample.scene.referenceImageId}`} alt={`Shot ${sample.number}`} look={project.filmLook}+ className="flex items-center justify-center overflow-hidden rounded bg-black [&_img]:max-h-[30dvh]" />+ </div>+ );+}+/*** The project's finishing film look: the filter the docked preview (the* composition document or the storyboard animatic) and the final render are@@ -11,7 +39,8 @@ import { isFilmLookNeutral } from '../../lib/filmLook.js';* filter, a footage render gets it as a finishing pass over the finished cut,* and a still is baked only from Film look in the image viewer.*/-export default function FilmLookPanel({ project, onEditLocal, onSave }) {+export default function FilmLookPanel({ project, activeSceneId = null, onEditLocal, onSave }) {+ const saved = useFilmLookPresets();const documentMode = project.composition?.mode === 'document';const on = !isFilmLookNeutral(project.filmLook);return (@@ -23,7 +52,8 @@ export default function FilmLookPanel({ project, onEditLocal, onSave }) {{!documentMode && (<p className="text-xs text-port-text-muted">Applied as a finishing pass after the cut is encoded, so the clips themselves never change; the animatic shows it live.</p>)}- <FilmLookControls look={project.filmLook} compact+ <ShotSample project={project} activeSceneId={activeSceneId} />+ <FilmLookControls look={project.filmLook} compact saved={saved}onChange={(look) => onEditLocal({ filmLook: look })}onCommit={(look) => onSave({ filmLook: isFilmLookNeutral(look) ? null : look })} /></section>diff --git a/client/src/components/musicVideo/FilmLookPanel.test.jsx b/client/src/components/musicVideo/FilmLookPanel.test.jsxnew file mode 100644index 0000000000..366ae9c4ed--- /dev/null+++ b/client/src/components/musicVideo/FilmLookPanel.test.jsx@@ -0,0 +1,93 @@+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { useState } from 'react';+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';+import FilmLookPanel from './FilmLookPanel.jsx';+import { filmLookPreset } from '../../lib/filmLook.js';+import { resetFilmLookPresetsCache } from '../../hooks/useFilmLookPresets.js';++const api = vi.hoisted(() => ({ getSettings: vi.fn(), updateSettings: vi.fn() }));+vi.mock('../../services/apiSystem.js', () => api);++const scenes = [+ { sceneId: 'a', referenceImageId: 'a.png', sectionLabel: 'Intro' },+ { sceneId: 'b', referenceImageId: 'b.png', sectionLabel: 'Verse' },+ { sceneId: 'c' },+];++function Harness({ look = null, activeSceneId = null }) {+ const [project, setProject] = useState({ id: 'mv-example', scenes, filmLook: look });+ const apply = (patch) => setProject((current) => ({ ...current, ...patch }));+ return <FilmLookPanel project={project} activeSceneId={activeSceneId} onEditLocal={apply} onSave={apply} />;+}++beforeEach(() => {+ resetFilmLookPresetsCache();+ api.getSettings.mockReset().mockResolvedValue({ filmLookPresets: [] });+ api.updateSettings.mockReset().mockResolvedValue({});+});+afterEach(cleanup);++it('previews the look on the selected shot still, and on any other shot picked from the sample list', async () => {+ render(<Harness look={filmLookPreset('polaroid')} activeSceneId="b" />);+ const sample = screen.getByLabelText('Sample');+ expect(sample).toHaveValue('b');+ // Shots without a still cannot be sampled.+ expect(within(sample).getAllByRole('option').map((option) => option.textContent)).toEqual(['Shot 1 · Intro', 'Shot 2 · Verse']);+ expect(screen.getByTestId('film-look-image')).toHaveAttribute('src', '/data/images/b.png');+ fireEvent.change(sample, { target: { value: 'a' } });+ expect(screen.getByTestId('film-look-image')).toHaveAttribute('src', '/data/images/a.png');+ await act(async () => {});+});++it('saves the current look under a name, reapplies it from its chip, and deletes it', async () => {+ const custom = { ...filmLookPreset('polaroid'), preset: 'custom', warmth: 0.5 };+ render(<Harness look={custom} />);+ await waitFor(() => expect(api.getSettings).toHaveBeenCalledTimes(1));+ fireEvent.click(screen.getByRole('button', { name: 'Save as preset' }));+ fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Warm dusk' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(api.updateSettings).toHaveBeenCalledTimes(1));+ const [saved] = api.updateSettings.mock.calls[0][0].filmLookPresets;+ expect(saved).toMatchObject({ label: 'Warm dusk', look: { preset: 'custom', warmth: 0.5 } });+ expect(screen.getByRole('button', { name: 'Warm dusk' })).toHaveAttribute('aria-pressed', 'true');++ fireEvent.click(screen.getByRole('button', { name: 'VHS' }));+ expect(screen.getByRole('button', { name: 'Warm dusk' })).toHaveAttribute('aria-pressed', 'false');+ fireEvent.click(screen.getByRole('button', { name: 'Warm dusk' }));+ expect(screen.getByRole('button', { name: 'Warm dusk' })).toHaveAttribute('aria-pressed', 'true');++ fireEvent.click(screen.getByRole('button', { name: 'Delete saved look' }));+ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));+ await waitFor(() => expect(api.updateSettings).toHaveBeenCalledTimes(2));+ expect(api.updateSettings.mock.calls[1][0]).toEqual({ filmLookPresets: [] });+ expect(screen.queryByRole('button', { name: 'Warm dusk' })).not.toBeInTheDocument();+});++it('puts the list back when the save is refused', async () => {+ api.updateSettings.mockRejectedValueOnce(new Error('Refused'));+ render(<Harness look={{ ...filmLookPreset('vhs'), preset: 'custom' }} />);+ await waitFor(() => expect(api.getSettings).toHaveBeenCalled());+ fireEvent.click(screen.getByRole('button', { name: 'Save as preset' }));+ fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Tape' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(screen.queryByRole('button', { name: 'Tape' })).not.toBeInTheDocument());+ expect(screen.getByRole('button', { name: 'Save as preset' })).toBeInTheDocument();+});++it('offers no save until the saved looks have been read, so a save never replaces looks it never saw', async () => {+ const kept = { id: 'kept-1', label: 'Kept', look: { ...filmLookPreset('polaroid'), preset: 'custom' } };+ api.getSettings.mockRejectedValueOnce(new Error('Offline')).mockResolvedValue({ filmLookPresets: [kept] });+ const first = render(<Harness look={{ ...filmLookPreset('vhs'), preset: 'custom' }} />);+ await waitFor(() => expect(api.getSettings).toHaveBeenCalledTimes(1));+ await act(async () => {});+ expect(screen.queryByRole('button', { name: 'Save as preset' })).not.toBeInTheDocument();+ first.unmount();++ // The next panel to open reads the list again and saves on top of it.+ render(<Harness look={{ ...filmLookPreset('vhs'), preset: 'custom' }} />);+ fireEvent.click(await screen.findByRole('button', { name: 'Save as preset' }));+ fireEvent.change(screen.getByLabelText('Name'), { target: { value: 'Tape' } });+ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(api.updateSettings).toHaveBeenCalledTimes(1));+ expect(api.updateSettings.mock.calls[0][0].filmLookPresets.map((preset) => preset.label)).toEqual(['Kept', 'Tape']);+});diff --git a/client/src/components/musicVideo/PreviewDock.jsx b/client/src/components/musicVideo/PreviewDock.jsxindex ebd77a7a43..ffc224b848 100644--- a/client/src/components/musicVideo/PreviewDock.jsx+++ b/client/src/components/musicVideo/PreviewDock.jsx@@ -39,6 +39,8 @@ function VideoPreview({ source, scenes, projectName, seekRequest, collapsed, onE};return (<div className={`space-y-2 ${collapsed ? 'max-xl:hidden' : ''}`}>+ {/* The height limit caps the width, not the height alone: a capped height+ over a full-width box made it wider than 16:9 and pillarboxed the video. */}<videoref={videoRef}src={source.src}@@ -50,7 +52,7 @@ function VideoPreview({ source, scenes, projectName, seekRequest, collapsed, onEonSeeked={(e) => setTime(e.currentTarget.currentTime)}onLoadedData={(e) => setDuration(e.currentTarget.duration)}aria-label={source.id === 'final' ? 'Final render preview' : 'Draft excerpt preview'}- className="aspect-video max-h-[50vh] w-full rounded border border-port-border bg-black object-contain"+ className="mx-auto block aspect-video w-full max-w-[calc(50vh*16/9)] rounded border border-port-border bg-black object-contain"/><ShotStepperscenes={scenes}diff --git a/client/src/components/musicVideo/RenderStatusPanel.jsx b/client/src/components/musicVideo/RenderStatusPanel.jsxindex e6d01d7a54..8d87ff91eb 100644--- a/client/src/components/musicVideo/RenderStatusPanel.jsx+++ b/client/src/components/musicVideo/RenderStatusPanel.jsx@@ -72,7 +72,7 @@ export default function RenderStatusPanel({controlsplaysInlinepreload="metadata"- className="w-full aspect-video max-h-[65vh] object-contain rounded bg-black border border-port-border"+ className="mx-auto block w-full aspect-video max-w-[calc(65vh*16/9)] object-contain rounded bg-black border border-port-border"aria-label="Play final music video"/><buttondiff --git a/client/src/components/musicVideo/SceneCard.test.jsx b/client/src/components/musicVideo/SceneCard.test.jsxindex e0e0e38735..9e70d38a05 100644--- a/client/src/components/musicVideo/SceneCard.test.jsx+++ b/client/src/components/musicVideo/SceneCard.test.jsx@@ -1,6 +1,7 @@import { useState } from 'react';import { beforeEach, describe, expect, it, vi } from 'vitest';import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';+vi.mock('../../hooks/useFilmLookPresets.js', () => ({ default: () => ({ presets: [], loaded: true, save: vi.fn(), remove: vi.fn() }) }));vi.mock('../../hooks/useVideoFileSrc.js', () => ({ useVideoFileSrc: vi.fn(() => ({})) }));vi.mock('../../services/apiMusicVideo.js', async (importOriginal) => ({ ...(await importOriginal()), getMusicVideoMediaPool: vi.fn(async () => ({ items: [] })) }));import SceneCard from './SceneCard.jsx';diff --git a/client/src/components/musicVideo/ShotFinalRender.jsx b/client/src/components/musicVideo/ShotFinalRender.jsxindex 0e0757fe23..45117f1e31 100644--- a/client/src/components/musicVideo/ShotFinalRender.jsx+++ b/client/src/components/musicVideo/ShotFinalRender.jsx@@ -1,8 +1,11 @@import { useEffect, useState } from 'react';-import { Activity, Film, Play, Square, X } from 'lucide-react';+import { Activity, Film, Play, SlidersHorizontal, Square, X } from 'lucide-react';+import FilmLookControls from '../media/FilmLookControls.jsx';+import FilmLookPreview from '../media/FilmLookPreview.jsx';import { cancelMusicVideoShotRender, musicVideoShotRenderUrl, renderMusicVideoShot } from '../../services/apiMusicVideo.js';import useMusicVideoShotRenders from '../../hooks/useMusicVideoShotRenders.js';-import { FILM_LOOK_PRESETS, filmLookPreset, isFilmLookNeutral, normalizeFilmLook } from '../../lib/filmLook.js';+import useFilmLookPresets from '../../hooks/useFilmLookPresets.js';+import { FILM_LOOK_PRESETS, filmLookPreset, isFilmLookNeutral, normalizeFilmLook, sameFilmLook } from '../../lib/filmLook.js';const BUTTON = 'inline-flex min-h-[44px] items-center gap-1 rounded border border-port-border bg-port-bg px-2 py-1.5 text-xs hover:bg-port-border/40 disabled:opacity-50 sm:min-h-0';const presetLabel = (look) => (isFilmLookNeutral(look) ? 'Clean' : FILM_LOOK_PRESETS.find((p) => p.id === look?.preset)?.label || 'Custom');@@ -20,8 +23,11 @@ export default function ShotFinalRender({ project, scene, onChange, fieldId }) {const live = liveByShot[sceneId] || null;const [playing, setPlaying] = useState(false);const [starting, setStarting] = useState(false);+ const saved = useFilmLookPresets();+ const savedLooks = saved.presets;+ const [tuning, setTuning] = useState(null); // the look being tuned, or null when closed- useEffect(() => { setPlaying(false); }, [sceneId]);+ useEffect(() => { setPlaying(false); setTuning(null); }, [sceneId]);if (!status?.available) return null;const shot = status.shots.find((entry) => entry.sceneId === sceneId);@@ -30,7 +36,9 @@ export default function ShotFinalRender({ project, scene, onChange, fieldId }) {const file = rendered ? shot.files[shot.files.length - 1] : null;const ownLook = scene.filmLook ? normalizeFilmLook(scene.filmLook) : null;const videoLook = normalizeFilmLook(project.filmLook);- const lookValue = ownLook ? (FILM_LOOK_PRESETS.some((p) => p.id === ownLook.preset) ? ownLook.preset : 'own') : 'video';+ const savedMatch = ownLook && !FILM_LOOK_PRESETS.some((p) => p.id === ownLook.preset)+ ? savedLooks.find((preset) => sameFilmLook(preset.look, ownLook)) : null;+ const lookValue = ownLook ? (FILM_LOOK_PRESETS.some((p) => p.id === ownLook.preset) ? ownLook.preset : savedMatch ? `saved:${savedMatch.id}` : 'own') : 'video';const start = () => {setStarting(true);@@ -42,9 +50,13 @@ export default function ShotFinalRender({ project, scene, onChange, fieldId }) {};const pickLook = (value) => {setPlaying(false);+ setTuning(null);if (value === 'video') onChange({ filmLook: null });else if (value === 'keep') onChange({ filmLook: videoLook || filmLookPreset('none') });- else if (value !== 'own') onChange({ filmLook: filmLookPreset(value) });+ else if (value.startsWith('saved:')) {+ const preset = savedLooks.find((entry) => `saved:${entry.id}` === value);+ if (preset) onChange({ filmLook: normalizeFilmLook({ ...preset.look, preset: 'custom' }) });+ } else if (value !== 'own') onChange({ filmLook: filmLookPreset(value) });};const state = status.error ? null : rendering ? (live ? `Rendering ${Math.round((live.progress || 0) * 100)}%` : 'Rendering') : rendered ? 'Rendered' : shot ? 'Not rendered' : 'Not in the cut';@@ -88,8 +100,30 @@ export default function ShotFinalRender({ project, scene, onChange, fieldId }) {{!ownLook && <option value="keep">Keep the video's look on this shot</option>}{lookValue === 'own' && <option value="own">This shot's look ({presetLabel(ownLook)})</option>}{FILM_LOOK_PRESETS.map((preset) => <option key={preset.id} value={preset.id}>{preset.label}</option>)}+ {savedLooks.length > 0 && (+ <optgroup label="Your looks">+ {savedLooks.map((preset) => <option key={preset.id} value={`saved:${preset.id}`}>{preset.label}</option>)}+ </optgroup>+ )}</select>+ <button type="button" className={BUTTON} aria-expanded={!!tuning}+ onClick={() => setTuning((open) => (open ? null : ownLook || videoLook || filmLookPreset('none')))}>+ <SlidersHorizontal size={12} aria-hidden="true" /> {tuning ? 'Done' : 'Tune'}+ </button></div>+ {tuning && (+ // This shot's own look, slider by slider, on its still: subtle fixes+ // (a little haze on one clean shot) without a whole preset.+ <div className="space-y-2" aria-label="Tune this shot's look" role="group">+ {scene.referenceImageId && (+ <FilmLookPreview src={`/data/images/${scene.referenceImageId}`} alt="This shot" look={tuning}+ className="flex items-center justify-center overflow-hidden rounded bg-black [&_img]:max-h-[30dvh]" />+ )}+ <FilmLookControls look={tuning} compact saved={saved}+ onChange={setTuning}+ onCommit={(look) => { setTuning(look); onChange({ filmLook: look }); }} />+ </div>+ )}</section>);}diff --git a/client/src/components/musicVideo/ShotFinalRender.test.jsx b/client/src/components/musicVideo/ShotFinalRender.test.jsxindex 314e0d3f51..14a3486b8d 100644--- a/client/src/components/musicVideo/ShotFinalRender.test.jsx+++ b/client/src/components/musicVideo/ShotFinalRender.test.jsx@@ -2,6 +2,8 @@ import { describe, expect, it, vi, beforeEach } from 'vitest';import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';const handlers = new Map();+const savedLooks = vi.hoisted(() => []);+vi.mock('../../hooks/useFilmLookPresets.js', () => ({ default: () => ({ presets: savedLooks, loaded: true, save: vi.fn(), remove: vi.fn() }) }));vi.mock('../../services/socket', () => ({default: { on: vi.fn((event, fn) => handlers.set(event, fn)), off: vi.fn((event) => handlers.delete(event)) },}));@@ -13,6 +15,7 @@ vi.mock('../../services/apiMusicVideo.js', () => ({}));import ShotFinalRender from './ShotFinalRender.jsx';+import { filmLookPreset } from '../../lib/filmLook.js';import { getMusicVideoShotRenders, renderMusicVideoShot } from '../../services/apiMusicVideo.js';const project = { id: 'mv-1', composition: { mode: 'composed' }, filmLook: { preset: 'vhs' }, scenes: [{ sceneId: 'a' }, { sceneId: 'b' }] };@@ -21,6 +24,7 @@ const shot = (sceneId, state, files = []) => ({ sceneId, state, rendering: falsebeforeEach(() => {vi.clearAllMocks();+ savedLooks.length = 0;handlers.clear();});@@ -55,6 +59,36 @@ describe('ShotFinalRender', () => {expect(onChange).toHaveBeenLastCalledWith({ filmLook: null });});+ it('offers the saved looks, sets one on the shot, and shows it as picked', async () => {+ savedLooks.push({ id: 'dusk-1', label: 'Dusk', look: { preset: 'custom', warmth: 0.4, grain: 0.2 } });+ getMusicVideoShotRenders.mockResolvedValue({ available: true, shots: [shot('a', 'rendered', ['a.mp4'])], ready: 1, total: 1 });+ const onChange = vi.fn();+ const { rerender } = render(<ShotFinalRender project={project} scene={project.scenes[0]} onChange={onChange} fieldId={fieldId} />);+ fireEvent.change(await screen.findByLabelText('Film look'), { target: { value: 'saved:dusk-1' } });+ const look = onChange.mock.calls[0][0].filmLook;+ expect(look).toMatchObject({ preset: 'custom', warmth: 0.4, grain: 0.2 });+ rerender(<ShotFinalRender project={project} scene={{ sceneId: 'a', filmLook: look }} onChange={onChange} fieldId={fieldId} />);+ expect(screen.getByLabelText('Film look').value).toBe('saved:dusk-1');+ });++ it("tunes this shot's own look from the video's look, down to a lighter strength", async () => {+ getMusicVideoShotRenders.mockResolvedValue({ available: true, shots: [shot('a', 'rendered', ['a.mp4'])], ready: 1, total: 1 });+ const onChange = vi.fn();+ render(<ShotFinalRender project={{ ...project, filmLook: filmLookPreset('vhs') }} scene={{ sceneId: 'a', referenceImageId: 'a.png' }} onChange={onChange} fieldId={fieldId} />);+ fireEvent.click(await screen.findByRole('button', { name: 'Tune' }));+ expect(screen.getByTestId('film-look-image')).toHaveAttribute('src', '/data/images/a.png');+ const strength = screen.getByLabelText(/Strength/);+ fireEvent.change(strength, { target: { value: '0.2' } });+ expect(onChange).not.toHaveBeenCalled();+ fireEvent.pointerUp(strength);+ const look = onChange.mock.calls[0][0].filmLook;+ // VHS at a fifth: effects scale down, the shaping values stay.+ expect(look).toMatchObject({ preset: 'custom', bleed: 0.16, tapeNoise: 0.1, grainSize: 0.2, grainColor: true });+ fireEvent.change(strength, { target: { value: '1' } });+ fireEvent.pointerUp(strength);+ expect(onChange.mock.calls[1][0].filmLook).toMatchObject({ preset: 'vhs', bleed: 0.8 });+ });+it('names the refusal when the cut cannot be planned, and stays away from other render styles', async () => {getMusicVideoShotRenders.mockResolvedValue({ available: true, error: { message: 'Shot 3: the selected clip file is missing' }, shots: [] });const { unmount } = render(<ShotFinalRender project={project} scene={project.scenes[0]} onChange={() => {}} fieldId={fieldId} />);diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 19e05c56ab..86ea672423 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -139,6 +139,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `useLocalLlmStatus` | `{ status, loading, selected, setSelected, loadStatus, runAction, installBackend, actionInProgress, busy, progressMsg, setProgressMsg, confirmAction, setConfirmAction }` — the installed-model status both local-LLM views read, the single `localLlm:progress` subscription, and the one busy/toast/refresh path every action routes through. Takes stable `onRefresh` (extra loads on a status refresh) and `onReload` (extra reload after an action or `complete` frame) callbacks. | `LocalLlmRuntimesView` / `LocalLlmLibraryView` — they never mount together, so the mounted one is the only subscriber. || `useDownloadPreflightConfirm` | `{ confirm, request({ title, preview, run }), cancel, confirmRun }` — shows a loading modal, resolves a disk-preflight assessment, and holds `run` until confirmed. | Any weight/LoRA download confirm step — pair with `<DownloadPreflightConfirm>`. || `useFieldDraft` | Local input draft that commits on blur. | Bible-editor-style single-field input that must dedupe sibling races. |+| `useFilmLookPresets` | `{ presets, save(label, look), remove(id) }` — the install's saved film looks (`settings.filmLookPresets`), loaded once and shared by every caller on the page. | Film look controls, the per-shot look picker. || `useStoryImportIntake` | Story Builder "Import a finished work" intake: the form fields plus the analyze → commit → create-session workflow, in one `{ ...state, patch, analyze, retryIssues, importAndBuild }` bag. | Call from the always-mounted Story Builder index and pass down as `intake` — holding this in the panel loses the manuscript and analysis on an intake tab flip (#3904). || `useRowDraft` | Multi-column row draft (analogue of `useFieldDraft`). | Multi-column row that commits as a unit. || `usePendingListRows` | List-of-rows where a new row is held client-side until a required column fills, then promoted to `onChange`. | Editable list whose nameless rows would otherwise be dropped by the server sanitizer (WardrobeSection, CharacterDetailEditor list sections). |diff --git a/client/src/hooks/index.js b/client/src/hooks/index.jsindex 38990f93d2..72f74a4eb8 100644--- a/client/src/hooks/index.js+++ b/client/src/hooks/index.js@@ -27,6 +27,7 @@ export { default as useContainerWidth } from './useContainerWidth.js';export { default as useDragToPan } from './useDragToPan.js';export { default as useEscapeKey } from './useEscapeKey.js';export { default as useFieldDraft } from './useFieldDraft.js';+export { default as useFilmLookPresets } from './useFilmLookPresets.js';export { default as useFableLoomAiRun } from './useFableLoomAiRun.js';export { default as useFocusTrap } from './useFocusTrap.js';export { default as useGallerySidecars } from './useGallerySidecars.js';diff --git a/client/src/hooks/useFilmLookPresets.js b/client/src/hooks/useFilmLookPresets.jsnew file mode 100644index 0000000000..a050a39d8e--- /dev/null+++ b/client/src/hooks/useFilmLookPresets.js@@ -0,0 +1,91 @@+import { useCallback, useEffect, useState } from 'react';+import { getSettings, updateSettings } from '../services/apiSystem.js';+import { normalizeFilmLook } from '../lib/filmLook.js';+import toast from '../components/ui/Toast';++// One copy per page: every Film look panel, shot picker and gallery editor reads+// the same list, so a look saved in one shows in the others at once and the+// settings are fetched once, not once per shot card.+let presets = null; // null = not loaded yet (or the load failed: a later mount retries)+let confirmed = null; // the list the server last accepted+let loading = null;+let writeTail = Promise.resolve();+let generation = 0;+let refusedThrough = 0;+const listeners = new Set();++const publish = (next) => {+ presets = next;+ listeners.forEach((listener) => listener(next));+};++const load = () => {+ loading ||= getSettings({ silent: true })+ .then((settings) => {+ confirmed = Array.isArray(settings?.filmLookPresets) ? settings.filmLookPresets : [];+ publish(confirmed);+ })+ .catch(() => { loading = null; });+ return loading;+};++// Each write sends the whole list (settings merge top-level keys), so writes go+// out in order and only after a successful load. A refused write puts back the+// list the server holds and drops the writes queued behind it, which were built+// on the refused one.+const persist = (next) => {+ const gen = ++generation;+ publish(next);+ writeTail = writeTail.then(() => {+ if (gen <= refusedThrough) return;+ return updateSettings({ filmLookPresets: next }, { silent: true }).then(+ () => { confirmed = next; },+ (err) => {+ refusedThrough = generation;+ publish(confirmed);+ toast.error(`Could not save film look presets: ${err.message}`);+ },+ );+ });+ return writeTail;+};++const slug = (label) => label.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 40) || 'look';++/**+ * The install's saved film looks (`settings.filmLookPresets`): `{ presets,+ * save(label, look), remove(id) }`. Saving under an existing name replaces that+ * look. `presets` is [] and `loaded` false until the list has been read; save+ * and remove do nothing before then, so a write never replaces looks it never saw.+ */+export default function useFilmLookPresets() {+ const [list, setList] = useState(presets);+ useEffect(() => {+ listeners.add(setList);+ if (presets) setList(presets);+ else load();+ return () => { listeners.delete(setList); };+ }, []);+ const save = useCallback((label, look) => {+ if (!presets) return null;+ const name = label.trim();+ const current = presets;+ const existing = current.find((preset) => preset.label.toLowerCase() === name.toLowerCase());+ const entry = { id: existing?.id || `${slug(name)}-${Date.now().toString(36)}`, label: name, look: { ...normalizeFilmLook(look), preset: 'custom' } };+ persist(existing ? current.map((preset) => (preset.id === existing.id ? entry : preset)) : [...current, entry]);+ return entry;+ }, []);+ const remove = useCallback((id) => { if (presets) persist(presets.filter((preset) => preset.id !== id)); }, []);+ return { presets: list ?? [], loaded: list !== null, save, remove };+}++/** Test-only: forget the cached list between suites. */+export function resetFilmLookPresetsCache() {+ presets = null;+ confirmed = null;+ loading = null;+ writeTail = Promise.resolve();+ generation = 0;+ refusedThrough = 0;+ listeners.clear();+}diff --git a/client/src/lib/filmLook.js b/client/src/lib/filmLook.jsindex 570ebb15f6..770225fc91 100644--- a/client/src/lib/filmLook.js+++ b/client/src/lib/filmLook.js@@ -8,6 +8,8 @@ export {filmLookPreset,normalizeFilmLook,isFilmLookNeutral,+ sameFilmLook,+ scaleFilmLook,describeFilmLook,filmLookControl,filmLookFilterMarkup,diff --git a/server/lib/README.md b/server/lib/README.mdindex b9de0ab28e..e38f944687 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -868,9 +868,9 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `musicVideoActionContract.js` | Versioned shot intent shape/timing validation and clip-relative frame/motion prompt compilation, shared by treatment and the board. || `sheetPointers.js` | Browser-safe persisted character-sheet layout: `LEGACY_SHEET_VARIANT_ID`, `readSheetPointer`, `listSheetPointers`, identity-preserving `applySheetPointerToCharacter`, and default-variant browser adapter `applySheetPointer`. || `musicVideoGrade.js` | Opt-in Music Video grade presets, bounded normalization, and shared song-timed RGB curves with deterministic grain for composed and document encodes. |-| `filmLook.js` | The film look: `FILM_LOOK_CONTROLS` (sliders, colors, toggles with their photography terms and prompt words), `FILM_LOOK_PRESETS`, `normalizeFilmLook`, `isFilmLookNeutral`, `describeFilmLook` (the look as prompt vocabulary), `filmLookFilterMarkup` (the one SVG filter the live preview, the document render and gallery bakes apply, frame-seeded), `filmLookMotionLayers` (the same look as CSS filter functions plus blended overlays a playing video can afford) and `filmLookRuntimeSource` (the page script that applies and re-seeds it per seek). Browser-safe. |+| `filmLook.js` | The film look: `FILM_LOOK_CONTROLS` (sliders, colors, toggles with their photography terms and prompt words), `FILM_LOOK_PRESETS`, `normalizeFilmLook`, `isFilmLookNeutral`, `sameFilmLook`, `scaleFilmLook` (a look at a fraction of its strength), `describeFilmLook` (the look as prompt vocabulary), `filmLookFilterMarkup` (the one SVG filter the live preview, the document render and gallery bakes apply, frame-seeded), `filmLookMotionLayers` (the same look as CSS filter functions plus blended overlays a playing video can afford) and `filmLookRuntimeSource` (the page script that applies and re-seeds it per seek). Browser-safe. || `filmLookGpu.js` | `filmLookGpuRuntimeSource`: the page script defining `__portosFilmLookGpu`, a WebGL2 renderer that draws `filmLookFilterMarkup`'s filter primitive by primitive the way Chrome's Skia raster backend does (three-box blurs, Skia's feTurbulence, 8-bit premultiplied intermediates), for the footage film-look finishing pass. |-| `filmLookValidation.js` | `filmLookSchema` / `filmLookBakeSchema`: the Zod shape of a film look, derived from `FILM_LOOK_CONTROLS`. |+| `filmLookValidation.js` | `filmLookSchema` / `filmLookBakeSchema`: the Zod shape of a film look, derived from `FILM_LOOK_CONTROLS`; `filmLookSavedPresetsSchema` for the install's saved looks. || `musicVideoStatsOutro.js` | The cutting room floor outro: an optional scene after the song tallying the director's choices. `normalizeStatsOutro`, `statsOutroSeconds`, `musicVideoOutroStats` (the counts from the project's takes, selections, marks and media collection), `drawStatsOutro` (the one canvas painter the animatic and the final render share) and `statsOutroPageSource` (the render page's script). Browser-safe. || `musicVideoTitleCard.js` | The MTV-style opening title card (song, artist, year over the opener): `normalizeTitleCard`, `titleCardVisible`, `titleCardPrefill` (a new card's text and a window ending before the first sung line), and `titleCardRuntimeSource` (the page script the live preview and the document render install to draw it per seek, with its fade and title-safe layout). Browser-safe. || `musicVideoDependencies.js` | Versioned take/evidence provenance, dependency comparisons and bounded selective-repair previews. |diff --git a/server/lib/filmLook.js b/server/lib/filmLook.jsindex 0464fa593b..920ab9ab85 100644--- a/server/lib/filmLook.js+++ b/server/lib/filmLook.js@@ -184,6 +184,30 @@ export function describeFilmLook(look) {return [...new Set(phrases)].slice(0, 8).join(', ');}+/**+ * The look at a fraction of its strength: every effect scaled toward zero (1 =+ * as given, 0 = clean). Modifiers, colors and toggles only shape an effect, so+ * they keep their values.+ */+export function scaleFilmLook(look, amount) {+ const settings = normalizeFilmLook(look);+ if (!settings) return null;+ const k = Math.min(1, Math.max(0, Number(amount) || 0));+ const scaled = { ...settings };+ for (const control of FILM_LOOK_CONTROLS) {+ if (!control.type && !control.modifier) scaled[control.id] = settings[control.id] * k;+ }+ return normalizeFilmLook(scaled);+}++/** True when two looks set every control the same (their preset names aside). */+export function sameFilmLook(a, b) {+ const left = normalizeFilmLook(a);+ const right = normalizeFilmLook(b);+ if (!left || !right) return left === right;+ return FILM_LOOK_CONTROLS.every((control) => left[control.id] === right[control.id]);+}+/** The control record for an id (label, term, hint, range). */export const filmLookControl = (id) => CONTROL_BY_ID.get(id) || null;diff --git a/server/lib/filmLookGpu.browser.test.js b/server/lib/filmLookGpu.browser.test.jsindex 6ba53f642c..ff11f7a2e1 100644--- a/server/lib/filmLookGpu.browser.test.js+++ b/server/lib/filmLookGpu.browser.test.js@@ -6,7 +6,10 @@* pipeline, which the turbulence and kernel unit tests cannot see.*/import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync } from 'node:fs';+import { execFileSync } from 'node:child_process';+import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';import { chromium } from 'playwright-core';import sharp from 'sharp';import { startOwnedBrowserFixture } from '../test/browserFixture.js';@@ -73,4 +76,47 @@ describe.skipIf(!canRun)('film look on the GPU in Chrome', () => {const [svg, gpu] = await Promise.all([svgPage, gpuPage].map(async (p) => sharp(await p.screenshot()).removeAlpha().raw().toBuffer()));expect(psnr(svg, gpu)).toBeGreaterThanOrEqual(40);}, 60000);++ // A video is read the way the page's compositor reads it, scaled to fill the+ // frame. WebGL's own video upload converted colour differently (about 30 dB+ // off on the soft-analog look) and copied another size unscaled.+ it('draws a video of another size as the page fills the frame', async ({ skip }) => {+ let clip;+ try {+ const dir = mkdtempSync(join(tmpdir(), 'film-look-gpu-video-'));+ const path = join(dir, 'clip.webm');+ execFileSync('ffmpeg', ['-hide_banner', '-loglevel', 'error', '-f', 'lavfi', '-i', 'testsrc2=s=480x264:r=24', '-t', '1', '-c:v', 'libvpx-vp9', '-pix_fmt', 'yuv420p', '-y', path]);+ clip = readFileSync(path);+ rmSync(dir, { recursive: true, force: true });+ } catch { skip(); }+ if (!available) skip();+ const look = filmLookPreset('soft-analog');+ const origin = 'http://film-look.test';+ const body = (extra) => `<video id="v" src="${origin}/clip.webm" muted style="display:block;width:${width}px;height:${height}px;object-fit:fill"></video>${extra}`;+ const open = async (extra) => {+ const p = await fixture.browser.newPage({ viewport: { width, height } });+ await p.route(`${origin}/**`, (route) => route.fulfill(route.request().url().endsWith('.webm')+ ? { body: clip, contentType: 'video/webm' } : { body: page(body(extra)), contentType: 'text/html' }));+ await p.goto(`${origin}/`);+ await p.evaluate(() => new Promise((resolve) => {+ const v = document.getElementById('v');+ const go = () => { v.addEventListener('seeked', () => requestAnimationFrame(() => requestAnimationFrame(resolve)), { once: true }); v.currentTime = 0.5; };+ if (v.readyState >= 2) go(); else v.addEventListener('loadeddata', go, { once: true });+ }));+ return p;+ };+ const svg = await open('<svg id="fx" width="0" height="0" style="position:absolute"></svg>');+ const gpu = await open(`<canvas id="out" width="${width}" height="${height}"></canvas><script>${filmLookGpuRuntimeSource()}</script>`);+ const { filter, css } = filmLookFilterMarkup(look, { frame, width, height });+ await svg.evaluate(({ filter, css }) => {+ document.getElementById('fx').innerHTML = `<defs>${filter}</defs>`;+ document.documentElement.style.filter = css;+ }, { filter, css });+ await gpu.evaluate(({ look, frame, width, height }) => {+ globalThis.__portosFilmLookGpu.create(document.getElementById('out')).render(document.getElementById('v'), look, { frame, width, height });+ }, { look, frame, width, height });+ const [a, b] = await Promise.all([svg, gpu].map(async (p) => sharp(await p.screenshot()).removeAlpha().raw().toBuffer()));+ await Promise.all([svg.close(), gpu.close()]);+ expect(psnr(a, b)).toBeGreaterThanOrEqual(40);+ }, 60000);});diff --git a/server/lib/filmLookGpu.js b/server/lib/filmLookGpu.jsindex 26f1ca85f6..706f70d9b4 100644--- a/server/lib/filmLookGpu.js+++ b/server/lib/filmLookGpu.js@@ -593,6 +593,20 @@ void main() {gl.uniform4f(uniforms.clip, x0 + 0.25, y0 + 0.25, x1 - 0.25, y1 - 0.25);};+ // A video goes through a 2D canvas at the frame size first. WebGL's own+ // video upload converts YUV to RGB differently from the page compositor the+ // SVG filter reads (about 30 dB apart on a plain frame), and a sized+ // texImage2D copies a video of another size unscaled instead of filling the+ // frame the way the page's object-fit does.+ let staging = null;+ const stage = (source) => {+ if (typeof HTMLVideoElement === 'undefined' || !(source instanceof HTMLVideoElement)) return source;+ staging ||= document.createElement('canvas');+ if (staging.width !== width || staging.height !== height) { staging.width = width; staging.height = height; }+ staging.getContext('2d', { alpha: false }).drawImage(source, 0, 0, width, height);+ return staging;+ };+let lastPlanKey = null;let lastPlan = null;const render = (source, look, { frame = 0, width: w, height: h, until = Infinity } = {}) => {@@ -613,7 +627,7 @@ void main() {gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);gl.bindTexture(gl.TEXTURE_2D, uploadTexture);- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, source);+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, stage(source));gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);const frameRegion = [0, 0, width, height];const results = new Map();diff --git a/server/lib/filmLookValidation.js b/server/lib/filmLookValidation.jsindex f1c8a944d3..e1e4aea988 100644--- a/server/lib/filmLookValidation.js+++ b/server/lib/filmLookValidation.js@@ -24,3 +24,14 @@ export const filmLookSchema = z.object({export const filmLookBakeSchema = z.object({look: filmLookSchema,}).strict();++/**+ * The install's saved film looks (`settings.filmLookPresets`): named looks the+ * user keeps to reapply on any project, shot or gallery image.+ */+export const FILM_LOOK_SAVED_PRESETS_MAX = 50;+export const filmLookSavedPresetsSchema = z.array(z.object({+ id: z.string().regex(/^[a-z0-9-]{1,64}$/),+ label: z.string().trim().min(1).max(60),+ look: filmLookSchema,+}).strict()).max(FILM_LOOK_SAVED_PRESETS_MAX);diff --git a/server/routes/settings.js b/server/routes/settings.jsindex 43d00561da..ae7fb3da88 100644--- a/server/routes/settings.js+++ b/server/routes/settings.js@@ -28,6 +28,7 @@ import { DEFAULT_UNTRUSTED_CONTENT_POLICY, untrustedContentSettingsSchema } fromimport { agentContextSettingsSchema } from '../lib/agentContextValidation.js';import { EFFORT_LEVELS } from '../lib/providerModels.js';import { settingsSlicePatchSchema, privateCredentialParamsSchema, privateCredentialInputSchema, backupConfigSchema, autoUpdateSettingsSchema, sharingSettingsPatchSchema, featureProviderConfigSchema, autofixerSettingsSchema, codeReviewSettingsSchema, locationSettingsSchema, hideFirstRunCardSchema, networkSetupPreferenceSchema, settingsEmbeddingsSchema, localLlmSettingsSchema, imessageConfigSchema, signalConfigSchema, beeperSettingsSchema, beeperSavedScopesSchema, spotifyConfigSchema, youtubeConfigSchema, apiAccessSettingsSchema, instanceFeatureSettingsSchema, instanceFeatureIdSchema, instanceFeatureUpdateSchema, instanceFeatureGroupSettingsSchema, instanceFeatureGroupIdSchema, instanceFeatureGroupUpdateSchema, loraTrainingConfigSchema, pipelineEditorialChecksSettingsSchema, creativeDirectorSettingsSchema, musicSettingsSchema, federationSettingsSchema, privacySettingsSchema, seriesAutopilotSettingsSchema, layeredIntelligenceSettingsSchema, imageGenGrokSettingsSchema, imageGenAgySettingsSchema, imageGenFalSettingsSchema, renderDefaultsSettingsSchema, videoGenSettingsSchema, subscriptionCostsMapSchema, subscriptionPlanTiersMapSchema, usageApiBilledInstanceIdsSchema, namedOrchestrationProfileSchema, orchestrationProfilesSettingsSchema, harnessSettingsSchema, credentialBootstrapsSettingsSchema, validateRequest } from '../lib/validation.js';+import { filmLookSavedPresetsSchema } from '../lib/filmLookValidation.js';const router = Router();@@ -419,6 +420,9 @@ const validateSettingsPatch = async (body) => {// schema. Validate that slice when it's present so a malformed Backup-tab// save doesn't reach disk (the runtime guards downstream are belt-and-// suspenders, but per project convention all inputs are validated).+ if (body?.filmLookPresets !== undefined) {+ validateRequest(filmLookSavedPresetsSchema, body.filmLookPresets);+ }if (body?.untrustedContent !== undefined) {validateRequest(untrustedContentSettingsSchema, body.untrustedContent);}diff --git a/server/routes/settings.test.js b/server/routes/settings.test.jsindex bd07d81fe5..63eba10587 100644--- a/server/routes/settings.test.js+++ b/server/routes/settings.test.js@@ -1747,3 +1747,23 @@ describe('autofixer settings operator authority', () => {expect(store.autofixer).toEqual(original);});});++describe('Settings routes — saved film looks', () => {+ beforeEach(() => { store = {}; vi.clearAllMocks(); });+ it('stores named looks and refuses a malformed one without touching the saved list', async () => {+ const presets = [{ id: 'dusk-ab12', label: 'Dusk', look: { preset: 'custom', warmth: 0.3, grain: 0.2 } }];+ const saved = await request(buildApp()).put('/api/settings').send({ filmLookPresets: presets });+ expect(saved.status).toBe(200);+ expect(store.filmLookPresets).toEqual(presets);+ for (const bad of [+ [{ id: 'x', label: 'Out of range', look: { warmth: 5 } }],+ [{ id: 'x', label: 'Typo', look: { warmht: 0.2 } }],+ [{ id: 'Bad Id', label: 'Id', look: {} }],+ [{ id: 'x', label: '', look: {} }],+ ]) {+ const result = await request(buildApp()).put('/api/settings').send({ filmLookPresets: bad });+ expect(result.status).toBe(400);+ expect(store.filmLookPresets).toEqual(presets);+ }+ });+});diff --git a/server/services/htmlComposition/encode.js b/server/services/htmlComposition/encode.jsindex 8132fb5a6d..5e93bbc28b 100644--- a/server/services/htmlComposition/encode.js+++ b/server/services/htmlComposition/encode.js@@ -133,12 +133,15 @@ export async function encodeComposition(page, contract, outputPath, { musicPath,const captureOnce = async t => {page.check();// awaitPromise in evaluate is essential: each seek owns its paint.- const at = offsetSec ? Math.round((offsetSec + t) * 1e6) / 1e6 : t;+ // Unrounded: pages pick their frame with floor(t × fps + 1e-6), and a time+ // rounded to the microsecond lands up to 1.2e-5 frames early at 24 fps, so+ // every third frame drew its predecessor.+ const at = offsetSec + t;await seekComposition(page, at, Math.round(t * fps));page.check();const captureStarted = performance.now();const { data } = await page.send('Page.captureScreenshot', SCREENSHOT).catch(error => {- throw new Error(`Composition capture failed at frame ${Math.round(t * fps)} (song ${at}s) after ${Math.round(performance.now() - captureStarted)}ms: ${error.message}`);+ throw new Error(`Composition capture failed at frame ${Math.round(t * fps)} (song ${+at.toFixed(6)}s) after ${Math.round(performance.now() - captureStarted)}ms: ${error.message}`);});page.check();return Buffer.from(data, 'base64');@@ -296,7 +299,7 @@ export async function encodeCompositionSegments(page, contract, outputPath, { opconst slot = replaceable(i === 0 ? page : null, controller.signal);try {slot.page ??= await openPage(controller.signal);- const at = Math.round((offsetSec + start / fps) * 1e6) / 1e6;+ const at = offsetSec + start / fps;const result = await encode(slot.page, { ...contract, durationSec: frames / fps }, parts[i], {signal: controller.signal, offsetSec: at, continuous: start > 0, followed: i < segments.length - 1, videoFilter: videoFilterAt(at),reopenPage: slot.reopen, onRetry: onRetry && (detail => onRetry({ ...detail, segment: i })),diff --git a/server/services/htmlComposition/encode.musicVideo.test.js b/server/services/htmlComposition/encode.musicVideo.test.jsindex 6d5764e2ab..297692d686 100644--- a/server/services/htmlComposition/encode.musicVideo.test.js+++ b/server/services/htmlComposition/encode.musicVideo.test.js@@ -108,7 +108,10 @@ describe('encodeComposition song-time windows', () => {spawned.length = 0;const { page: windowPage, seeks } = recording();await encodeComposition(windowPage, contract(0.5), '/tmp/window.mp4', { offsetSec: 61.25 });- expect(seeks).toEqual([61.25, 61.333333, 61.416667, 61.5, 61.583333, 61.666667]);+ expect(seeks.map((t) => +t.toFixed(6))).toEqual([61.25, 61.333333, 61.416667, 61.5, 61.583333, 61.666667]);+ // Each seek selects its own frame under the pages' floor(t × fps + 1e-6):+ // a time rounded to the microsecond selected the previous one every few frames.+ expect(seeks.map((t) => Math.floor(t * 12 + 1e-6))).toEqual([735, 736, 737, 738, 739, 740]);expect(spawned[0].args.join(' ')).toContain('-frames:v 6');});diff --git a/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js b/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.jsindex b5b70da949..7fefca8742 100644--- a/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js+++ b/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js@@ -4,7 +4,6 @@ import { describe, expect, it } from 'vitest';// The layered engine is a browser template copied into each document, so the overlay// guard is exercised by evaluating just that helper against a recording fake context.const engine = readFileSync(new URL('./engine.js', import.meta.url), 'utf8');-const lyricType = readFileSync(new URL('../shared/lyricType.js', import.meta.url), 'utf8');const helper = engine.slice(engine.indexOf(' const FOOTAGE_WASH_ALPHA'), engine.indexOf(' // Compare the same camera-transformed footage'));const W = 1920; const H = 1080;const footageOverlayContext = new Function('W', 'H', `${helper}\nreturn footageOverlayContext;`)(W, H);diff --git a/server/services/musicVideo/filmLookFinish.js b/server/services/musicVideo/filmLookFinish.jsindex 1d8f88fc60..76b05da2e5 100644--- a/server/services/musicVideo/filmLookFinish.js+++ b/server/services/musicVideo/filmLookFinish.js@@ -157,7 +157,7 @@ async function chooseFilmLookPath(page, { width, height, fps, frames, offsetSecif (!info?.available) return { gpu: false, reason: 'WebGL2 is unavailable' };await page.send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: 1, mobile: false });const frame = Math.floor(frames / 2);- const at = (n) => Math.round((offsetSec + n / fps) * 1e6) / 1e6;+ const at = (n) => offsetSec + n / fps;// The seek pays for the GPU draw and the capture for the SVG filter: time both.const timed = async (n) => {const started = performance.now();diff --git a/server/services/musicVideo/intercut.js b/server/services/musicVideo/intercut.jsindex 9c1fe09ac4..347fc420a5 100644--- a/server/services/musicVideo/intercut.js+++ b/server/services/musicVideo/intercut.js@@ -134,7 +134,7 @@ function graphicWords(cues) {}/** Replace one beat within a single source piece; keep footage read heads intact. */-function insertGraphicCards(clips, ranked, period, lyricCues, accentColor) {+function insertGraphicCards(clips, ranked, period, lyricCues, accentColor, locked) {const candidates = graphicWords(lyricCues);if (!candidates.length) return clips;const accent = /^#[0-9a-f]{6}$/i.test(accentColor || '') ? accentColor : '#ff5a1f';@@ -158,6 +158,7 @@ function insertGraphicCards(clips, ranked, period, lyricCues, accentColor) {out.push(clip);continue;}+ if (locked.has(clip.sceneId)) { out.push(clip); continue; }const eligible = candidates.filter(({ atSec }) => {const section = sectionAt(ranked, atSec);return section && tierBeats(section.rank) <= 3 && atSec >= section.startSec - EPS && atSec >= start - EPS@@ -172,7 +173,7 @@ function insertGraphicCards(clips, ranked, period, lyricCues, accentColor) {if (atSec > from + EPS) out.push(sliceClip(clip, from - start, atSec - from));const duration = round3(period);out.push({ sceneId: `graphic-card-${count}`, layer: 'card', inSec: 0, outSec: duration, duration,- cardText: text, cardColor: count % 2 === 0 ? accent : '#000000' });+ cardText: text, cardColor: count % 2 === 0 ? accent : '#000000', cardOf: clip.sceneId });count += 1;previousCardAt = atSec;from = atSec + period;@@ -198,7 +199,8 @@ function sliceClip(clip, offset, length) {* Returns a new clip list; the input is returned as-is when there is no beat* grid to cut on.*/-export function intercutClips(clips, { scenes = [], sections = [], beats = [], bpm = null, words = [], lyricCues = [], graphicCards = false, accentColor = null } = {}) {+export function intercutClips(clips, { scenes = [], sections = [], beats = [], bpm = null, words = [], lyricCues = [], graphicCards = false, accentColor = null, lockedSceneIds = [] } = {}) {+ const locked = new Set(lockedSceneIds);const list = Array.isArray(clips) ? clips : [];const grid = (Array.isArray(beats) ? beats : []).filter(finite).sort((a, b) => a - b);const period = beatPeriod(bpm, grid);@@ -224,7 +226,7 @@ export function intercutClips(clips, { scenes = [], sections = [], beats = [], b// Partner cutaways: footage that is not a sung performance, each with a// read head starting after the part the edit already shows.const partners = placed- .filter(({ clip }) => !clip.layer && clip.videoPath && modes.get(clip.sceneId) !== 'performance' && finite(clip.sourceSec) && clip.sourceSec > MIN_PIECE_SEC)+ .filter(({ clip }) => !clip.layer && clip.videoPath && modes.get(clip.sceneId) !== 'performance' && !locked.has(clip.sceneId) && finite(clip.sourceSec) && clip.sourceSec > MIN_PIECE_SEC).map((p) => ({ ...p, head: p.clip.outSec, start: p.clip.inSec, end: p.clip.inSec + p.clip.sourceSec }));function takePartner(host, len) {@@ -245,7 +247,9 @@ export function intercutClips(clips, { scenes = [], sections = [], beats = [], bfor (const host of placed) {const { clip, t0, t1, section } = host;const still = clip.layer === 'still';- if ((clip.layer && !still) || (!still && !clip.videoPath) || !section) { out.push(clip); continue; }+ // A locked shot is approved as it plays, so the final render keeps it whole+ // and never lends its footage to another shot.+ if ((clip.layer && !still) || (!still && !clip.videoPath) || !section || locked.has(clip.sceneId)) { out.push(clip); continue; }const target = tierBeats(section.rank) * period;const cuts = cutTimes(t0, t1, target, halfGrid, onsets, period);if (!cuts.length) { out.push(clip); continue; }@@ -261,5 +265,5 @@ export function intercutClips(clips, { scenes = [], sections = [], beats = [], bout.push({ ...clip, inSec, outSec: round3(inSec + len), duration: len, ...(clip.loop === false ? { sourceSec: round3(clip.inSec + (clip.sourceSec ?? clip.duration) - inSec) } : {}) });}}- return graphicCards ? insertGraphicCards(out, ranked, period, lyricCues, accentColor) : out;+ return graphicCards ? insertGraphicCards(out, ranked, period, lyricCues, accentColor, locked) : out;}diff --git a/server/services/musicVideo/intercut.test.js b/server/services/musicVideo/intercut.test.jsindex 0956a3ab70..c99afbf58c 100644--- a/server/services/musicVideo/intercut.test.js+++ b/server/services/musicVideo/intercut.test.js@@ -66,6 +66,15 @@ describe('intercutClips (#9290)', () => {}});+ it('leaves a locked shot whole: no partner pieces, no cards, and its footage nowhere else', () => {+ const cues = [{ text: 'Rise 198', startSec: 10, endSec: 14, words: [{ w: 'Rise', startSec: 10.5 }, { w: '198', startSec: 12.5 }] }];+ const out = intercutClips(clips, { scenes, sections, beats, bpm, lyricCues: cues, graphicCards: true, lockedSceneIds: ['perf', 'mid'] });+ expect(out.filter((c) => c.sceneId === 'perf')).toEqual([clips[1]]);+ expect(out.filter((c) => c.sceneId === 'mid')).toEqual([clips[3]]);+ expect(out.some((c) => c.layer === 'card')).toBe(false);+ expect(spanOf(out)).toBeCloseTo(spanOf(clips), 2);+ });+it('prefers a sung word onset near the target cut', () => {const one = [footage('perf', 0, 4, 4), footage('b-roll', 0, 4, 10)];const loudOnly = [{ startSec: 0, endSec: 8, energy: 1 }, { startSec: 8, endSec: 9, energy: 0 }];diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.jsindex 275ec15ca4..e5b00dae8e 100644--- a/server/services/musicVideo/render.js+++ b/server/services/musicVideo/render.js@@ -1,7 +1,7 @@import { maintenance } from '../../lib/maintenanceAdmission.js';import { withBackupAssetPublication } from '../../lib/backupSnapshotBoundary.js';import { assertMusicVideoMediaSelections } from '../../lib/musicVideoMediaPolicy.js';-import { assertProductionApproval, clipLocks, nameShots, productionReviewBasis } from './productionReview.js';+import { assertProductionApproval, clipLocks, nameShots, productionReviewBasis, shotLocks } from './productionReview.js';import { musicVideoGradeFilter } from '../../lib/musicVideoGrade.js';/*** Music Video — render pipeline (#1760, Phase 2).@@ -551,7 +551,9 @@ function buildSegmentArgs(segment, { plan, prerolls, addInput, sectionFilters, g'-y',outputPath,];- return { args, sceneId: c.sceneId, layer: c.layer || 'footage', frames: outFrames, startFrame, startSec, endSec: (startFrame + outFrames) / fps, canonW, canonH, fps, sections: plan.length };+ // `shotId` is the shot whose span this section plays in: an intercut partner+ // piece or a hook card belongs to the shot it cuts into.+ return { args, sceneId: c.sceneId, shotId: c.intercutOf || c.cardOf || c.sceneId, layer: c.layer || 'footage', frames: outFrames, startFrame, startSec, endSec: (startFrame + outFrames) / fps, canonW, canonH, fps, sections: plan.length };}// Pure: build the ffmpeg args for the master-bed render. Concats the clips@@ -825,6 +827,15 @@ export function assertCurrentClipDependencies(project) {{ status: 422, code: 'STALE_CLIP_DEPENDENCIES', context: { sceneIds: stale.map((scene) => scene.sceneId) } });}+// Shots approved as they play: a locked clip, or a locked shot with no clip+// step (a still). The intercut pass leaves these whole.+function lockedShotIds(project) {+ const shots = shotLocks(project);+ if (!shots) return [];+ const clips = clipLocks(project, shots) || {};+ return Object.keys(shots).filter((id) => (clips[id] ?? shots[id]) === 'locked');+}+export async function planMusicVideoRender(project, { draft = false } = {}) {assertMusicVideoMediaSelections(project);assertCurrentClipDependencies(project);@@ -865,6 +876,7 @@ export async function planMusicVideoRender(project, { draft = false } = {}) {lyricCues: project.lyricCues,graphicCards: composed,accentColor: project.composition?.style?.accentColor,+ lockedSceneIds: lockedShotIds(project),}): snapped;const soundBed = await resolveSoundBedPath(project);diff --git a/server/services/musicVideo/shotSegments.js b/server/services/musicVideo/shotSegments.jsindex a1055cefdb..c7a326510b 100644--- a/server/services/musicVideo/shotSegments.js+++ b/server/services/musicVideo/shotSegments.js@@ -137,11 +137,13 @@ export async function planShotSegments(project) {...(overlayPages.some((p) => p.name === 'lyrics') ? { lyrics: windowedKeyData({ ...lyricData, render: nearEnd ? lyricData.render : null }, lo, hi) } : {}),};const baseKey = hash({ v: SHOT_SEGMENT_VERSION, args: await fingerprintArgs(built.args), overlays: overlayKey, width, height, fps });- const scene = scenes.get(built.sceneId);+ // Each segment belongs to the shot whose span it plays in, so a shot's+ // render, look and cached files cover exactly its own time on the song.+ const scene = scenes.get(built.shotId);const look = shotFilmLook(project, scene);const lookKey = look ? segmentLookKey({ baseKey, startSec: built.startSec }, look, fps) : null;segments.push({- index, sceneId: built.sceneId, layer: built.layer, startSec: built.startSec, endSec: built.endSec,+ index, sceneId: built.shotId, layer: built.layer, startSec: built.startSec, endSec: built.endSec,startFrame, frames: built.frames, window, segment, look, baseKey, lookKey, ownLook: hasOwnLook(scene),basePath: join(dir, `${baseKey}.mp4`),path: join(dir, lookKey ? `${baseKey}-${lookKey}.mp4` : `${baseKey}.mp4`),diff --git a/server/services/musicVideo/shotSegments.test.js b/server/services/musicVideo/shotSegments.test.jsindex 9590c210b6..974fd8302f 100644--- a/server/services/musicVideo/shotSegments.test.js+++ b/server/services/musicVideo/shotSegments.test.js@@ -116,6 +116,18 @@ describe.skipIf(!hasFfmpeg)('shot segments', () => {expect(average === 'inf' || Number(average) > 35).toBe(true);}, 60000);+ it("files an intercut piece under the shot whose span it plays in, with that shot's look", async () => {+ const saved = fixture.clips;+ // C's span plays a piece of B's spare footage in its middle (an intercut partner).+ fixture.clips = [saved[0], saved[1], { ...saved[2], outSec: 0.5, duration: 0.5 },+ { ...saved[1], inSec: 1, outSec: 1.25, duration: 0.25, intercutOf: 'c' }, { ...saved[2], inSec: 0.75, outSec: 1, duration: 0.25 }];+ const pinned = { preset: 'polaroid', grain: 0.2 };+ const scenes = project().scenes.map((s) => (s.sceneId === 'c' ? { ...s, filmLook: pinned } : s));+ const plan = await planShotSegments(project({ scenes })).finally(() => { fixture.clips = saved; });+ expect(plan.segments.map((s) => s.sceneId)).toEqual(['a', 'b', 'c', 'c', 'c']);+ expect(plan.segments[3].look).toMatchObject({ preset: 'polaroid' });+ }, 60000);+it('re-renders only the segments a shot tweak reaches, and keeps bases through a look change', async () => {const before = await planShotSegments(project());// B played faster: B changes, and so does A, which shows B's footage in its dissolve.