@hyperframes/producer 0.8.183 → 0.8.184

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.
@@ -26,8 +26,12 @@
26
26
  * branch + same args.
27
27
  * - `Encoding failed: <err>` throws on the encoder's
28
28
  * `success: false`.
29
+ *
30
+ * `encodeWhileCapturing` runs the same mp4 encode during multi-worker disk
31
+ * capture, feeding frames in order as they land, and falls back to this
32
+ * stage's encode if it fails.
29
33
  */
30
- import { getEncoderPreset, type EngineConfig } from "@hyperframes/engine";
34
+ import { getEncoderPreset, type EngineConfig, type LandedFrame } from "@hyperframes/engine";
31
35
  import type { ProducerLogger } from "../../../logger.js";
32
36
  import type { ProgressCallback, RenderJob } from "../../renderOrchestrator.js";
33
37
  export interface EncodeStageInput {
@@ -71,7 +75,7 @@ export interface EncodeStageInput {
71
75
  enableChunkedEncode: boolean;
72
76
  chunkedEncodeSize: number;
73
77
  /** Already-resolved engine config from the orchestrator; direct callers fall back below. */
74
- engineConfig?: Pick<EngineConfig, "ffmpegEncodeTimeout" | "vp9CpuUsed">;
78
+ engineConfig?: Pick<EngineConfig, "ffmpegEncodeTimeout" | "vp9CpuUsed"> & Partial<Pick<EngineConfig, "ffmpegStreamingTimeout">>;
75
79
  abortSignal: AbortSignal | undefined;
76
80
  assertNotAborted: () => void;
77
81
  onProgress?: ProgressCallback;
@@ -97,4 +101,24 @@ export interface EncodeStageResult {
97
101
  /** Wall-clock ms for the encode (or png-copy) phase. */
98
102
  encodeMs: number;
99
103
  }
104
+ /**
105
+ * Software libx264 from JPEG only: the streaming encoder then runs the disk encoder's
106
+ * arguments (same bytes). Needs a core the capture workers leave free.
107
+ */
108
+ export declare function canEncodeWhileCapturing(input: EncodeStageInput, workerCount: number, cpuCount: number): boolean;
109
+ export interface EncodeWhileCapturing {
110
+ /** A worker finished writing this frame. */
111
+ onFrameLanded: (frame: LandedFrame) => void;
112
+ /** Capture succeeded and every frame is in `framesDir`: encode the rest. */
113
+ finish: () => Promise<EncodeStageResult>;
114
+ /** Capture failed: stop the encoder and wait for it to exit. */
115
+ abort: () => Promise<void>;
116
+ /** Frames handed to the encoder so far. */
117
+ readonly framesFed: number;
118
+ }
119
+ /**
120
+ * Feeds frames 0, 1, 2… to the encoder as each lands; capture never waits on it.
121
+ * On failure `finish` re-runs `runEncodeStage` on the same frames.
122
+ */
123
+ export declare function encodeWhileCapturing(input: EncodeStageInput, totalFrames: number): EncodeWhileCapturing;
100
124
  export declare function runEncodeStage(input: EncodeStageInput): Promise<EncodeStageResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.8.183",
3
+ "version": "0.8.184",
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.183",
39
- "@hyperframes/engine": "0.8.183",
40
- "@hyperframes/parsers": "0.8.183",
41
- "@hyperframes/studio-server": "0.8.183",
42
- "@hyperframes/lint": "0.8.183"
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"
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.183"
51
+ "@hyperframes/aws-lambda": "0.8.184"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"