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: keep large music video overlays translucent and flag hidden footage (#10565)

[._.]/ Adam Eivy08c830b3edb6
diff --git a/server/services/musicVideo/autoReviewJudge.js b/server/services/musicVideo/autoReviewJudge.js
index 93748d9911..2d5cc0f5d6 100644
--- a/server/services/musicVideo/autoReviewJudge.js
+++ b/server/services/musicVideo/autoReviewJudge.js
@@ -193,6 +193,17 @@ export function gateAutoReview({ parsed, analysis, evidence = {} }) {
checks.composition = parsed.checks.composition;
checks.continuity = parsed.checks.continuity;
}
+ if (Array.isArray(evidence.footageVisibility)) {
+ for (const sample of evidence.footageVisibility) {
+ if (sample.status === 'measured' && sample.hiddenFraction >= 0.5 && sample.hiddenFraction <= 1 && Number.isFinite(sample.atSec)) {
+ checks.composition = 'fail';
+ findings.push({ atSec: sample.atSec, check: 'composition', severity: 'blocking', source: 'analysis', failureCategory: 'composition',
+ note: `Footage hidden: opaque composition covers at least ${Math.round(sample.hiddenFraction * 100)}% of the sampled frame — reduce authored overlays` });
+ } else if (checks.composition !== 'fail' && (sample.status !== 'measured' || !(sample.visibleFraction >= 0.5 && sample.visibleFraction <= 1))) {
+ checks.composition = 'unverified';
+ }
+ }
+ }
if (continuous) {
const freezes = analysis.freezes || [];
for (const f of freezes) {
diff --git a/server/services/musicVideo/autoReviewJudge.test.js b/server/services/musicVideo/autoReviewJudge.test.js
index ef91e4bb57..c80b564eca 100644
--- a/server/services/musicVideo/autoReviewJudge.test.js
+++ b/server/services/musicVideo/autoReviewJudge.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { MAX_REVIEW_IMAGES, SHEET_TILES, buildAutoReviewPrompt, planStripTimes } from './autoReviewJudge.js';
+import { MAX_REVIEW_IMAGES, SHEET_TILES, buildAutoReviewPrompt, gateAutoReview, planStripTimes } from './autoReviewJudge.js';
const sections = (n, span) => Array.from({ length: n }, (_, i) => ({ startSec: (i * span) / n, endSec: ((i + 1) * span) / n }));
@@ -38,3 +38,14 @@ describe('planStripTimes (#9272)', () => {
expect(prompt).toContain('"shotPrompt":"The desk dissolves into circuits"');
});
});
+
+
+describe('footage visibility evidence admission', () => {
+ it('does not allow a clean model result to turn missing footage samples into a pass', () => {
+ const result = gateAutoReview({ parsed: { checks: { composition: 'pass', continuity: 'pass', motion: 'pass' }, findings: [] },
+ analysis: { ok: true, spanSec: 8, avDriftSec: 0, freezes: [] },
+ evidence: { temporal: { status: 'not-applicable', shots: [] }, footageVisibility: [{ atSec: 3, status: 'unverified' }] } });
+ expect(result.verdict).toBe('inconclusive');
+ expect(result.checks.composition).toBe('unverified');
+ });
+});
diff --git a/server/services/musicVideo/autoReviewService.js b/server/services/musicVideo/autoReviewService.js
index 334aa7520e..56a67967c3 100644
--- a/server/services/musicVideo/autoReviewService.js
+++ b/server/services/musicVideo/autoReviewService.js
@@ -209,7 +209,7 @@ async function reviewDraft(project, run, excerpt) {
const temporal = !sections.length && project.scenes?.some(isPerformanceScene)
? { version: 1, status: 'unverified', analyzer: null, reason: 'The draft has no performance-section provenance', shots: [] }
: await analyzeTemporalPerformance({ excerptPath, shots });
- const evidence = { boundaryFrames: hasSheet ? 1 : 0, continuousFrames: frameTimes.length, temporal, excerptStartSec: excerpt.startSec };
+ const evidence = { boundaryFrames: hasSheet ? 1 : 0, continuousFrames: frameTimes.length, temporal, ...(excerpt.footageVisibility ? { footageVisibility: excerpt.footageVisibility } : {}), excerptStartSec: excerpt.startSec };
let parsed = null;
let reviewerError = null;
diff --git a/server/services/musicVideo/documentRender.js b/server/services/musicVideo/documentRender.js
index 9db29dfce8..d90966aff4 100644
--- a/server/services/musicVideo/documentRender.js
+++ b/server/services/musicVideo/documentRender.js
@@ -312,7 +312,7 @@ function documentMuxArgs(videoPath, audioPath, outputPath, { startSec, durationS
* Resolves `{ width, height, fps, durationSec, startSec, boundaryTimes }`.
*/
export async function encodeDocumentComposition({
- project, plan, jobId, audioPath, soundBed = null, outputPath, signal, onProgress, windowStart = null, windowEnd = null, fade = false,
+ project, plan, jobId, audioPath, soundBed = null, outputPath, signal, onProgress, windowStart = null, windowEnd = null, fade = false, collectFootageVisibility = false,
}) {
const { findFfmpeg, runFfmpegProcess, probeVideoGeometry, edgeFadeFilter } = await import('../../lib/ffmpeg.js');
const { stageMusicVideoComposition } = await import('../htmlComposition/index.js');
@@ -368,6 +368,31 @@ export async function encodeDocumentComposition({
}
const target = documentTargetFrame(parsed.data, project);
const window = documentRenderWindow(target, { windowStart, windowEnd });
+ // Sample three moments per footage shot against its actual transformed source.
+ // Bound cost for long edits; unsampled/missing hooks remain explicit unknowns.
+ if (target.width !== parsed.data.width || target.height !== parsed.data.height) {
+ await page.evaluate(`globalThis.portosComposition.layout({ width: ${target.width}, height: ${target.height} })`);
+ }
+ const footageVisibility = [];
+ for (const scene of data.scenes.filter(s => collectFootageVisibility && s.visualLayer === 'footage' && s.startSec < window.startSec + window.durationSec && s.endSec > window.startSec)) {
+ const start = Math.max(scene.startSec, window.startSec);
+ const end = Math.min(scene.endSec, window.startSec + window.durationSec);
+ for (const fraction of [0.2, 0.5, 0.8]) {
+ signal?.throwIfAborted();
+ const at = Math.floor((start + (end - start) * fraction) * target.fps) / target.fps;
+ let sample = null;
+ if (footageVisibility.length < 288) sample = await page.evaluate(`(async () => {
+ const c = globalThis.portosComposition;
+ await c.seek(${at}, { reviewFootage: true });
+ return c.footageVisibility || null;
+ })()`).catch(() => null);
+ const measured = sample?.sceneId === scene.sceneId
+ && ['visibleFraction', 'hiddenFraction', 'measuredFraction'].every(key => Number.isFinite(sample[key]) && sample[key] >= 0 && sample[key] <= 1)
+ && Math.abs(sample.visibleFraction + sample.hiddenFraction - sample.measuredFraction) < 0.001;
+ footageVisibility.push({ sceneId: scene.sceneId, atSec: round3(at - window.startSec),
+ ...(measured ? { status: 'measured', visibleFraction: sample.visibleFraction, hiddenFraction: sample.hiddenFraction, measuredFraction: sample.measuredFraction } : { status: 'unverified' }) });
+ }
+ }
// Long windows split across several browsers (encodeCompositionSegments).
await encodeCompositionSegments(page, { ...target, durationSec: window.durationSec }, silent, {
openPage, encode: encodeComposition,
@@ -397,7 +422,7 @@ export async function encodeDocumentComposition({
return {
width: target.width, height: target.height, fps: target.fps,
durationSec: window.durationSec, startSec: window.startSec,
- boundaryTimes: documentBoundaryTimes(data, window),
+ boundaryTimes: documentBoundaryTimes(data, window), ...(collectFootageVisibility ? { footageVisibility } : {}),
};
} finally {
if (page) await page.close().catch(() => {});
diff --git a/server/services/musicVideo/documentRender.test.js b/server/services/musicVideo/documentRender.test.js
index 5480753bb3..e287bc2014 100644
--- a/server/services/musicVideo/documentRender.test.js
+++ b/server/services/musicVideo/documentRender.test.js
@@ -15,7 +15,7 @@ import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../li
vi.mock('../htmlComposition/encode.js', async (importOriginal) => ({ ...(await importOriginal()), encodeComposition: vi.fn(async () => { throw new Error('stop at encoder'); }) }));
const { encodeComposition } = await import('../htmlComposition/encode.js');
-const { browser } = vi.hoisted(() => ({ browser: { seen: null, contract: null } }));
+const { browser } = vi.hoisted(() => ({ browser: { seen: null, contract: null, visibility: null, sampleTimes: [] } }));
vi.mock('../../lib/paths.js', async (importOriginal) => makePathsProxy(await importOriginal(), {
dataRoot: () => lazyTempDataRoot('portos-mv-document-stage-'),
}));
@@ -24,6 +24,7 @@ vi.mock('../../lib/paths.js', async (importOriginal) => makePathsProxy(await imp
vi.mock('../../lib/ffmpeg.js', async (importOriginal) => ({
...(await importOriginal()),
findFfmpeg: async () => 'ffmpeg',
+ runFfmpegProcess: async () => ({ ok: true }),
}));
// Capture the frozen job folder the page would open, then stop the render.
vi.mock('../htmlComposition/browser.js', () => ({
@@ -39,6 +40,7 @@ vi.mock('../htmlComposition/browser.js', () => ({
browser.seen = { directory, data: window.PORTOS_MV, media, song: JSON.parse(await read(joinPath(dir, 'song.json'), 'utf8')) };
return {
async evaluate(expression) {
+ if (expression.includes('reviewFootage')) { browser.sampleTimes.push(Number(/c.seek\(([^,]+)/.exec(expression)[1])); return browser.visibility; }
if (expression.includes('canPlayType')) return 'probably';
if (browser.contract) return browser.contract;
throw new Error('stop after staging');
@@ -54,7 +56,7 @@ const { PATHS } = await import('../../lib/paths.js');
const { encodeDocumentComposition, documentRenderClock } = await import('./documentRender.js');
afterAll(() => cleanupTempDataRoots());
-beforeEach(() => { browser.seen = null; browser.contract = null; });
+beforeEach(() => { browser.seen = null; browser.contract = null; browser.visibility = null; browser.sampleTimes = []; });
const performanceTake = (assetId) => ({ takeId: 'mvt-p', kind: 'video', assetId, status: 'candidate', shotInstruction: { shotMode: 'performance', edit: { inSec: 0.5, outSec: 3.5 } } });
@@ -150,3 +152,20 @@ it('explains fractional document frames before encoding without changing the imp
expect(browser.contract.durationSec).toBe(10.01);
expect(await scratchEntries()).toEqual([]);
});
+
+
+it('carries measured footage samples and explicit missing hooks from the staged render', async () => {
+ const { project, plan } = await fixture();
+ browser.contract = { durationSec: 30, fps: 24, width: 1920, height: 1080, layout: false };
+ browser.visibility = { sceneId: 'a', visibleFraction: 0.2, hiddenFraction: 0.8, measuredFraction: 1 };
+ encodeComposition.mockResolvedValueOnce({});
+ const result = await encodeDocumentComposition({ project, plan, jobId: 'visibility', audioPath: 'synthetic.wav',
+ outputPath: join(PATHS.videos, 'visibility.mp4'), windowStart: 1, windowEnd: 10, collectFootageVisibility: true });
+ expect(result.footageVisibility).toHaveLength(6); // still/card shots excluded
+ expect(result.footageVisibility.slice(0, 3)).toEqual(browser.sampleTimes.slice(0, 3).map(at => ({
+ sceneId: 'a', atSec: Math.round((at - 1) * 1000) / 1000, status: 'measured', visibleFraction: 0.2, hiddenFraction: 0.8, measuredFraction: 1,
+ })));
+ expect(result.footageVisibility.slice(3)).toEqual(expect.arrayContaining([expect.objectContaining({ sceneId: 'd', status: 'unverified' })]));
+ expect(browser.sampleTimes.every(at => at >= 1 && at < 10)).toBe(true);
+ expect(await scratchEntries()).toEqual([]);
+});
diff --git a/server/services/musicVideo/documentTemplates/layered/engine.js b/server/services/musicVideo/documentTemplates/layered/engine.js
index 003357e1d9..3e32823cc1 100644
--- a/server/services/musicVideo/documentTemplates/layered/engine.js
+++ b/server/services/musicVideo/documentTemplates/layered/engine.js
@@ -441,8 +441,8 @@
// A view of ctx for authored code drawn over footage: a fillRect or clearRect whose
// on-canvas area (after the current transform, clipped to the frame) covers most of it is
// limited to a translucent wash (clears are dropped), and the 'copy' composite mode, which
- // replaces every pixel, is refused. Other full-frame paints (a canvas-sized path fill or
- // drawImage) are not caught here; the prompt tells the model not to make them.
+ // replaces every pixel, is refused. Path fills, drawImage and combined small shapes are checked separately by
+ // the pixel visibility evidence; this fast guard only handles rectangles.
const FOOTAGE_WASH_ALPHA = 0.25;
function footageOverlayContext(target) {
const covers = (x, y, w, h) => {
@@ -452,7 +452,7 @@
const xs = pts.map((p) => p[0]); const ys = pts.map((p) => p[1]);
const cw = Math.max(0, Math.min(W, Math.max(...xs)) - Math.max(0, Math.min(...xs)));
const ch = Math.max(0, Math.min(H, Math.max(...ys)) - Math.max(0, Math.min(...ys)));
- return cw * ch >= W * H * 0.9;
+ return cw * ch >= W * H * 0.45;
};
return new Proxy(target, {
get(obj, prop) {
@@ -476,7 +476,43 @@
});
}
- function render(t, scene, source, state) {
+ // Compare the same camera-transformed footage before and after composition.
+ // Local covariance tolerates color offsets/translucent washes; an opaque panel
+ // loses the source's local variation. Flat source tiles are unknown, never hidden.
+ function compareFootagePixels(before, after, width, height) {
+ let visible = 0; let hidden = 0; let total = 0;
+ for (let y = 0; y < height; y += 8) for (let x = 0; x < width; x += 8) {
+ let count = 0; let sumA = 0; let sumB = 0; let sumAA = 0; let sumAB = 0;
+ // Separate channel means so a flat colored clip doesn't masquerade as texture.
+ let variance = 0; let covariance = 0;
+ for (let channel = 0; channel < 3; channel++) {
+ count = 0; sumA = 0; sumB = 0; sumAA = 0; sumAB = 0;
+ for (let py = y; py < Math.min(height, y + 8); py++) for (let px = x; px < Math.min(width, x + 8); px++) {
+ const offset = (py * width + px) * 4 + channel;
+ const a = before[offset]; const b = after[offset];
+ count++; sumA += a; sumB += b; sumAA += a * a; sumAB += a * b;
+ }
+ variance += sumAA - sumA * sumA / count;
+ covariance += sumAB - sumA * sumB / count;
+ }
+ const pixels = count;
+ total += pixels;
+ if (variance / (pixels * 3) < 16) continue;
+ if (covariance / variance >= 0.5) visible += pixels;
+ else hidden += pixels;
+ }
+ return { visibleFraction: visible / total, hiddenFraction: hidden / total, measuredFraction: (visible + hidden) / total };
+ }
+ const visibilityCanvas = document.createElement('canvas');
+ visibilityCanvas.width = 160; visibilityCanvas.height = 96;
+ const visibilityContext = visibilityCanvas.getContext('2d', { willReadFrequently: true });
+ const footagePixels = () => {
+ visibilityContext.drawImage(canvas, 0, 0, 160, 96);
+ return visibilityContext.getImageData(0, 0, 160, 96).data;
+ };
+ let footageVisibility = null;
+
+ function render(t, scene, source, state, reviewFootage = false) {
ctx.fillStyle = C.ink; ctx.fillRect(0, 0, W, H);
const authored = sectionFunction(t);
if (scene) {
@@ -490,6 +526,7 @@
}
if (isHighEnergy(t)) glitch(t, pulse(t, downs, 8) * state.reactiveGain);
}
+ const before = reviewFootage && source ? footagePixels() : null;
if (authored?.fn) {
const inset = 0.1;
ctx.save();
@@ -515,6 +552,7 @@
const line = SUBTITLES.find((l) => t >= l.startSec && t < l.endSec);
if (line) subtitle(t, line);
}
+ footageVisibility = before ? { sceneId: scene.sceneId, ...compareFootagePixels(before, footagePixels(), 160, 96) } : null;
}
// ---------- contract ----------
@@ -531,13 +569,14 @@
// One timeline, every aspect: the layout hook reframes before capture.
formats: ['1920x1080', '1080x1920', '1080x1080'],
layout({ width, height }) { resize(width, height); },
- async seek(t) {
+ get footageVisibility() { return footageVisibility; },
+ async seek(t, { reviewFootage = false } = {}) {
await ready;
const state = eventState(t);
t = state.t;
const scene = sceneAt(t);
const source = scene && !cardFor(scene) ? await sourceFor(scene, t) : null;
- render(t, scene, source, state);
+ render(t, scene, source, state, reviewFootage);
return true;
},
};
diff --git a/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js b/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js
index b689240a95..d6ee3b483b 100644
--- a/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js
+++ b/server/services/musicVideo/documentTemplates/layered/engine.overlay.test.js
@@ -1,10 +1,13 @@
-import { readFileSync } from 'node:fs';
-import { describe, expect, it } from 'vitest';
+import { existsSync, readFileSync } from 'node:fs';
+import { afterAll, beforeAll, describe, expect, it } from 'vitest';
+
+import { chromium } from 'playwright-core';
+import { gateAutoReview } from '../../autoReviewJudge.js';
// 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 helper = engine.slice(engine.indexOf(' const FOOTAGE_WASH_ALPHA'), engine.indexOf(' function render(t, scene, source, state)'));
+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);
@@ -54,3 +57,65 @@ describe('layered engine footage overlay guard', () => {
expect(ctx.calls).toEqual([['fillRect', 200, 100, 0.6], ['clearRect', 50, 50], ['beginPath']]);
});
});
+
+const chrome = [process.env.CHROME_PATH, chromium.executablePath(),
+ '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',
+].find(path => path && existsSync(path));
+
+describe.skipIf(!chrome)('layered footage review through rendered browser pixels', () => {
+ let browser;
+ beforeAll(async () => { browser = await chromium.launch({ executablePath: chrome, headless: true }); }, 30000);
+ afterAll(async () => { await browser?.close(); });
+
+ async function composed(source, flat = false) {
+ const page = await browser.newPage();
+ try {
+ await page.setContent('<canvas id="stage"></canvas>');
+ await page.evaluate(({ source, flat }) => {
+ const texture = document.createElement('canvas'); texture.width = 320; texture.height = 180;
+ const c = texture.getContext('2d');
+ for (let y = 0; y < 180; y += 4) for (let x = 0; x < 320; x += 4) {
+ c.fillStyle = flat ? '#336699' : ((x + y) % 8 ? '#2581da' : '#edc75f'); c.fillRect(x, y, 4, 4);
+ }
+ window.PORTOS_MV = { render: { width: 320, height: 180, fps: 24, durationSec: 8 }, song: {},
+ scenes: [{ sceneId: 'synthetic-shot', startSec: 0, endSec: 8, visualLayer: 'footage', media: { kind: 'image', src: texture.toDataURL() } }] };
+ window.PORTOS_MV_GENERATED = { song: { sections: [{ id: 'opening', startSec: 0, endSec: 8 }] },
+ sections: { opening: new Function('ctx', 'env', source) } };
+ }, { source, flat });
+ await page.addScriptTag({ content: engine });
+ return await page.evaluate(async () => {
+ await portosComposition.seek(3, { reviewFootage: true });
+ return portosComposition.footageVisibility;
+ });
+ } finally { await page.close(); }
+ }
+ const review = (sample) => gateAutoReview({
+ parsed: { checks: { composition: 'pass', continuity: 'pass', motion: 'pass' }, findings: [] },
+ analysis: { ok: true, spanSec: 8, avDriftSec: 0, freezes: [] },
+ evidence: { temporal: { status: 'not-applicable', shots: [] }, footageVisibility: [{ ...sample, status: 'measured', atSec: 3 }] },
+ });
+
+ it('keeps the reported 48% panel translucent over actual transformed footage', async () => {
+ const sample = await composed('ctx.fillStyle="#070b25"; ctx.fillRect(env.width*.1,env.height*.2,env.width*.8,env.height*.6);');
+ expect(sample.visibleFraction).toBeGreaterThan(0.8);
+ expect(review(sample).verdict).toBe('pass');
+ });
+
+ it('blocks a mostly opaque path even when the model passes with zero findings', async () => {
+ const sample = await composed('ctx.fillStyle="#070b25"; ctx.beginPath(); ctx.rect(0,0,env.width*.8,env.height); ctx.fill();');
+ expect(sample.hiddenFraction).toBeGreaterThan(0.65);
+ const result = review(sample);
+ expect(result.verdict).toBe('revise');
+ expect(result.findings).toContainEqual(expect.objectContaining({ atSec: 3, severity: 'blocking', failureCategory: 'composition', source: 'analysis' }));
+ expect(result.findings[0].note).toContain('Footage hidden');
+ });
+
+ it('allows a translucent styled path and stays inconclusive for a solid source', async () => {
+ const translucent = await composed('ctx.globalAlpha=.25; ctx.fillStyle="#a02050"; ctx.beginPath(); ctx.rect(0,0,env.width,env.height); ctx.fill();');
+ expect(review(translucent).verdict).toBe('pass');
+ const flat = await composed('ctx.fillStyle="#070b25"; ctx.beginPath(); ctx.rect(0,0,env.width,env.height); ctx.fill();', true);
+ expect(flat.measuredFraction).toBe(0);
+ expect(review(flat).verdict).toBe('inconclusive');
+ expect(review(flat).findings).toEqual([]);
+ });
+});
diff --git a/server/services/musicVideo/excerptRender.js b/server/services/musicVideo/excerptRender.js
index d6b39d0efc..ce4ddd9087 100644
--- a/server/services/musicVideo/excerptRender.js
+++ b/server/services/musicVideo/excerptRender.js
@@ -17,6 +17,7 @@
* the SAME project while one is already in flight.
*/
+import { documentSceneVisualLayer } from '../../lib/musicVideoLayers.js';
import { captureMusicVideoEvidence } from '../../lib/musicVideoDependencies.js';
import { withBackupAssetPublication } from '../../lib/backupSnapshotBoundary.js';
import { unlink } from 'fs/promises';
@@ -127,11 +128,11 @@ const SEEKED_EXCERPTS = Object.freeze({
const plan = await prepareDocumentRender(project);
const songSections = (project.scenes || [])
.filter((s) => s?.sceneId && typeof s.startSec === 'number' && typeof s.endSec === 'number' && s.endSec > s.startSec)
- .map((s) => ({ sceneId: s.sceneId, startSec: s.startSec, endSec: s.endSec }));
+ .map((s) => ({ sceneId: s.sceneId, layer: documentSceneVisualLayer(project, s, { generated: project.composition?.document?.source?.kind === 'generated' }), startSec: s.startSec, endSec: s.endSec }));
return { plan, totalSec: plan.durationSec, songSections };
},
encode: ({ prepared, project, jobId, audioPath, soundBed, outputPath, signal, onProgress, startSec, endSec, fade }) => encodeDocumentComposition({
- project, plan: prepared.plan, jobId, audioPath, soundBed, outputPath, signal, onProgress, windowStart: startSec, windowEnd: endSec, fade,
+ project, plan: prepared.plan, jobId, audioPath, soundBed, outputPath, signal, onProgress, windowStart: startSec, windowEnd: endSec, fade, collectFootageVisibility: true,
}),
},
});
@@ -208,7 +209,7 @@ async function launchSeekedExcerpt({ projectId, project: stored, startSec, endSe
console.warn(`⚠️ Music-video ${renderer.label} excerpt contact sheet failed [${jobId.slice(4, 12)}]: ${err.message}`);
contactSheetFilename = null;
}
- const persisted = await finalize({ status: 'complete', filename, contactSheetFilename, error: null, jobId: null, width: encoded.width ?? null, height: encoded.height ?? null });
+ const persisted = await finalize({ status: 'complete', filename, contactSheetFilename, error: null, jobId: null, width: encoded.width ?? null, height: encoded.height ?? null, ...(encoded.footageVisibility ? { footageVisibility: encoded.footageVisibility } : {}) });
if (!persisted) {
await unlink(outputPath).catch(() => {});
broadcastSse(job, { type: 'error', error: 'The excerpt rendered, but saving the result failed — reload the project and try again' });
diff --git a/server/services/musicVideo/render.document.test.js b/server/services/musicVideo/render.document.test.js
index 16a2b35fda..3dd0140cda 100644
--- a/server/services/musicVideo/render.document.test.js
+++ b/server/services/musicVideo/render.document.test.js
@@ -93,14 +93,16 @@ describe('composition-document render plan', () => {
const id = await documentProject();
await importDocumentTemplate(id);
encodeDocumentComposition.mockClear();
+ const visibility = [{ sceneId: 'example-shot', atSec: 1, status: 'measured', visibleFraction: 0.2, hiddenFraction: 0.8, measuredFraction: 1 }];
+ encodeDocumentComposition.mockResolvedValueOnce({ width: 1080, height: 1920, fps: 24, boundaryTimes: [0], footageVisibility: visibility });
const { excerptId } = await startExcerptRender(id, { startSec: 1, endSec: 4, aspect: '9:16', fade: true });
await vi.waitFor(async () => expect((await projects.getProject(id)).excerpts.find((e) => e.id === excerptId).status).toBe('complete'));
const call = encodeDocumentComposition.mock.calls.at(-1)[0];
- expect(call).toMatchObject({ fade: true, windowStart: 1, windowEnd: 4, plan: { width: 1080, height: 1920 } });
+ expect(call).toMatchObject({ fade: true, collectFootageVisibility: true, windowStart: 1, windowEnd: 4, plan: { width: 1080, height: 1920 } });
expect(call.project.treatment.brief.aspectRatio).toBe('9:16');
const stored = await projects.getProject(id);
expect(stored.treatment?.brief?.aspectRatio ?? '16:9').toBe('16:9');
- expect(stored.excerpts.find((e) => e.id === excerptId)).toMatchObject({ aspect: '9:16', fade: true, width: 1080, height: 1920 });
+ expect(stored.excerpts.find((e) => e.id === excerptId)).toMatchObject({ aspect: '9:16', fade: true, width: 1080, height: 1920, footageVisibility: visibility });
});
it('refuses a social cut of a footage project, which has no frame of its own to re-lay-out (#9280)', async () => {