@hyperframes/producer 0.8.147 → 0.8.149

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
@@ -1893,7 +1893,8 @@ import {
1893
1893
  groupIntoLayers,
1894
1894
  blitRgb48leAffine,
1895
1895
  parseTransformMatrix,
1896
- convertTransfer
1896
+ convertTransfer,
1897
+ isVideoHiddenBeforeStreamStart
1897
1898
  } from "@hyperframes/engine";
1898
1899
 
1899
1900
  // src/services/render/hdrPerf.ts
@@ -2066,6 +2067,8 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStart
2066
2067
  frameSource.loop
2067
2068
  );
2068
2069
  if (effectiveIndex === null) return;
2070
+ const mediaTime = (frameSource.mediaStart ?? 0) + effectiveIndex / fps;
2071
+ if (isVideoHiddenBeforeStreamStart(frameSource.videoStreamLeadSeconds, mediaTime)) return;
2069
2072
  const frameOffset = effectiveIndex * frameSource.frameSize;
2070
2073
  try {
2071
2074
  if (hdrPerf) hdrPerf.hdrVideoLayerBlits += 1;
@@ -2687,7 +2690,10 @@ async function extractHdrVideoFrames(args) {
2687
2690
  initialWindow,
2688
2691
  abortSignal
2689
2692
  );
2690
- extractionWindows.set(videoId, window2);
2693
+ extractionWindows.set(videoId, {
2694
+ window: window2,
2695
+ videoStreamLeadSeconds: metadata.videoStreamLeadSeconds
2696
+ });
2691
2697
  prep.hdrVideoStartTimes.set(videoId, window2.compositionStart);
2692
2698
  plannedVideos.push({
2693
2699
  durationSeconds: window2.durationSeconds,
@@ -2706,14 +2712,16 @@ async function extractHdrVideoFrames(args) {
2706
2712
  try {
2707
2713
  for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
2708
2714
  const video = composition.videos.find((v) => v.id === videoId);
2709
- const window2 = extractionWindows.get(videoId);
2710
- if (!video || !window2) continue;
2715
+ const planned = extractionWindows.get(videoId);
2716
+ if (!video || !planned) continue;
2717
+ const { window: window2 } = planned;
2711
2718
  mkdirSync2(framesDir, { recursive: true });
2712
2719
  const frameDir = mkdtempSync2(join7(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
2713
2720
  createdFrameDirs.add(frameDir);
2714
2721
  const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
2715
2722
  const rawPath = join7(frameDir, "frames.rgb48le");
2716
- const extractionStart = String(window2.extractionMediaStart ?? window2.mediaStart);
2723
+ const extractionMediaStart = window2.extractionMediaStart ?? window2.mediaStart;
2724
+ const extractionStart = String(extractionMediaStart);
2717
2725
  const ffmpegArgs = [];
2718
2726
  if (window2.finalFrameOnly) {
2719
2727
  ffmpegArgs.push("-i", srcPath, "-ss", extractionStart, "-frames:v", "1");
@@ -2773,7 +2781,9 @@ async function extractHdrVideoFrames(args) {
2773
2781
  frameSize,
2774
2782
  frameCount,
2775
2783
  scratch: Buffer.allocUnsafe(frameSize),
2776
- loop: video.loop
2784
+ loop: video.loop,
2785
+ mediaStart: extractionMediaStart,
2786
+ videoStreamLeadSeconds: planned.videoStreamLeadSeconds
2777
2787
  });
2778
2788
  handedOff = true;
2779
2789
  } finally {
@@ -15272,6 +15282,7 @@ function readVideoMetadata(value, field) {
15272
15282
  // overwhelmingly common start-at-zero domain. Preserve that compatibility
15273
15283
  // while carrying non-zero edit-list/transport timestamps in new plans.
15274
15284
  videoStreamStartSeconds: record.videoStreamStartSeconds === void 0 ? 0 : readFiniteNumber(record.videoStreamStartSeconds, `${field}.videoStreamStartSeconds`),
15285
+ videoStreamLeadSeconds: record.videoStreamLeadSeconds === void 0 ? 0 : readFiniteNumber(record.videoStreamLeadSeconds, `${field}.videoStreamLeadSeconds`),
15275
15286
  width: readPositiveInteger(record.width, `${field}.width`),
15276
15287
  height: readPositiveInteger(record.height, `${field}.height`),
15277
15288
  fps: readFiniteNumber(record.fps, `${field}.fps`),
@@ -1912,7 +1912,8 @@ import {
1912
1912
  groupIntoLayers,
1913
1913
  blitRgb48leAffine,
1914
1914
  parseTransformMatrix,
1915
- convertTransfer
1915
+ convertTransfer,
1916
+ isVideoHiddenBeforeStreamStart
1916
1917
  } from "@hyperframes/engine";
1917
1918
 
1918
1919
  // src/services/render/hdrPerf.ts
@@ -2085,6 +2086,8 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStart
2085
2086
  frameSource.loop
2086
2087
  );
2087
2088
  if (effectiveIndex === null) return;
2089
+ const mediaTime = (frameSource.mediaStart ?? 0) + effectiveIndex / fps;
2090
+ if (isVideoHiddenBeforeStreamStart(frameSource.videoStreamLeadSeconds, mediaTime)) return;
2088
2091
  const frameOffset = effectiveIndex * frameSource.frameSize;
2089
2092
  try {
2090
2093
  if (hdrPerf) hdrPerf.hdrVideoLayerBlits += 1;
@@ -2706,7 +2709,10 @@ async function extractHdrVideoFrames(args) {
2706
2709
  initialWindow,
2707
2710
  abortSignal
2708
2711
  );
2709
- extractionWindows.set(videoId, window2);
2712
+ extractionWindows.set(videoId, {
2713
+ window: window2,
2714
+ videoStreamLeadSeconds: metadata.videoStreamLeadSeconds
2715
+ });
2710
2716
  prep.hdrVideoStartTimes.set(videoId, window2.compositionStart);
2711
2717
  plannedVideos.push({
2712
2718
  durationSeconds: window2.durationSeconds,
@@ -2725,14 +2731,16 @@ async function extractHdrVideoFrames(args) {
2725
2731
  try {
2726
2732
  for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
2727
2733
  const video = composition.videos.find((v) => v.id === videoId);
2728
- const window2 = extractionWindows.get(videoId);
2729
- if (!video || !window2) continue;
2734
+ const planned = extractionWindows.get(videoId);
2735
+ if (!video || !planned) continue;
2736
+ const { window: window2 } = planned;
2730
2737
  mkdirSync2(framesDir, { recursive: true });
2731
2738
  const frameDir = mkdtempSync2(join7(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
2732
2739
  createdFrameDirs.add(frameDir);
2733
2740
  const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
2734
2741
  const rawPath = join7(frameDir, "frames.rgb48le");
2735
- const extractionStart = String(window2.extractionMediaStart ?? window2.mediaStart);
2742
+ const extractionMediaStart = window2.extractionMediaStart ?? window2.mediaStart;
2743
+ const extractionStart = String(extractionMediaStart);
2736
2744
  const ffmpegArgs = [];
2737
2745
  if (window2.finalFrameOnly) {
2738
2746
  ffmpegArgs.push("-i", srcPath, "-ss", extractionStart, "-frames:v", "1");
@@ -2792,7 +2800,9 @@ async function extractHdrVideoFrames(args) {
2792
2800
  frameSize,
2793
2801
  frameCount,
2794
2802
  scratch: Buffer.allocUnsafe(frameSize),
2795
- loop: video.loop
2803
+ loop: video.loop,
2804
+ mediaStart: extractionMediaStart,
2805
+ videoStreamLeadSeconds: planned.videoStreamLeadSeconds
2796
2806
  });
2797
2807
  handedOff = true;
2798
2808
  } finally {
@@ -43,6 +43,8 @@ export interface HdrVideoFrameSource {
43
43
  scratch: Buffer;
44
44
  /** The raw file contains one playable source cycle and must wrap at EOF. */
45
45
  loop?: boolean;
46
+ mediaStart?: number;
47
+ videoStreamLeadSeconds?: number;
46
48
  }
47
49
  export declare function closeHdrVideoFrameSource(source: HdrVideoFrameSource, log?: ProducerLogger): void;
48
50
  export declare function resolveHdrVideoFrameIndex(time: number, startTime: number, fps: number, frameCount: number, loop?: boolean): number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.8.147",
3
+ "version": "0.8.149",
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/engine": "0.8.147",
39
- "@hyperframes/core": "0.8.147",
40
- "@hyperframes/lint": "0.8.147",
41
- "@hyperframes/parsers": "0.8.147",
42
- "@hyperframes/studio-server": "0.8.147"
38
+ "@hyperframes/engine": "0.8.149",
39
+ "@hyperframes/core": "0.8.149",
40
+ "@hyperframes/lint": "0.8.149",
41
+ "@hyperframes/studio-server": "0.8.149",
42
+ "@hyperframes/parsers": "0.8.149"
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.147"
51
+ "@hyperframes/aws-lambda": "0.8.149"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"