@hyperframes/producer 0.8.205 → 0.8.207

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.
@@ -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"];
@@ -30,6 +30,12 @@ export interface PrepareAnimatedGifInputsResult {
30
30
  preparedAssets: Map<string, string>;
31
31
  preparedGifs: PreparedAnimatedGif[];
32
32
  }
33
+ export declare function splitUrlSuffix(src: string): {
34
+ basePath: string;
35
+ suffix: string;
36
+ };
37
+ export declare function normalizeRelPath(path: string): string;
38
+ export declare function resolveLocalImageSourcePath(src: string, options: Pick<PrepareAnimatedGifInputsOptions, "projectDir" | "downloadDir" | "sourceAssets">): string | null;
33
39
  export declare function buildAnimatedGifTranscodeArgs(input: {
34
40
  inputPath: string;
35
41
  outputPath: string;
@@ -15,6 +15,7 @@ export declare class AssetMediaTypeMismatchError extends Error {
15
15
  readonly mismatches: readonly AssetMediaTypeMismatch[];
16
16
  constructor(mismatches: readonly AssetMediaTypeMismatch[]);
17
17
  }
18
+ export declare function mediaProfileMatchesElementType(expected: AssetElementMediaType, profile: MediaProbeProfile): boolean;
18
19
  export declare function assertAssetMediaTypeProfile(expected: AssetElementMediaType, profile: MediaProbeProfile, elementIdentity: string): void;
19
20
  interface CompositionMediaAssets {
20
21
  videos: readonly VideoElement[];
@@ -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
@@ -0,0 +1,69 @@
1
+ export declare const HEIF_IMAGE_CONVERSION_FAILED: "HEIF_IMAGE_CONVERSION_FAILED";
2
+ export declare class HeifImageConversionError extends Error {
3
+ readonly code: "HEIF_IMAGE_CONVERSION_FAILED";
4
+ readonly owner: "user";
5
+ readonly retryable: false;
6
+ constructor(label: string, reason: string);
7
+ }
8
+ /** The host's ffmpeg or ffprobe cannot do the job; a different photo would not help. */
9
+ export declare class HeifToolUnavailableError extends Error {
10
+ readonly code: "HEIF_TOOL_UNAVAILABLE";
11
+ readonly owner: "system";
12
+ readonly retryable: false;
13
+ constructor(label: string, reason: string);
14
+ }
15
+ export interface HeifTranscodeRequest {
16
+ inputPath: string;
17
+ outputPath: string;
18
+ timeoutMs?: number;
19
+ }
20
+ export interface PrepareHeifImageInputsOptions {
21
+ projectDir: string;
22
+ downloadDir: string;
23
+ outputDir?: string;
24
+ outputSrcPrefix?: string;
25
+ cacheDir?: string;
26
+ sourceAssets?: Map<string, string>;
27
+ timeoutMs?: number;
28
+ transcode?: (input: HeifTranscodeRequest) => Promise<void>;
29
+ /** Leaves an image whose conversion failed as authored and reports it, instead of throwing. */
30
+ onFailure?: (error: HeifImageConversionError | HeifToolUnavailableError) => void;
31
+ }
32
+ export interface PreparedHeifImage {
33
+ sourceSrc: string;
34
+ outputSrc: string;
35
+ outputPath: string;
36
+ }
37
+ export interface PrepareHeifImageInputsResult {
38
+ html: string;
39
+ preparedAssets: Map<string, string>;
40
+ preparedImages: PreparedHeifImage[];
41
+ }
42
+ /** True when the leading bytes are a HEIF file by its `ftyp` brands, and not an AVIF one. */
43
+ export declare function isHeifBytes(head: Uint8Array): boolean;
44
+ export interface ProbedStream {
45
+ width?: number;
46
+ height?: number;
47
+ coded_width?: number;
48
+ coded_height?: number;
49
+ horizontal_offset?: number;
50
+ vertical_offset?: number;
51
+ subcomponents?: {
52
+ stream_index: number;
53
+ tile_horizontal_offset: number;
54
+ tile_vertical_offset: number;
55
+ }[];
56
+ }
57
+ export interface ProbeJson {
58
+ streams?: ProbedStream[];
59
+ stream_groups?: {
60
+ components?: ProbedStream[];
61
+ disposition?: {
62
+ default?: number;
63
+ };
64
+ }[];
65
+ }
66
+ /** The primary item's grid: the group ffmpeg marks default, so an auxiliary grid listed first is skipped. */
67
+ export declare function primaryGrid(probed: ProbeJson): ProbedStream | undefined;
68
+ export declare function convertHeifToJpeg(request: HeifTranscodeRequest): Promise<void>;
69
+ export declare function prepareHeifImageInputs(html: string, options: PrepareHeifImageInputsOptions): Promise<PrepareHeifImageInputsResult>;
@@ -0,0 +1,2 @@
1
+ /** Counter-clockwise degrees of the primary item's `irot` property; 0 when none or unreadable. */
2
+ export declare function readHeifPrimaryRotation(buf: Buffer): 0 | 90 | 180 | 270;
@@ -175,10 +175,7 @@ export interface CompileForRenderOptions {
175
175
  allowSystemFontCapture?: boolean;
176
176
  /** Caller cancellation propagated through compile-time font fetches. */
177
177
  abortSignal?: AbortSignal;
178
- /**
179
- * Optional persistent cache directory for prep-time animated GIF → WebM
180
- * transcodes. When omitted, the render's downloadDir is used.
181
- */
178
+ /** Persistent cache directory for the animated GIF and HEIC prep transcodes; defaults to downloadDir. */
182
179
  animatedGifCacheDir?: string;
183
180
  /** FFmpeg timeout for animated GIF transcodes. */
184
181
  ffmpegProcessTimeout?: number;
@@ -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 { type Fps } from "@hyperframes/core";
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;
@@ -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;
@@ -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 image/audio/video sources are resolved by the browser runtime, not
92
- * the static compiler. Probe them whenever the current render overrides the
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.8.205",
3
+ "version": "0.8.207",
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.205",
39
- "@hyperframes/engine": "0.8.205",
40
- "@hyperframes/lint": "0.8.205",
41
- "@hyperframes/parsers": "0.8.205",
42
- "@hyperframes/studio-server": "0.8.205"
38
+ "@hyperframes/engine": "0.8.207",
39
+ "@hyperframes/core": "0.8.207",
40
+ "@hyperframes/lint": "0.8.207",
41
+ "@hyperframes/parsers": "0.8.207",
42
+ "@hyperframes/studio-server": "0.8.207"
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.205"
51
+ "@hyperframes/aws-lambda": "0.8.207"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"