Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix(media-execution): preserve still frame domains across frame rates (#318)

Flandern247fdadfd931
diff --git a/packages/media-execution/src/execute.ts b/packages/media-execution/src/execute.ts
index 9c026add..a4d69604 100644
--- a/packages/media-execution/src/execute.ts
+++ b/packages/media-execution/src/execute.ts
@@ -802,6 +802,7 @@ export async function executeRenderStillVideo(
"select=eq(n\\,0)",
"loop=loop=-1:size=1:start=0",
`trim=start_frame=0:end_frame=${frames}`,
+ `settb=expr=${denominator}/${numerator}`,
`setpts=N*${denominator}/(${numerator}*TB)`,
].join(",");
let argv: string[];
diff --git a/packages/provider-media-local/test/provider.test.ts b/packages/provider-media-local/test/provider.test.ts
index 4a35f4d5..21c31343 100644
--- a/packages/provider-media-local/test/provider.test.ts
+++ b/packages/provider-media-local/test/provider.test.ts
@@ -671,6 +671,26 @@ test("local media Provider transforms A/V and extracts ordinary audio and frame
const spreadInspection = await inspectArtifact(resources, spread);
assert.equal(spreadInspection.streams.length, 1);
assert.equal(spreadInspection.streams[0]?.decodedUnitCount, 15, "two pictures spread over the same frame count");
+ const twentyFourSpread = await executeArtifact(need(
+ "need:render-still-24fps-spread",
+ mediaPipelineCapabilities.renderStill,
+ artifactTypes.blob,
+ canonicalize({
+ request: {
+ frameRate: { numerator: 24, denominator: 1 },
+ frameCount: 144,
+ output: { container: "mp4", codec: "h264", pixelFormat: "yuv420p" },
+ segments: [
+ { startFrame: 0, endFrameExclusive: 24, source: extractedFrame },
+ { startFrame: 24, endFrameExclusive: 96, source: extractedFrame },
+ { startFrame: 96, endFrameExclusive: 144, source: extractedFrame },
+ ],
+ },
+ }),
+ ));
+ const twentyFourInspection = await inspectArtifact(resources, twentyFourSpread);
+ assert.equal(twentyFourInspection.streams[0]?.decodedUnitCount, 144,
+ "three Still segments at 24 fps must preserve the complete frame domain");
const stillSelection = selectMediaStreams(stillInspection, sealMediaSelectionRequest({
video: { mode: "primary-moving" },
audio: { mode: "none" },