Skip to content

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

fix: request music video frames at the project aspect and pin clip lighting

[._.]/ Adam Eivydaa9643187ba
diff --git a/client/src/hooks/useMusicVideoSceneMedia.js b/client/src/hooks/useMusicVideoSceneMedia.js
index ca59c3189e..4125219b8f 100644
--- a/client/src/hooks/useMusicVideoSceneMedia.js
+++ b/client/src/hooks/useMusicVideoSceneMedia.js
@@ -7,6 +7,8 @@ import { generateVideo } from '../services/apiImageVideo.js';
import useSceneRenderLifecycle from './useSceneRenderLifecycle.js';
import { isLtx2FamilyRuntime } from '../lib/runnerFamilies';
import { isLayeredComposition, sceneVisualLayer } from '../lib/musicVideoLayers.js';
+import { musicVideoFrameGenSize } from '../lib/musicVideoAspect.js';
+import { MOTION_CONTINUITY_CLAUSE } from '../lib/musicVideoMotion.js';
import {
approximateMotionCues, falSceneTake, falTakeRequestFields, grokCoverage, isPerformanceScene, performanceBlockedReason,
} from '../lib/musicVideoShotTiming.js';
@@ -123,7 +125,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS
// fallback) suffixed the same way. The reference frame already fixes the
// look; this prompt guides the motion.
const buildShotPrompt = (scene) =>
- [(scene.prompt?.trim() || scene.framePrompt?.trim() || ''), style, motionDirection, scene.direction?.motionClause?.trim()].filter(Boolean).join(', ');
+ [(scene.prompt?.trim() || scene.framePrompt?.trim() || ''), style, motionDirection, scene.direction?.motionClause?.trim(), MOTION_CONTINUITY_CLAUSE].filter(Boolean).join(', ');
/**
* Render a still reference frame for one scene from its frame prompt. The
@@ -153,6 +155,7 @@ export default function useMusicVideoSceneMedia({ project, videoSettings, applyS
frameLane.startScene(scene.sceneId);
return generateImage({
prompt,
+ ...musicVideoFrameGenSize(project),
...(conditioning.length ? { referenceImageFiles: conditioning.map((ref) => ref.imageId) } : {}),
musicVideo: { projectId, sceneId: scene.sceneId, ...(revisionId ? { revisionId } : {}) },
}, { silent: true })
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 17bc6e0f52..3b59d4962a 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -59,6 +59,8 @@ grep -i "what you want to do" client/src/lib/README.md
| `backupExcludes.js` | CLIENT MIRROR of the backup-exclude block in `server/lib/sharedSchemas.js` (#7241) — `anchorUserExclude` / `anchorUserExcludes` / `isSafeExcludePattern` / `EXCLUDE_PATTERN_MAX_LENGTH`. The Backup settings tab anchors a newly added exclude and renders the effective list with these, so the chip the user sees is the rsync filter the server will actually run instead of an unanchored pattern that matches at any depth. |
| `beatColors.js` | `BEAT_KIND_COLORS` + `getBeatKindColor(kind)` — per-kind display colors for reader-map emotional beats (kinds defined server-side in `storyArc.js`). Keeps every beat visualization consistent. |
| `beatGrid.js` | Music-video beat-quantized timeline arranger (#1854). `buildBeatGridPoints(audioAnalysis)` merges beats/downbeats/section edges into one ranked snap-point list; `snapTimeToGrid(timeSec, gridPoints, toleranceSec)` finds the nearest point within tolerance; `computeSceneSpans(scenes, durationSec)` lays out scenes without a persisted `startSec`/`endSec` contiguously as a display-only fallback; `computeDragSpan({kind, startSpan, deltaSec, gridPoints, ...})` resolves a timeline drag gesture (`'move'` or `'right'` — no `'left'`, since the render can only trim from a clip's own frame 0) into a new span; `shouldMarkBeatAligned({kind, snapped, wasPersisted})` gates the `beatAligned` flag so a reposition-only drag can't silently promote an unpersisted scene's placeholder fallback duration into a "saved exactly" render duration; `autoArrangeScenes(scenes, audioAnalysis)` proposes a full `{ sceneId, startSec, endSec, beatAligned }[]` arrangement by distributing scenes across song sections weighted by each section's `energy` (#1915). Used by `components/musicVideo/BeatTimeline.jsx` and `pages/MusicVideo.jsx`. |
+| `musicVideoAspect.js` | Re-export of `server/lib/musicVideoAspect.js`: `musicVideoAspect`, `musicVideoFrameGenSize`. Used by `hooks/useMusicVideoSceneMedia.js` so board frames match the project aspect. |
+| `musicVideoMotion.js` | Re-export of `server/lib/musicVideoMotion.js` (`MOTION_CONTINUITY_CLAUSE`) for board motion prompts. |
| `musicVideoLayers.js` | Music-video per-scene visual layers (#8985), re-exported from `server/lib/musicVideoLayers.js`: `MUSIC_VIDEO_VISUAL_LAYERS`, `MUSIC_VIDEO_STILL_MOVES`, `sceneVisualLayer(scene, { layered })`, `sceneHasAuthoredSpan`, `sceneRenderReady(scene, { layered })`. Used by `components/musicVideo/SceneCard.jsx`, `ProjectActionGroups.jsx` and `hooks/useMusicVideoSceneMedia.js`. |
| `musicVideoTakes.js` | Music-video scene takes view helpers (#8965): `sceneTakeList(scene, kind)` lists a scene's image/video takes with an un-materialized pre-takes selection appended as a read-only `legacy` take; `takePreviewKey`, `takeThumbUrl`, `takeProvenance`; `TAKE_SLOT` maps a take kind to its selection field. Used by `components/musicVideo/SceneTakeStrip.jsx` and `pages/MusicVideo.jsx`. |
| `musicVideoShotTiming.js` | Re-export of `server/lib/musicVideoShotTiming.js` (#8977) — shot modes, the verified source-audio lip-sync capability table, `performanceBlockedReason`, `planPerformanceWindow`, `grokCoverage`, `approximateMotionCues`, `shotSplitLimit` (when a scene offers a lyric-boundary split), `falSceneTake` (a fal take's model, length, resolution and estimated cost). Used by `hooks/useMusicVideoSceneMedia.js` and `components/musicVideo/SceneCard.jsx`. |
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index 97ae4202e7..ac7b1975df 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -69,6 +69,8 @@ export * from './issueRefs.js';
export * from './musicDuration.js';
export * from './muscriptorModels.js';
export * from './musicVideoLayers.js';
+export * from './musicVideoAspect.js';
+export * from './musicVideoMotion.js';
export * from './musicVideoTakes.js';
export * from './musicVideoShotTiming.js';
export * from './musicVideoStages.js';
diff --git a/client/src/lib/musicVideoAspect.js b/client/src/lib/musicVideoAspect.js
new file mode 100644
index 0000000000..0000456f70
--- /dev/null
+++ b/client/src/lib/musicVideoAspect.js
@@ -0,0 +1,2 @@
+/** Music Video frame aspect — re-export of `server/lib/musicVideoAspect.js` so the board requests frames at the same size as the production run. */
+export { MUSIC_VIDEO_ASPECTS, musicVideoAspect, musicVideoFrameGenSize } from '../../../server/lib/musicVideoAspect.js';
diff --git a/client/src/lib/musicVideoMotion.js b/client/src/lib/musicVideoMotion.js
new file mode 100644
index 0000000000..c0b49fb00e
--- /dev/null
+++ b/client/src/lib/musicVideoMotion.js
@@ -0,0 +1,2 @@
+/** Re-export of the server's motion-continuity clause so board clips pin the frame's lighting like production clips. */
+export { MOTION_CONTINUITY_CLAUSE } from '../../../server/lib/musicVideoMotion.js';
diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsx
index c14e56b428..60193a914f 100644
--- a/client/src/pages/MusicVideo.test.jsx
+++ b/client/src/pages/MusicVideo.test.jsx
@@ -1780,6 +1780,9 @@ describe('MusicVideo visual spec, takes and handoff (#8965)', () => {
fireEvent.click(screen.getByRole('button', { name: /^Generate frame$/ }));
await waitFor(() => expect(generateImage).toHaveBeenCalledWith({
prompt: 'harbor at dawn, grainy 16mm, color palette #112233; camera: locked-off wides',
+ // Frames are requested at the project's aspect (16:9 by default).
+ width: 1536,
+ height: 864,
referenceImageFiles: ['mood.png'],
musicVideo: { projectId: 'mv-spec', sceneId: 's1' },
}, { silent: true }));
diff --git a/server/lib/README.md b/server/lib/README.md
index 2f620dcc55..795e2fc62a 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -798,4 +798,6 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `muscriptorModels.js` | `MUSCRIPTOR_MODELS` (`small`/`medium`/`large`) — MuScriptor size tiers shared by route schemas and `audioMidiTranscription.js`; pinned to the Python runner's argparse choices. |
| `loopInterval.js` | Loop interval grammar (`MIN_INTERVAL_MS`, `parseInterval`, `isValidLoopInterval`) shared by `services/loops.js` and `createLoopSchema` so the route rejects what the service would. |
+| `musicVideoAspect.js` | `musicVideoAspect(project)` (treatment brief aspect, default 16:9), `MUSIC_VIDEO_FRAME_GEN_SIZES` and `musicVideoFrameGenSize(project)`: the size every Music Video reference frame is requested at, so a backend never picks portrait for a 16:9 video. Shared by `productionDispatch.js`, `documentRender.js` and the client board. |
+| `musicVideoMotion.js` | `MOTION_CONTINUITY_CLAUSE`: the clause every Music Video motion (i2v) prompt ends with, pinning the reference frame's lighting, time of day and palette. Shared by `handoff.js` and the client board. |
| `musicVideoConditioning.js` | `musicVideoConditioningReferences(project, scene)` selects the approved character sheet and scene's mapped set plate, with capped project-wide fallback; shared by board and production. |
diff --git a/server/lib/index.js b/server/lib/index.js
index 056651a2aa..313313467e 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -781,3 +781,5 @@ export * from './loopInterval.js';
export * from './defaultRequestBody.js';
export * from './musicVideoConditioning.js';
+export * from './musicVideoAspect.js';
+export * from './musicVideoMotion.js';
diff --git a/server/lib/musicVideoAspect.js b/server/lib/musicVideoAspect.js
new file mode 100644
index 0000000000..39a255ab73
--- /dev/null
+++ b/server/lib/musicVideoAspect.js
@@ -0,0 +1,26 @@
+/**
+ * Music Video frame aspect (shared by the server and the client board).
+ *
+ * A project's aspect is its treatment brief's `aspectRatio`, defaulting to
+ * 16:9. Every generated reference frame is requested at that aspect: an image
+ * backend left to choose on its own picks per prompt (a close-up of hands
+ * came back portrait), and the render then pillarboxes that shot.
+ */
+export const MUSIC_VIDEO_ASPECTS = Object.freeze(['16:9', '9:16', '1:1']);
+
+/** The project's aspect ratio (brief), defaulting to 16:9. */
+export function musicVideoAspect(project) {
+ const aspect = project?.treatment?.brief?.aspectRatio;
+ return MUSIC_VIDEO_ASPECTS.includes(aspect) ? aspect : '16:9';
+}
+
+// Reference-frame sizes for image backends: long edge 1536, both sides
+// multiples of 32, so local diffusion models and cloud hints accept them.
+export const MUSIC_VIDEO_FRAME_GEN_SIZES = Object.freeze({
+ '16:9': Object.freeze({ width: 1536, height: 864 }),
+ '9:16': Object.freeze({ width: 864, height: 1536 }),
+ '1:1': Object.freeze({ width: 1024, height: 1024 }),
+});
+
+/** `{ width, height }` to request a project's reference frames at. */
+export const musicVideoFrameGenSize = (project) => ({ ...MUSIC_VIDEO_FRAME_GEN_SIZES[musicVideoAspect(project)] });
diff --git a/server/lib/musicVideoAspect.test.js b/server/lib/musicVideoAspect.test.js
new file mode 100644
index 0000000000..bd75a1cd0b
--- /dev/null
+++ b/server/lib/musicVideoAspect.test.js
@@ -0,0 +1,15 @@
+import { describe, it, expect } from 'vitest';
+import { musicVideoAspect, musicVideoFrameGenSize } from './musicVideoAspect.js';
+
+describe('musicVideoAspect', () => {
+ it('reads the brief aspect and defaults to 16:9', () => {
+ expect(musicVideoAspect({ treatment: { brief: { aspectRatio: '9:16' } } })).toBe('9:16');
+ expect(musicVideoAspect({ treatment: { brief: { aspectRatio: '4:3' } } })).toBe('16:9');
+ expect(musicVideoAspect({})).toBe('16:9');
+ });
+
+ it('requests landscape frames for a 16:9 project and portrait for 9:16', () => {
+ expect(musicVideoFrameGenSize({})).toEqual({ width: 1536, height: 864 });
+ expect(musicVideoFrameGenSize({ treatment: { brief: { aspectRatio: '9:16' } } })).toEqual({ width: 864, height: 1536 });
+ });
+});
diff --git a/server/lib/musicVideoMotion.js b/server/lib/musicVideoMotion.js
new file mode 100644
index 0000000000..115c5eb530
--- /dev/null
+++ b/server/lib/musicVideoMotion.js
@@ -0,0 +1,9 @@
+/**
+ * Music Video motion-prompt constants shared by the server (handoff.js
+ * sceneShotPrompt, the production run) and the client board.
+ *
+ * An i2v model drifts toward daylight and a new palette over a 5–10 s take
+ * when the motion prompt does not pin them (a night rooftop turned overcast
+ * mid-shot in a real run), so every motion prompt ends with this clause.
+ */
+export const MOTION_CONTINUITY_CLAUSE = "hold the reference frame's lighting, time of day and palette for the whole shot";
diff --git a/server/services/musicVideo/documentRender.js b/server/services/musicVideo/documentRender.js
index 1cb102c949..3916bb7778 100644
--- a/server/services/musicVideo/documentRender.js
+++ b/server/services/musicVideo/documentRender.js
@@ -32,6 +32,7 @@ import { PATHS } from '../../lib/fileUtils.js';
import { htmlCompositionContractSchemaFor } from '../../lib/validation.js';
import { selectedPerformanceInstruction } from '../../lib/musicVideoShotTiming.js';
import { sceneVisualLayer } from '../../lib/musicVideoLayers.js';
+import { musicVideoAspect } from '../../lib/musicVideoAspect.js';
import { documentDirectoryForRender } from './compositionDocument.js';
import { musicVideoSongDocument } from './compositionRender.js';
import { buildSongDocument } from './codeTimeline.js';
@@ -50,11 +51,8 @@ const finite = (n) => (typeof n === 'number' && Number.isFinite(n) ? n : null);
const scriptJson = (value) => JSON.stringify(value).replace(/</g, '\\u003c');
const safeSegment = (id) => String(id || 'scene').replace(/[^A-Za-z0-9_-]+/g, '-').slice(0, 80) || 'scene';
-/** The project's aspect ratio (brief), defaulting to 16:9. */
-export function documentAspect(project) {
- const aspect = project?.treatment?.brief?.aspectRatio;
- return DOCUMENT_FRAME_SIZES[aspect] ? aspect : '16:9';
-}
+/** The project's aspect ratio (brief), defaulting to 16:9 (lib/musicVideoAspect.js). */
+export const documentAspect = musicVideoAspect;
const aspectOf = (width, height) => {
const r = width / height;
diff --git a/server/services/musicVideo/handoff.js b/server/services/musicVideo/handoff.js
index 860ea3fc53..0b4b55a7dc 100644
--- a/server/services/musicVideo/handoff.js
+++ b/server/services/musicVideo/handoff.js
@@ -1,4 +1,5 @@
import { musicVideoCreativeContext } from '../../lib/musicVideoCreativeContext.js';
+import { MOTION_CONTINUITY_CLAUSE } from '../../lib/musicVideoMotion.js';
/**
* Music Video external-asset handoff (#8965) — provider-neutral export/import
* for tools PortOS does not drive, such as Midjourney.
@@ -82,8 +83,9 @@ export function visualDirection(spec) {
// `clause` is the scene's applied treatment direction (#8980) — the composition
// constraints for a frame or a motion prompt. Same order as the client's
// buildFramePrompt/buildShotPrompt.
-// A motion prompt (`motion: true`) omits the mood-board look: the i2v model
-// starts from the reference frame, which already carries it.
+// A motion prompt (`motion: true`) omits the mood-board look (the i2v model
+// starts from the reference frame, which already carries it) and pins the
+// frame's lighting for the length of the take.
function composePrompt(primary, fallback, project, clause, { motion = false } = {}) {
return [
primary?.trim() || fallback?.trim() || '',
@@ -91,6 +93,7 @@ function composePrompt(primary, fallback, project, clause, { motion = false } =
musicVideoCreativeContext(project.concept, { moodBoard: !motion }),
visualDirection(project.visualSpec),
clause?.trim() || '',
+ motion ? MOTION_CONTINUITY_CLAUSE : '',
].filter(Boolean).join(', ');
}
diff --git a/server/services/musicVideo/handoff.test.js b/server/services/musicVideo/handoff.test.js
index 4c30d553c7..0d5721eb59 100644
--- a/server/services/musicVideo/handoff.test.js
+++ b/server/services/musicVideo/handoff.test.js
@@ -105,7 +105,7 @@ describe('buildHandoffManifest typography (#8992)', () => {
expect(manifest.visualSpec.typography).toBe('condensed sans, all caps, lower-third titles');
expect(manifest.scenes[0].framePrompt).toBe('harbor at dawn, grainy 16mm, color palette #112233; camera: locked-off wides');
- expect(manifest.scenes[0].shotPrompt).toBe('waves, grainy 16mm, color palette #112233; camera: locked-off wides');
+ expect(manifest.scenes[0].shotPrompt).toBe("waves, grainy 16mm, color palette #112233; camera: locked-off wides, hold the reference frame's lighting, time of day and palette for the whole shot");
expect(manifest.scenes[0].framePrompt).not.toMatch(/typography/i);
expect(manifest.scenes[0].shotPrompt).not.toMatch(/typography/i);
});
@@ -128,5 +128,7 @@ describe('buildHandoffManifest typography (#8992)', () => {
expect(manifest.scenes[0].framePrompt).toContain('Mood board look (palette, lighting and texture only; never its locations, objects or poses): Watercolor');
// The motion prompt starts from the frame, which already carries the look.
expect(manifest.scenes[0].shotPrompt).not.toContain('Watercolor');
+ expect(manifest.scenes[0].shotPrompt).toContain("hold the reference frame's lighting, time of day and palette for the whole shot");
+ expect(manifest.scenes[0].framePrompt).not.toContain('hold the reference frame');
expect(manifest.scenes[0].shotPrompt).toContain('Universe style: Ink silhouettes');
});
diff --git a/server/services/musicVideo/productionDispatch.js b/server/services/musicVideo/productionDispatch.js
index 5d478fb806..39ef7224cf 100644
--- a/server/services/musicVideo/productionDispatch.js
+++ b/server/services/musicVideo/productionDispatch.js
@@ -26,6 +26,7 @@ import { RENDER_TARGET } from '../../lib/renderTargets.js';
import { approximateMotionCues, falSceneTake, falTakeRequestFields, grokCoverage } from '../../lib/musicVideoShotTiming.js';
import { sceneFramePrompt, sceneShotPrompt } from './handoff.js';
import { conditioningReferences, falRouteVideoSettings } from './productionPool.js';
+import { musicVideoFrameGenSize } from '../../lib/musicVideoAspect.js';
const unprompted = (scene, what) => new ServerError(
`"${scene.label || scene.sceneId}" has no ${what} prompt to generate from`,
@@ -57,6 +58,9 @@ async function dispatchFrame({ project, scene, route, tag, settings }) {
const { cleanC2PA, denoise } = resolveImageCleaners(undefined, settings, route.mode);
const common = {
prompt,
+ // The project's aspect, never the backend's per-prompt choice (a portrait
+ // close-up pillarboxes in a 16:9 render).
+ ...musicVideoFrameGenSize(project),
cleanC2PA,
denoise,
...(referenceImagePaths.length ? { referenceImagePaths, referenceImageStrengths: referenceImagePaths.map(() => 1) } : {}),
diff --git a/server/services/musicVideo/productionDispatch.test.js b/server/services/musicVideo/productionDispatch.test.js
index dbbfbc96cb..5454de8cf3 100644
--- a/server/services/musicVideo/productionDispatch.test.js
+++ b/server/services/musicVideo/productionDispatch.test.js
@@ -37,6 +37,8 @@ describe('production scene dispatch (#9066)', () => {
expect(kind).toBe('image');
expect(owner).toBe('music-video-production:mvpr-example');
expect(params).toMatchObject({ mode: 'codex', musicVideo: tag, referenceImageStrengths: [1] });
+ // Frames are requested at the project's aspect (16:9 by default), never left to the backend.
+ expect(params).toMatchObject({ width: 1536, height: 864 });
expect(params.prompt).toMatch(/^a lighthouse, noir/);
expect(params.referenceImagePaths).toHaveLength(1);
expect(params.referenceImagePaths[0]).toMatch(/ref-example\.png$/);
diff --git a/server/services/musicVideo/treatment.js b/server/services/musicVideo/treatment.js
index 60b61a8bff..68c248322c 100644
--- a/server/services/musicVideo/treatment.js
+++ b/server/services/musicVideo/treatment.js
@@ -525,7 +525,7 @@ const directionKey = (d) => fingerprint(DIRECTION_FIELDS.map((f) => d?.[f] ?? nu
function sceneDirection(treatment, direction) {
const clauses = composeDirectionClauses(direction, {
- aspectRatio: treatment.brief.aspectRatio,
+ aspectRatio: treatment.brief.aspectRatio || '16:9',
lipSyncUnavailable: treatment.capabilityGaps.some((g) => g.id === 'lip-sync'),
});
return {