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

test: pin output-time holds when clip speed changes (#11393)

[._.]/ Adam Eivy91d911bf6c0a
diff --git a/server/services/musicVideo/documentRender.browser.test.js b/server/services/musicVideo/documentRender.browser.test.js
index c4dc0bf161..3ac574b3ce 100644
--- a/server/services/musicVideo/documentRender.browser.test.js
+++ b/server/services/musicVideo/documentRender.browser.test.js
@@ -520,6 +520,7 @@ describe.skipIf(!canRun)('layered template with real Chrome and ffmpeg', () => {
// Uniquely catches correct timing metadata paired with an unretimed staged file.
[
{ timing: { speedFps: 24, offsetFrames: 12 }, samples: [[0, 1], [5, 1], [6, 2]] },
+ { timing: { speedFps: 24, offsetFrames: -6 }, samples: [[0, 0], [11, 0], [12, 1], [17, 1], [18, 2]] },
{ timing: { offsetFrames: -6 }, samples: [[0, 0], [17, 0], [18, 1], [29, 1], [30, 2]] },
].forEach(({ timing, samples }) => it(`renders shot speed and offset ${JSON.stringify(timing)} into the document pixels`, async () => {
await mkdir(PATHS.videos, { recursive: true });
diff --git a/server/services/musicVideo/documentRender.js b/server/services/musicVideo/documentRender.js
index 136e9ab8d9..1557ec5f7f 100644
--- a/server/services/musicVideo/documentRender.js
+++ b/server/services/musicVideo/documentRender.js
@@ -149,6 +149,8 @@ export async function resolveSceneMedia(project, { history = [], probe = async (
const originalOut = edit ? Math.min(edit.outSec, duration ?? edit.outSec) : duration;
const start = originalIn + (retimed ? clipOffsetSec(scene) : 0);
const sourceIn = Math.min(duration ?? Infinity, Math.max(0, start));
+ // Offset holds are song/output seconds, independent of playback rate:
+ // clipTimeAt uses sourceIn + max(0, local + min(0, start)) * rate.
const leadSec = Math.max(0, -start);
const retime = rate !== 1 || leadSec > 0;
out.set(scene.sceneId, {
diff --git a/server/services/musicVideo/documentRender.test.js b/server/services/musicVideo/documentRender.test.js
index bbdd10cee3..6271d256bc 100644
--- a/server/services/musicVideo/documentRender.test.js
+++ b/server/services/musicVideo/documentRender.test.js
@@ -131,6 +131,7 @@ describe('isolated document preview ownership', () => {
describe('composition document staging', () => {
it.each([
{ timing: { speedFps: 24, offsetFrames: 12 }, inSec: 0.25, outSec: 2, filter: 'setpts=(PTS-STARTPTS)/2,fps=24' },
+ { timing: { speedFps: 24, offsetFrames: -6 }, inSec: 0, outSec: 2.25, filter: 'setpts=(PTS-STARTPTS)/2,tpad=start_mode=clone:start_duration=0.25,fps=24' },
{ timing: { offsetFrames: -6 }, inSec: 0, outSec: 4.25, filter: 'setpts=(PTS-STARTPTS)/1,tpad=start_mode=clone:start_duration=0.25,fps=24' },
])('stages shot timing $timing on the document output timebase', async ({ timing, inSec, outSec, filter }) => {
const { project, plan } = await fixture();