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

refactor: keep the title-card cue builder with the other typography cues (#8985)

[._.]/ Adam Eivya02772641754
diff --git a/server/services/musicVideo/composition.js b/server/services/musicVideo/composition.js
index 8e839ed919..7b4d08fb57 100644
--- a/server/services/musicVideo/composition.js
+++ b/server/services/musicVideo/composition.js
@@ -93,6 +93,22 @@ export function renderableCues(composition, durationSec) {
.sort((a, b) => a.startSec - b.startSec);
}
+/**
+ * A title card's text (#8985), drawn by the typography layer for exactly its
+ * section on the output timebase (`sections` from buildMusicVideoFfmpegArgs),
+ * clipped to the rendered video.
+ */
+export function sectionCardCues(clips, sections, durationSec) {
+ const textBySceneId = new Map(clips.filter((c) => c.layer === 'card' && c.cardText).map((c) => [c.sceneId, c.cardText]));
+ 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: 'fade', placement: 'center', emphasis: 'hero',
+ }));
+}
+
/**
* Pure and self-contained (its source is embedded in the overlay page, so it
* must not reference anything outside its own body): the visual state of `cue`
diff --git a/server/services/musicVideo/compositionRender.test.js b/server/services/musicVideo/compositionRender.test.js
index c22649eb5f..0539300e9b 100644
--- a/server/services/musicVideo/compositionRender.test.js
+++ b/server/services/musicVideo/compositionRender.test.js
@@ -8,8 +8,8 @@ import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../li
import { findFfmpeg, probeVideoDuration } from '../../lib/ffmpeg.js';
import { PATHS } from '../../lib/fileUtils.js';
import { _cleanupTestBrowser } from '../htmlComposition/testBrowserCleanup.js';
-import { beatSnapClips, buildMusicVideoFfmpegArgs, resolveSceneClips, sectionCardCues } from './render.js';
-import { renderableCues } from './composition.js';
+import { beatSnapClips, buildMusicVideoFfmpegArgs, resolveSceneClips } from './render.js';
+import { renderableCues, sectionCardCues } from './composition.js';
import { COMPOSITION_SCRATCH_DIR, removeCompositionScratch, renderTypographyOverlays } from './compositionRender.js';
let endpoint;
diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.js
index 083b3412d0..a90747d8b4 100644
--- a/server/services/musicVideo/render.js
+++ b/server/services/musicVideo/render.js
@@ -36,7 +36,7 @@ import { loadHistory, mutateVideoHistory } from '../videoGen/local.js';
import { getTrack } from '../tracks/index.js';
import { getProject, listProjects, updateProject } from './projects.js';
import { sceneHasAuthoredSpan, sceneVisualLayer } from '../../lib/musicVideoLayers.js';
-import { renderableCues } from './composition.js';
+import { renderableCues, sectionCardCues } from './composition.js';
import { renderTypographyOverlays, removeCompositionScratch, sweepCompositionScratch } from './compositionRender.js';
// Per-project render mutex (keyed by projectId so two projects can render in
@@ -426,19 +426,6 @@ export function buildMusicVideoFfmpegArgs(clips, audioPath, outputPath, { audioD
return { args, totalDuration, canonW, canonH, fps, sections };
}
-// A title card's text (#8985) is drawn by the typography layer for exactly
-// its section on the output timebase, clipped to the rendered video.
-export function sectionCardCues(clips, sections, durationSec) {
- const textBySceneId = new Map(clips.filter((c) => c.layer === 'card' && c.cardText).map((c) => [c.sceneId, c.cardText]));
- 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: 'fade', placement: 'center', emphasis: 'hero',
- }));
-}
-
export async function renderMusicVideo(projectId) {
const project = await getProject(projectId);
if (!project) throw new ServerError('Project not found', { status: 404, code: 'NOT_FOUND' });