@hyperframes/producer 0.8.206 → 0.8.208
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/distributed.js +279 -144
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +76 -71
- package/dist/index.js +607 -357
- package/dist/public-server.js +458 -282
- package/dist/renderRequest.d.ts +3 -0
- package/dist/server.d.ts +3 -0
- package/dist/services/distributed/assemble.d.ts +1 -1
- package/dist/services/distributed/plan.d.ts +6 -0
- package/dist/services/distributed/renderChunk.d.ts +2 -0
- package/dist/services/render/deliveryEncoder.d.ts +22 -0
- package/dist/services/render/hlsConfig.d.ts +1 -1
- package/dist/services/render/segmentManifest.d.ts +3 -0
- package/dist/services/render/stages/captureHdrStage.d.ts +2 -0
- package/dist/services/render/stages/captureStage.d.ts +1 -0
- package/dist/services/render/stages/encodeStage.d.ts +2 -0
- package/dist/services/render/stages/extractVideosStage.d.ts +1 -1
- package/dist/services/render/stages/freezePlan.d.ts +3 -0
- package/dist/services/render/stages/probeStage.d.ts +2 -3
- package/dist/services/renderOrchestrator.d.ts +7 -0
- package/package.json +7 -7
package/dist/renderRequest.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ export interface RenderRequestOptions {
|
|
|
37
37
|
entryFile?: string;
|
|
38
38
|
crf?: number;
|
|
39
39
|
videoBitrate?: string;
|
|
40
|
+
keyframeIntervalSeconds?: number;
|
|
41
|
+
maxBitrate?: string;
|
|
42
|
+
bufferSize?: string;
|
|
40
43
|
videoFrameFormat?: VideoFrameFormat;
|
|
41
44
|
hdrMode?: RenderConfig["hdrMode"];
|
|
42
45
|
pageMotionBlur?: RenderConfig["pageMotionBlur"];
|
package/dist/server.d.ts
CHANGED
|
@@ -47,6 +47,9 @@ interface RenderInput {
|
|
|
47
47
|
maxRenderMs?: number;
|
|
48
48
|
crf?: number;
|
|
49
49
|
videoBitrate?: string;
|
|
50
|
+
keyframeIntervalSeconds?: number;
|
|
51
|
+
maxBitrate?: string;
|
|
52
|
+
bufferSize?: string;
|
|
50
53
|
useGpu: boolean;
|
|
51
54
|
debug: boolean;
|
|
52
55
|
strictness: RenderConfig["strictness"];
|
|
@@ -32,7 +32,7 @@ export interface AssembleResult {
|
|
|
32
32
|
fileSize: number;
|
|
33
33
|
}
|
|
34
34
|
export type AssembleChunkPaths = readonly (string | readonly string[])[];
|
|
35
|
-
type CfrRateControlSource = Partial<Pick<LockedRenderConfig, "quality" | "crf" | "bitrate">>;
|
|
35
|
+
type CfrRateControlSource = Partial<Pick<LockedRenderConfig, "quality" | "crf" | "bitrate" | "maxBitrate" | "bufferSize" | "keyframeIntervalFrames">>;
|
|
36
36
|
export declare function cfrRateControlArgs(locked: CfrRateControlSource): string[];
|
|
37
37
|
/**
|
|
38
38
|
* Assemble the chunk outputs into a single deliverable.
|
|
@@ -47,6 +47,12 @@ export interface DistributedRenderConfig extends Pick<RenderRequestOptions, "pag
|
|
|
47
47
|
crf?: number;
|
|
48
48
|
/** Target video bitrate (e.g. `"10M"`); mutually exclusive with `crf`. */
|
|
49
49
|
bitrate?: string;
|
|
50
|
+
/** Longest gap between keyframes, in seconds (mp4). Chunk joins add keyframes, so this is a maximum. */
|
|
51
|
+
keyframeIntervalSeconds?: number;
|
|
52
|
+
/** Peak bitrate cap (mp4), per chunk. */
|
|
53
|
+
maxBitrate?: string;
|
|
54
|
+
/** Rate-cap buffer; defaults to twice `maxBitrate`. */
|
|
55
|
+
bufferSize?: string;
|
|
50
56
|
/**
|
|
51
57
|
* Source-video frame extraction format. Defaults to `"auto"`, matching the
|
|
52
58
|
* in-process renderer: alpha/alpha-capable sources extract as PNG, other
|
|
@@ -156,6 +156,8 @@ export declare function shouldRetryChunkCaptureWithScreenshot(error: unknown): b
|
|
|
156
156
|
*/
|
|
157
157
|
export declare function runCaptureWithScreenshotFallback<T>(input: {
|
|
158
158
|
forceScreenshot: boolean;
|
|
159
|
+
/** A failure that is not capture's (the probe's own) is never retried. */
|
|
160
|
+
canRetry?: () => boolean | Promise<boolean>;
|
|
159
161
|
run: (forceScreenshot: boolean) => Promise<T>;
|
|
160
162
|
resetForScreenshotRetry: () => Promise<void> | void;
|
|
161
163
|
onFallback?: (error: unknown) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Delivery encoder options: their fail-fast gate and the one resolved value every encoder path spreads. */
|
|
2
|
+
import type { Fps } from "@hyperframes/core";
|
|
3
|
+
export interface DeliveryEncoderConfig {
|
|
4
|
+
format?: string;
|
|
5
|
+
fps: Fps;
|
|
6
|
+
hlsSegmentSeconds?: number;
|
|
7
|
+
keyframeIntervalSeconds?: number;
|
|
8
|
+
maxBitrate?: string;
|
|
9
|
+
bufferSize?: string;
|
|
10
|
+
}
|
|
11
|
+
/** The `EncoderOptions` fields the delivery config sets, ready to spread into any encoder input. */
|
|
12
|
+
export interface DeliveryEncoderOptions {
|
|
13
|
+
maxBitrate?: string;
|
|
14
|
+
bufferSize?: string;
|
|
15
|
+
lockGopForChunkConcat: boolean;
|
|
16
|
+
gopSize: number | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Reject what the encoders cannot honor, before any frame is captured. */
|
|
19
|
+
export declare function validateDeliveryEncoderConfig(config: DeliveryEncoderConfig): void;
|
|
20
|
+
/** A chunk starts on a keyframe, so its GOP is the chunk, or the interval when that is shorter. */
|
|
21
|
+
export declare function chunkGopFrames(framesInChunk: number, intervalFrames?: number): number;
|
|
22
|
+
export declare function resolveDeliveryEncoderOptions(config: DeliveryEncoderConfig): DeliveryEncoderOptions;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* the orchestrator hands it to the encoder as
|
|
12
12
|
* `lockGopForChunkConcat: true, gopSize`.
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import type { Fps } from "@hyperframes/core";
|
|
15
15
|
/** ffmpeg's own `-hls_time` default is 2 s; 4 s is the VOD consumer's ask. */
|
|
16
16
|
export declare const DEFAULT_HLS_SEGMENT_SECONDS = 4;
|
|
17
17
|
export interface HlsRenderConfig {
|
|
@@ -28,6 +28,9 @@ export interface SegmentPlanHashInput {
|
|
|
28
28
|
preset: string;
|
|
29
29
|
quality: number | undefined;
|
|
30
30
|
bitrate: string | undefined;
|
|
31
|
+
maxBitrate: string | undefined;
|
|
32
|
+
bufferSize: string | undefined;
|
|
33
|
+
gopSize: number | undefined;
|
|
31
34
|
pixelFormat: string | undefined;
|
|
32
35
|
imageFormat: string;
|
|
33
36
|
/** Hardware encoder or not: h264_nvenc and libx264 both report codec "h264" but produce different bytes. */
|
|
@@ -40,6 +40,7 @@ import { type HdrPerfCollector } from "../hdrPerf.js";
|
|
|
40
40
|
import type { HdrDiagnostics, ProgressCallback, RenderJob } from "../../renderOrchestrator.js";
|
|
41
41
|
import { type CompositionMetadata } from "../shared.js";
|
|
42
42
|
import type { HdrLayeredCapturePlan } from "../capturePlan.js";
|
|
43
|
+
import type { DeliveryEncoderOptions } from "../deliveryEncoder.js";
|
|
43
44
|
export interface CaptureHdrStageInput {
|
|
44
45
|
job: RenderJob;
|
|
45
46
|
cfg: EngineConfig;
|
|
@@ -66,6 +67,7 @@ export interface CaptureHdrStageInput {
|
|
|
66
67
|
preset: ReturnType<typeof getEncoderPreset>;
|
|
67
68
|
effectiveQuality: number;
|
|
68
69
|
effectiveBitrate: string | undefined;
|
|
70
|
+
deliveryEncoder: DeliveryEncoderOptions;
|
|
69
71
|
fileServer: FileServerHandle;
|
|
70
72
|
buildCaptureOptions: () => CaptureOptions;
|
|
71
73
|
createRenderVideoFrameInjector: () => BeforeCaptureHook | null;
|
|
@@ -88,6 +88,7 @@ export interface CaptureStageInput {
|
|
|
88
88
|
interleaveFrames?: boolean;
|
|
89
89
|
/** Each capture attempt opens one, so a stalled attempt is retried by the ladders below. */
|
|
90
90
|
openAttempt?: OpenStallAttempt;
|
|
91
|
+
verifyFirstSession?: (session: CaptureSession) => Promise<void>;
|
|
91
92
|
}
|
|
92
93
|
export interface CaptureStageResult {
|
|
93
94
|
/** Final worker count after any adaptive retry. */
|
|
@@ -71,6 +71,8 @@ export interface EncodeStageInput {
|
|
|
71
71
|
preset: ReturnType<typeof getEncoderPreset>;
|
|
72
72
|
effectiveQuality: number;
|
|
73
73
|
effectiveBitrate: string | undefined;
|
|
74
|
+
maxBitrate?: string;
|
|
75
|
+
bufferSize?: string;
|
|
74
76
|
/** Producer config — enables the chunked-concat encoder when on. */
|
|
75
77
|
enableChunkedEncode: boolean;
|
|
76
78
|
chunkedEncodeSize: number;
|
|
@@ -117,7 +117,7 @@ export declare class VideoExtractionStageError extends Error {
|
|
|
117
117
|
* validating and applying policy to it.
|
|
118
118
|
*/
|
|
119
119
|
readonly publicMetadata: Readonly<Record<string, unknown>>;
|
|
120
|
-
constructor(code: VideoExtractionStageErrorCode, retryable: boolean, failures: readonly VideoExtractionStageFailureSummary[], extractionFailure?: ExtractionFailureMetadataV1);
|
|
120
|
+
constructor(code: VideoExtractionStageErrorCode, retryable: boolean, failures: readonly VideoExtractionStageFailureSummary[], extractionFailure?: ExtractionFailureMetadataV1, ffmpegReason?: string);
|
|
121
121
|
}
|
|
122
122
|
export declare function assertVideoExtractionSucceeded(result: ExtractionResult): void;
|
|
123
123
|
export declare function buildHdrProbeStageError(failures: readonly Pick<ReturnType<typeof classifyVideoExtractionError>, "kind" | "retryable">[]): VideoExtractionStageError;
|
|
@@ -35,6 +35,9 @@ export interface LockedRenderConfig extends Pick<RenderRequestOptions, "pageMoti
|
|
|
35
35
|
preset: string;
|
|
36
36
|
crf?: number;
|
|
37
37
|
bitrate?: string;
|
|
38
|
+
maxBitrate?: string;
|
|
39
|
+
bufferSize?: string;
|
|
40
|
+
keyframeIntervalFrames?: number;
|
|
38
41
|
/**
|
|
39
42
|
* VP9-only: new WebM plans persist the resolved libvpx-vp9 `-cpu-used`
|
|
40
43
|
* value so distributed workers reproduce the controller's speed/quality
|
|
@@ -88,9 +88,8 @@ export declare function hasScriptedAudioVolumeAutomation(html: string, audioCoun
|
|
|
88
88
|
*/
|
|
89
89
|
export declare function hasAutoStartVideos(html: string): boolean;
|
|
90
90
|
/**
|
|
91
|
-
* Variable-bound
|
|
92
|
-
*
|
|
93
|
-
* referenced variable so media extraction follows the resolved row value.
|
|
91
|
+
* Variable-bound sources are resolved by the browser runtime, not the static compiler. Probe them whenever the
|
|
92
|
+
* element's variable has a value (the render's, its mount's `data-variable-values`, a declared default).
|
|
94
93
|
*/
|
|
95
94
|
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined): boolean;
|
|
96
95
|
/**
|
|
@@ -101,6 +101,12 @@ export interface RenderConfig {
|
|
|
101
101
|
crf?: number;
|
|
102
102
|
/** Target video bitrate (e.g. "10M"). Mutually exclusive with `crf`. */
|
|
103
103
|
videoBitrate?: string;
|
|
104
|
+
/** Keyframe every N seconds (mp4). A maximum where chunks join, as on Lambda. */
|
|
105
|
+
keyframeIntervalSeconds?: number;
|
|
106
|
+
/** Peak bitrate cap (e.g. "8M", mp4) alongside CRF. */
|
|
107
|
+
maxBitrate?: string;
|
|
108
|
+
/** Rate-cap buffer; defaults to twice `maxBitrate`. */
|
|
109
|
+
bufferSize?: string;
|
|
104
110
|
/**
|
|
105
111
|
* Source-video frame extraction format. Defaults to `"auto"`, which preserves
|
|
106
112
|
* the historical behavior: alpha/alpha-capable sources extract as PNG, all
|
|
@@ -604,6 +610,7 @@ export declare function executeDiskCaptureWithAdaptiveRetry(options: {
|
|
|
604
610
|
/** Mutated in place: the workers' page-error console lines, for the render's error count. */
|
|
605
611
|
pageErrorLines?: string[];
|
|
606
612
|
openAttempt?: OpenStallAttempt;
|
|
613
|
+
verifyFirstSession?: (session: CaptureSession) => Promise<void>;
|
|
607
614
|
}): Promise<CaptureAttemptSummary[]>;
|
|
608
615
|
export type RenderConfigInput = Omit<RenderConfig, "fps"> & {
|
|
609
616
|
fps: FpsInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.208",
|
|
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.
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/studio-server": "0.8.
|
|
42
|
-
"@hyperframes/engine": "0.8.
|
|
38
|
+
"@hyperframes/core": "0.8.208",
|
|
39
|
+
"@hyperframes/lint": "0.8.208",
|
|
40
|
+
"@hyperframes/parsers": "0.8.208",
|
|
41
|
+
"@hyperframes/studio-server": "0.8.208",
|
|
42
|
+
"@hyperframes/engine": "0.8.208"
|
|
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.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.8.208"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|