@hyperframes/producer 0.8.184 → 0.8.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10771,7 +10771,6 @@ async function enforceAacTruePeak(input) {
10771
10771
  try {
10772
10772
  scratchDir = mkdtempSync3(join25(dirname9(input.audioPath), ".true-peak-"));
10773
10773
  const correctedPath = join25(scratchDir, "audio.m4a");
10774
- const correctionTargetDbfs = AAC_DELIVERY_TRUE_PEAK_DBFS - AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB;
10775
10774
  const measurements = [];
10776
10775
  let attenuationDb = 0;
10777
10776
  let measuredPath = input.audioPath;
@@ -10789,7 +10788,8 @@ async function enforceAacTruePeak(input) {
10789
10788
  return { success: true, loweredDb: Number((-attenuationDb).toFixed(2)) };
10790
10789
  }
10791
10790
  if (pass === MAX_TRUE_PEAK_CORRECTION_PASSES) break;
10792
- attenuationDb += correctionTargetDbfs - truePeakDbfs;
10791
+ const headroomDb = AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB * 2 ** pass;
10792
+ attenuationDb += AAC_DELIVERY_TRUE_PEAK_DBFS - headroomDb - truePeakDbfs;
10793
10793
  const result = await input.encode(
10794
10794
  input.audioPath,
10795
10795
  correctedPath,
@@ -14145,7 +14145,14 @@ var RenderChunkValidationError = class extends Error {
14145
14145
  }
14146
14146
  };
14147
14147
  function createChunkVideoFrameInjectorFactory(frameLookup) {
14148
- return () => createVideoFrameInjector2(frameLookup);
14148
+ if (!(frameLookup instanceof Promise)) return () => createVideoFrameInjector2(frameLookup);
14149
+ return () => {
14150
+ let hook;
14151
+ return async (page, time, heldVideoTime) => {
14152
+ hook ??= createVideoFrameInjector2(await frameLookup);
14153
+ await hook?.(page, time, heldVideoTime);
14154
+ };
14155
+ };
14149
14156
  }
14150
14157
  function frameNumberFromFileName(name) {
14151
14158
  const match = /(\d+)(?=\.[^.]+$)/.exec(name);
@@ -17166,9 +17173,6 @@ function validateOutputResolutionOverride(body) {
17166
17173
  if (body.outputResolution.trim().length > 0 && normalized === void 0) {
17167
17174
  return `Invalid outputResolution "${body.outputResolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k (aliases: 1080p, 4k, \u2026).`;
17168
17175
  }
17169
- if (normalized !== void 0 && (body.format === "webm" || body.format === "mov")) {
17170
- return `outputResolution is not supported with format "${body.format}": the alpha (webm/mov) capture path can't supersample. Use format "mp4", or omit outputResolution to render at the composition's native dimensions.`;
17171
- }
17172
17176
  return void 0;
17173
17177
  }
17174
17178
  function prepareProjectDirectory(projectDir, options) {
@@ -19155,6 +19159,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19155
19159
  const captureAttempts = [];
19156
19160
  let forceScreenshotForChunk = encoder.forceScreenshot;
19157
19161
  let shownBoxes;
19162
+ let extraction;
19158
19163
  try {
19159
19164
  if (chunkWorkerCount === 1 || !forceScreenshotForChunk) {
19160
19165
  const bootStarted = Date.now();
@@ -19211,7 +19216,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19211
19216
  session = null;
19212
19217
  }
19213
19218
  }
19214
- const deferredVideoFrames = planVideos ? await extractDeferredVideoFramesForChunk({
19219
+ const deferredVideoFrames = planVideos ? extractDeferredVideoFramesForChunk({
19215
19220
  planDir,
19216
19221
  planVideos,
19217
19222
  frames: chunkFrameNumbers,
@@ -19220,19 +19225,24 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19220
19225
  cfg,
19221
19226
  remoteSources,
19222
19227
  shownBoxes
19223
- }) : [];
19224
- const videoFrameLookup = planVideos && planVideos.extracted.length > 0 ? createFrameLookupTable5(
19225
- planVideos.videos,
19226
- [
19227
- ...rebuildExtractedFramesFromPlanDir(
19228
- planDir,
19229
- planVideos.extracted.filter((video) => !video.deferredRange),
19230
- v2Manifest === null ? "dense-v1" : "sparse-v2"
19231
- ),
19232
- ...deferredVideoFrames
19233
- ],
19234
- resolveRenderFpsConfig(job.config.fps).value
19228
+ }) : Promise.resolve([]);
19229
+ extraction = deferredVideoFrames;
19230
+ const videoFrameLookup = planVideos && planVideos.extracted.length > 0 ? deferredVideoFrames.then(
19231
+ (deferred) => createFrameLookupTable5(
19232
+ planVideos.videos,
19233
+ [
19234
+ ...rebuildExtractedFramesFromPlanDir(
19235
+ planDir,
19236
+ planVideos.extracted.filter((video) => !video.deferredRange),
19237
+ v2Manifest === null ? "dense-v1" : "sparse-v2"
19238
+ ),
19239
+ ...deferred
19240
+ ],
19241
+ resolveRenderFpsConfig(job.config.fps).value
19242
+ )
19235
19243
  ) : null;
19244
+ videoFrameLookup?.catch(() => {
19245
+ });
19236
19246
  const createChunkVideoFrameInjector = createChunkVideoFrameInjectorFactory(videoFrameLookup);
19237
19247
  const captureStarted = Date.now();
19238
19248
  captureMode = await runCaptureWithScreenshotFallback({
@@ -19315,7 +19325,11 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19315
19325
  }
19316
19326
  );
19317
19327
  }
19328
+ }).catch(async (captureError) => {
19329
+ await deferredVideoFrames;
19330
+ throw captureError;
19318
19331
  });
19332
+ await deferredVideoFrames;
19319
19333
  captureStageMs = Date.now() - captureStarted;
19320
19334
  applyRenderWarningPolicy(
19321
19335
  job,
@@ -19394,6 +19408,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
19394
19408
  }
19395
19409
  encodeStageMs = Date.now() - encodeStarted;
19396
19410
  } finally {
19411
+ await extraction?.catch(() => {
19412
+ });
19397
19413
  if (session) {
19398
19414
  try {
19399
19415
  await closeCaptureSession11(session);
@@ -10744,7 +10744,6 @@ async function enforceAacTruePeak(input) {
10744
10744
  try {
10745
10745
  scratchDir = mkdtempSync3(join25(dirname9(input.audioPath), ".true-peak-"));
10746
10746
  const correctedPath = join25(scratchDir, "audio.m4a");
10747
- const correctionTargetDbfs = AAC_DELIVERY_TRUE_PEAK_DBFS - AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB;
10748
10747
  const measurements = [];
10749
10748
  let attenuationDb = 0;
10750
10749
  let measuredPath = input.audioPath;
@@ -10762,7 +10761,8 @@ async function enforceAacTruePeak(input) {
10762
10761
  return { success: true, loweredDb: Number((-attenuationDb).toFixed(2)) };
10763
10762
  }
10764
10763
  if (pass === MAX_TRUE_PEAK_CORRECTION_PASSES) break;
10765
- attenuationDb += correctionTargetDbfs - truePeakDbfs;
10764
+ const headroomDb = AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB * 2 ** pass;
10765
+ attenuationDb += AAC_DELIVERY_TRUE_PEAK_DBFS - headroomDb - truePeakDbfs;
10766
10766
  const result = await input.encode(
10767
10767
  input.audioPath,
10768
10768
  correctedPath,
@@ -14473,9 +14473,6 @@ function validateOutputResolutionOverride(body) {
14473
14473
  if (body.outputResolution.trim().length > 0 && normalized === void 0) {
14474
14474
  return `Invalid outputResolution "${body.outputResolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k (aliases: 1080p, 4k, \u2026).`;
14475
14475
  }
14476
- if (normalized !== void 0 && (body.format === "webm" || body.format === "mov")) {
14477
- return `outputResolution is not supported with format "${body.format}": the alpha (webm/mov) capture path can't supersample. Use format "mp4", or omit outputResolution to render at the composition's native dimensions.`;
14478
- }
14479
14476
  return void 0;
14480
14477
  }
14481
14478
  function prepareProjectDirectory(projectDir, options) {
@@ -17,7 +17,7 @@ export declare class RenderChunkValidationError extends Error {
17
17
  constructor(code: RenderChunkValidationCode, message: string);
18
18
  }
19
19
  /** One injector per browser session: a hook reused on a fresh page can skip its first injection. */
20
- export declare function createChunkVideoFrameInjectorFactory(frameLookup: FrameLookupTable | null): () => BeforeCaptureHook | null;
20
+ export declare function createChunkVideoFrameInjectorFactory(frameLookup: FrameLookupTable | Promise<FrameLookupTable> | null): () => BeforeCaptureHook | null;
21
21
  /**
22
22
  * Rebuilds `ExtractedFrames[]` from `<planDir>/video-frames/<videoId>/`. `framePaths` keys are 0-based
23
23
  * frame indexes (what `getFrameAtTime` reads); any other key drops every video's first-paint frame.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.8.184",
3
+ "version": "0.8.185",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "^25.2.1",
37
37
  "puppeteer-core": "^25.2.1",
38
- "@hyperframes/core": "0.8.184",
39
- "@hyperframes/engine": "0.8.184",
40
- "@hyperframes/lint": "0.8.184",
41
- "@hyperframes/parsers": "0.8.184",
42
- "@hyperframes/studio-server": "0.8.184"
38
+ "@hyperframes/lint": "0.8.185",
39
+ "@hyperframes/parsers": "0.8.185",
40
+ "@hyperframes/studio-server": "0.8.185",
41
+ "@hyperframes/engine": "0.8.185",
42
+ "@hyperframes/core": "0.8.185"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",
@@ -48,7 +48,7 @@
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^4.1.11",
51
- "@hyperframes/aws-lambda": "0.8.184"
51
+ "@hyperframes/aws-lambda": "0.8.185"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"