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

Show silence-marked card lines in composed renders in the lyric type look (#11185)

Adam Eivy5cc78f002452
diff --git a/server/services/musicVideo/composition.js b/server/services/musicVideo/composition.js
index 0c0804ff40..c5fe5fcca0 100644
--- a/server/services/musicVideo/composition.js
+++ b/server/services/musicVideo/composition.js
@@ -246,13 +246,15 @@ export function projectTypographyPlan(project, clips, sections, durationSec) {
* clipped to the rendered video.
*/
export function sectionCardCues(clips, sections, durationSec, graphicLanguage = '') {
- const textBySceneId = new Map(clips.filter((c) => c.layer === 'card' && c.cardText).map((c) => [c.sceneId, c.cardText]));
+ // A sheet line break is stored as " / "; on a card each sheet line is its own line.
+ const textBySceneId = new Map(clips.filter((c) => c.layer === 'card' && c.cardText)
+ .map((c) => [c.sceneId, c.cardText.split(/\s+\/\s+/).map((l) => l.trim()).filter(Boolean).join('\n')]));
return sections
.filter((section) => textBySceneId.has(section.sceneId) && section.startSec < durationSec)
.map((section) => ({
id: `card-${section.sceneId}`, text: textBySceneId.get(section.sceneId),
startSec: section.startSec, endSec: Math.min(section.endSec, durationSec),
- template: /\b(pictograms?|counters?|hud)\b/i.test(graphicLanguage) ? 'pop' : 'fade', placement: 'center', emphasis: 'hero',
+ template: /\b(pictograms?|counters?|hud)\b/i.test(graphicLanguage) ? 'pop' : 'fade', placement: 'center', emphasis: 'hero', card: true,
}));
}
@@ -323,6 +325,8 @@ export function overlayWindows(cues, { joinGapSec = 1 } = {}) {
// Title-safe area: 10% in from every edge of the frame, at any aspect.
export const SAFE_INSET = 0.1;
+// The lyric type face, copied next to the overlay page by renderTypographyOverlays.
+export const LYRIC_FONT_FILE = 'archivo-variable.woff2';
const FONT_STACKS = {
sans: "'Helvetica Neue', Helvetica, Arial, sans-serif",
serif: "Georgia, 'Times New Roman', serif",
@@ -340,11 +344,13 @@ const scriptJson = (value) => JSON.stringify(value).replace(/</g, '\\u003c');
* box never changes between frames and cannot leave the safe area.
*/
export function buildTypographyDocument({ cues, style = {}, width, height, durationSec, fps }) {
- const payload = cues.map(({ id, text, startSec, endSec, template, placement, emphasis, words }) => ({ id, text, startSec, endSec, template, placement, emphasis, ...(words ? { words } : {}) }));
+ const payload = cues.map(({ id, text, startSec, endSec, template, placement, emphasis, words, card }) => ({ id, text, startSec, endSec, template, placement, emphasis, ...(words ? { words } : {}), ...(card ? { card: true } : {}) }));
+ const hud = /\b(hud|counters?)\b/i.test(style.graphicLanguage || '');
const color = /^#[0-9a-f]{6}$/i.test(style.color || '') ? style.color : '#ffffff';
- const fontStack = /\b(hud|counters?)\b/i.test(style.graphicLanguage || '') ? FONT_STACKS.mono : (FONT_STACKS[style.font] || FONT_STACKS.sans);
+ const fontStack = hud ? FONT_STACKS.mono : (FONT_STACKS[style.font] || FONT_STACKS.sans);
const accent = /^#[0-9a-f]{6}$/i.test(style.accentColor || '') ? style.accentColor : '#ff5a1f';
return `<!doctype html><html><head><meta charset="utf-8"><style>
+@font-face { font-family: "MV Archivo"; src: url(${LYRIC_FONT_FILE}) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; }
html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }
#safe { position: absolute; }
.cue { position: absolute; left: 0; right: 0; box-sizing: border-box; padding: 0.25em; text-align: center; color: ${color}; font-family: ${fontStack};
@@ -352,6 +358,9 @@ html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }
/* The padding keeps this legibility shadow inside the cue box, and so inside the safe area. */
text-shadow: 0 0 0.12em rgba(0,0,0,0.85), 0 0.04em 0.18em rgba(0,0,0,0.7); }
.cue .rest { visibility: hidden; }
+/* Title cards use the lyric type look (lyricType.js): cream fill, ink outline, no plate. */
+.cue.card { white-space: pre-line; font-family: ${hud ? fontStack : '"MV Archivo", "Arial Black", Impact, sans-serif'}; font-weight: 800; line-height: 1.05;
+ color: #f3ead7; text-shadow: none; -webkit-text-stroke: 0.14em #141217; paint-order: stroke fill; }
/* #9291 word build: heavy condensed caps, words hold their place as they land. */
.cue.build { text-align: left; font-family: Impact, "Arial Narrow Bold", "Arial Narrow", ${fontStack}; font-weight: 900; text-transform: uppercase; letter-spacing: 0.01em; line-height: 0.98; }
.cue.build .word { visibility: hidden; }
@@ -363,7 +372,7 @@ const cueStateAt = ${cueStateAt.toString()};
const safe = document.getElementById('safe');
const nodes = CUES.map((cue) => {
const el = document.createElement('div');
- el.className = cue.template === 'build' ? 'cue build' : 'cue';
+ el.className = cue.template === 'build' ? 'cue build' : cue.card ? 'cue card' : 'cue';
const shown = document.createElement('span');
const rest = document.createElement('span');
rest.className = 'rest';
diff --git a/server/services/musicVideo/composition.test.js b/server/services/musicVideo/composition.test.js
index 47a540e046..ece2df260c 100644
--- a/server/services/musicVideo/composition.test.js
+++ b/server/services/musicVideo/composition.test.js
@@ -88,6 +88,18 @@ describe('overlayWindows (#8984)', () => {
});
});
+describe('card cues (#11185)', () => {
+ it('turns the sheet joiner into real line breaks and draws in the lyric type look', () => {
+ const cards = sectionCardCues(
+ [{ sceneId: 's1', layer: 'card', cardText: 'First line / Second line' }],
+ [{ sceneId: 's1', startSec: 0, endSec: 3 }], 10);
+ expect(cards[0].text).toBe('First line\nSecond line');
+ const html = buildTypographyDocument({ cues: cards, width: 1280, height: 720, durationSec: 10, fps: 24 });
+ expect(html).toContain('"MV Archivo"');
+ expect(html).toContain('white-space: pre-line');
+ });
+});
+
describe('buildTypographyDocument (#8984)', () => {
it('embeds cue text as inert data that cannot close the script element', () => {
const html = buildTypographyDocument({ cues: [cue({ text: '</script><img src=x onerror=alert(1)>' })], width: 1920, height: 1080, durationSec: 30, fps: 24 });
diff --git a/server/services/musicVideo/compositionRender.js b/server/services/musicVideo/compositionRender.js
index 5a96802593..8e49822e82 100644
--- a/server/services/musicVideo/compositionRender.js
+++ b/server/services/musicVideo/compositionRender.js
@@ -15,13 +15,16 @@
*/
import { join } from 'path';
-import { mkdir, rm, writeFile } from 'fs/promises';
+import { copyFile, mkdir, rm, writeFile } from 'fs/promises';
+import { fileURLToPath } from 'url';
import { spawn } from '../../lib/childProcess.js';
import { PATHS } from '../../lib/fileUtils.js';
import { findFfmpeg } from '../../lib/ffmpeg.js';
import { safeChildProcessOptions } from '../../lib/processEnv.js';
import { killWithEscalation } from '../../lib/killWithEscalation.js';
-import { buildTypographyDocument, overlayWindows } from './composition.js';
+import { buildTypographyDocument, LYRIC_FONT_FILE, overlayWindows } from './composition.js';
+
+const LYRIC_FONT_SOURCE = fileURLToPath(new URL(`./documentTemplates/shared/fonts/${LYRIC_FONT_FILE}`, import.meta.url));
export const COMPOSITION_SCRATCH_DIR = 'music-video-compositions';
@@ -140,6 +143,7 @@ export async function renderTypographyOverlays({ jobId, cues, style, width, heig
const root = scratchPath(jobId);
await mkdir(join(root, 'doc'), { recursive: true });
await writeFile(join(root, 'doc', 'index.html'), buildTypographyDocument({ cues, style, width, height, durationSec, fps }));
+ if (cues.some((c) => c.card)) await copyFile(LYRIC_FONT_SOURCE, join(root, 'doc', LYRIC_FONT_FILE));
signal?.throwIfAborted();
// Lazy: the composition browser drags in browserService, which only a
// composed render needs — not every suite that reaches render.js.
diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.js
index 61b43f3a2f..270af35877 100644
--- a/server/services/musicVideo/render.js
+++ b/server/services/musicVideo/render.js
@@ -240,7 +240,9 @@ export async function resolveSceneClips(project, { layered = false, stillForMiss
continue;
}
if (layer === 'card') {
- clips.push({ ...section, cardText: typeof scene.cardText === 'string' ? scene.cardText.trim() : '', cardColor: /^#[0-9a-f]{6}$/i.test(scene.cardColor || '') ? scene.cardColor : '#000000' });
+ // A blank card falls back to the shot's own line, so a silence card is not left black.
+ const cardText = [scene.cardText, scene.lyricText].find((t) => typeof t === 'string' && t.trim())?.trim() || '';
+ clips.push({ ...section, cardText, cardColor: /^#[0-9a-f]{6}$/i.test(scene.cardColor || '') ? scene.cardColor : '#000000' });
continue;
}
const imagePath = scene.referenceImageId ? safeUnder(PATHS.images, scene.referenceImageId) : null;
diff --git a/server/services/musicVideo/shotPlan.js b/server/services/musicVideo/shotPlan.js
index 8428a6e105..52b28b1f3d 100644
--- a/server/services/musicVideo/shotPlan.js
+++ b/server/services/musicVideo/shotPlan.js
@@ -326,7 +326,7 @@ function directShotsByCast(shots, project) {
return {
...shot, delivery, set, look, protagonist: direction.protagonist,
visualLayer: card ? 'card' : 'footage', shotMode: 'cutaway',
- ...(card ? { cardText: silence ? '' : (shot.lyricText || project.name || '').slice(0, 500) } : {}),
+ ...(card ? { cardText: (silence ? (shot.lyricText || '') : (shot.lyricText || project.name || '')).slice(0, 500) } : {}),
performanceCandidate: !card && !!shot.lyricText && (intimate || (sungHook && kinds.length === 0)),
};
});