@hyperframes/engine 0.8.222 → 0.8.224
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.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export { beginFrameCapture, pageScreenshotCapture, getCdpSession, injectVideoFra
|
|
|
47
47
|
export { buildEncoderArgs, encodeFramesFromDir, buildConcatArgs, concatVideoFiles, encodeFramesChunkedConcat, muxVideoWithAudio, applyFaststart, packageHls, detectGpuEncoder, getCachedGpuEncoder, ENCODER_PRESETS, getEncoderPreset, PRORES_PROFILES, PRORES_PROFILE_NAMES, isProresProfile, type ProresProfile, appendRateCapArgs, keyframeIntervalToGopSize, HLS_MASTER_PLAYLIST, HLS_VIDEO_PLAYLIST, HLS_AUDIO_PLAYLIST, type GpuEncoder, type PackageHlsOptions, } from "./services/chunkEncoder.js";
|
|
48
48
|
export type { EncoderOptions, EncodeResult, MuxResult } from "./services/chunkEncoder.types.js";
|
|
49
49
|
export { spawnStreamingEncoder, createFrameReorderBuffer, type StreamingEncoder, type StreamingEncoderOptions, type StreamingEncoderResult, type FrameReorderBuffer, } from "./services/streamingEncoder.js";
|
|
50
|
-
export { parseVideoElements, parseImageElements, extractVideoFramesRange, extractAllVideoFrames, isVideoPastTimelineEnd, resolveTimelineExtractionWindow, resolveVideoExtractionWindow, rebaseVideoToWindow, resolveFinalFrameExtractionWindow, resolveFrameFormat, resolveVideoExtractionDuration, resolvePlayableVideoDuration, videoStartOnMediaTimeline, ffmpegSeekSeconds, extractionFrameCountForDuration, resolveProjectRelativeSrc, getFrameAtTime, isVideoHiddenBeforeStreamStart, createFrameLookupTable, FrameLookupTable, analyzeClipMediaFit, classifyVideoExtractionError, isVideoSourceExtractionError, runVideoExtractionWithRetry, safeVideoExtractionSourceIdentity, VideoSourceExtractionError, type VideoElement, type ImageElement, type ExtractedFrames, type DeferredFrameRange, type FrameRange, type ExtractionOptions, type ExtractionResult, type ExtractionPhaseBreakdown, type TimelineExtractionWindow, type VideoExtractionFailure, type VideoExtractionFailureKind, type VideoExtractionFailureGroupDetails, type VideoExtractionFailureRetry, type VideoExtractionFailureStatusClass, type SafeVideoExtractionSourceIdentity, type VideoFrameFormat, VIDEO_FRAME_FORMATS, isVideoFrameFormat, EXTRACT_CACHE_MIN_AGE_MS, sdrCanvasColourFilters, } from "./services/videoFrameExtractor.js";
|
|
50
|
+
export { parseVideoElements, hasGradedCanvas, parseImageElements, extractVideoFramesRange, extractAllVideoFrames, isVideoPastTimelineEnd, resolveTimelineExtractionWindow, resolveVideoExtractionWindow, rebaseVideoToWindow, resolveFinalFrameExtractionWindow, resolveFrameFormat, resolveVideoExtractionDuration, resolvePlayableVideoDuration, videoStartOnMediaTimeline, ffmpegSeekSeconds, extractionFrameCountForDuration, resolveProjectRelativeSrc, getFrameAtTime, isVideoHiddenBeforeStreamStart, createFrameLookupTable, FrameLookupTable, analyzeClipMediaFit, classifyVideoExtractionError, isVideoSourceExtractionError, runVideoExtractionWithRetry, safeVideoExtractionSourceIdentity, VideoSourceExtractionError, type VideoElement, type ImageElement, type ExtractedFrames, type DeferredFrameRange, type FrameRange, type ExtractionOptions, type ExtractionResult, type ExtractionPhaseBreakdown, type TimelineExtractionWindow, type VideoExtractionFailure, type VideoExtractionFailureKind, type VideoExtractionFailureGroupDetails, type VideoExtractionFailureRetry, type VideoExtractionFailureStatusClass, type SafeVideoExtractionSourceIdentity, type VideoFrameFormat, VIDEO_FRAME_FORMATS, isVideoFrameFormat, EXTRACT_CACHE_MIN_AGE_MS, sdrCanvasColourFilters, } from "./services/videoFrameExtractor.js";
|
|
51
51
|
export { isSelfOrAncestorHidden } from "./services/mediaHidden.js";
|
|
52
52
|
export { directorySizeBytes, gcExtractionCache } from "./services/extractionCache.js";
|
|
53
53
|
export { resolveReferencedStart, resolveReferencedDuration, type RefResolverEl, type RefResolverDoc, } from "./services/referenceResolver.js";
|
|
@@ -86,7 +86,7 @@ export { type TransitionFn, TRANSITIONS, crossfade, sampleRgb48le, hdrToLinear,
|
|
|
86
86
|
export { initHdrReadback, uploadAndReadbackHdrFrame, float16ToPqRgb, buildHdrChromeArgs, launchHdrBrowser, } from "./services/hdrCapture.js";
|
|
87
87
|
export { captureScreenshotWithAlpha } from "./services/screenshotService.js";
|
|
88
88
|
export { hideVideoElements, showVideoElements, queryVideoElementBounds, queryElementStacking, measureVideoShownBoxes, type ShownBox, type VideoElementBounds, type ElementStackingInfo, } from "./services/videoFrameInjector.js";
|
|
89
|
-
export { isHdrColorSpace, detectTransfer, getHdrEncoderColorParams, analyzeCompositionHdr, findHdrAutoPromotion, formatHdrAutoPromotionWarning, sanitizeHdrAutoPromotionAsset, DEFAULT_HDR10_MASTERING, HDR_AUTO_PROMOTION_PIPELINE, type HdrTransfer, type HdrEncoderColorParams, type HdrAutoPromotion, type CompositionHdrInfo, type HdrMasteringMetadata, } from "./utils/hdr.js";
|
|
89
|
+
export { isHdrColorSpace, detectTransfer, getHdrEncoderColorParams, analyzeCompositionHdr, findHdrAutoPromotion, gradingKeepsSdr, formatHdrAutoPromotionWarning, sanitizeHdrAutoPromotionAsset, DEFAULT_HDR10_MASTERING, HDR_AUTO_PROMOTION_PIPELINE, type HdrTransfer, type HdrEncoderColorParams, type HdrAutoPromotion, type CompositionHdrInfo, type HdrMasteringMetadata, } from "./utils/hdr.js";
|
|
90
90
|
export type { VideoColorSpace } from "./utils/ffprobe.js";
|
|
91
91
|
export { renderProvenanceArgs, appendRenderProvenanceArgs, readRenderProvenance, PROVENANCE_RENDERER_TAG, PROVENANCE_VERSION_TAG, PROVENANCE_RENDERER_NAME, PROVENANCE_VERSION, type RenderProvenance, } from "./utils/renderProvenance.js";
|
|
92
92
|
export { DrawElementCaptureError, isDrawElementCaptureError, } from "./services/drawElementCaptureError.js";
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export { beginFrameCapture, pageScreenshotCapture, getCdpSession, injectVideoFra
|
|
|
51
51
|
export { buildEncoderArgs, encodeFramesFromDir, buildConcatArgs, concatVideoFiles, encodeFramesChunkedConcat, muxVideoWithAudio, applyFaststart, packageHls, detectGpuEncoder, getCachedGpuEncoder, ENCODER_PRESETS, getEncoderPreset, PRORES_PROFILES, PRORES_PROFILE_NAMES, isProresProfile, appendRateCapArgs, keyframeIntervalToGopSize, HLS_MASTER_PLAYLIST, HLS_VIDEO_PLAYLIST, HLS_AUDIO_PLAYLIST, } from "./services/chunkEncoder.js";
|
|
52
52
|
export { spawnStreamingEncoder, createFrameReorderBuffer, } from "./services/streamingEncoder.js";
|
|
53
53
|
// ── Media processing ───────────────────────────────────────────────────────────
|
|
54
|
-
export { parseVideoElements, parseImageElements, extractVideoFramesRange, extractAllVideoFrames, isVideoPastTimelineEnd, resolveTimelineExtractionWindow, resolveVideoExtractionWindow, rebaseVideoToWindow, resolveFinalFrameExtractionWindow, resolveFrameFormat, resolveVideoExtractionDuration, resolvePlayableVideoDuration, videoStartOnMediaTimeline, ffmpegSeekSeconds, extractionFrameCountForDuration, resolveProjectRelativeSrc, getFrameAtTime, isVideoHiddenBeforeStreamStart, createFrameLookupTable, FrameLookupTable, analyzeClipMediaFit, classifyVideoExtractionError, isVideoSourceExtractionError, runVideoExtractionWithRetry, safeVideoExtractionSourceIdentity, VideoSourceExtractionError, VIDEO_FRAME_FORMATS, isVideoFrameFormat, EXTRACT_CACHE_MIN_AGE_MS, sdrCanvasColourFilters, } from "./services/videoFrameExtractor.js";
|
|
54
|
+
export { parseVideoElements, hasGradedCanvas, parseImageElements, extractVideoFramesRange, extractAllVideoFrames, isVideoPastTimelineEnd, resolveTimelineExtractionWindow, resolveVideoExtractionWindow, rebaseVideoToWindow, resolveFinalFrameExtractionWindow, resolveFrameFormat, resolveVideoExtractionDuration, resolvePlayableVideoDuration, videoStartOnMediaTimeline, ffmpegSeekSeconds, extractionFrameCountForDuration, resolveProjectRelativeSrc, getFrameAtTime, isVideoHiddenBeforeStreamStart, createFrameLookupTable, FrameLookupTable, analyzeClipMediaFit, classifyVideoExtractionError, isVideoSourceExtractionError, runVideoExtractionWithRetry, safeVideoExtractionSourceIdentity, VideoSourceExtractionError, VIDEO_FRAME_FORMATS, isVideoFrameFormat, EXTRACT_CACHE_MIN_AGE_MS, sdrCanvasColourFilters, } from "./services/videoFrameExtractor.js";
|
|
55
55
|
export { isSelfOrAncestorHidden } from "./services/mediaHidden.js";
|
|
56
56
|
export { directorySizeBytes, gcExtractionCache } from "./services/extractionCache.js";
|
|
57
57
|
export { resolveReferencedStart, resolveReferencedDuration, } from "./services/referenceResolver.js";
|
|
@@ -93,7 +93,7 @@ export { TRANSITIONS, crossfade, sampleRgb48le, hdrToLinear, linearToHdr, conver
|
|
|
93
93
|
export { initHdrReadback, uploadAndReadbackHdrFrame, float16ToPqRgb, buildHdrChromeArgs, launchHdrBrowser, } from "./services/hdrCapture.js";
|
|
94
94
|
export { captureScreenshotWithAlpha } from "./services/screenshotService.js";
|
|
95
95
|
export { hideVideoElements, showVideoElements, queryVideoElementBounds, queryElementStacking, measureVideoShownBoxes, } from "./services/videoFrameInjector.js";
|
|
96
|
-
export { isHdrColorSpace, detectTransfer, getHdrEncoderColorParams, analyzeCompositionHdr, findHdrAutoPromotion, formatHdrAutoPromotionWarning, sanitizeHdrAutoPromotionAsset, DEFAULT_HDR10_MASTERING, HDR_AUTO_PROMOTION_PIPELINE, } from "./utils/hdr.js";
|
|
96
|
+
export { isHdrColorSpace, detectTransfer, getHdrEncoderColorParams, analyzeCompositionHdr, findHdrAutoPromotion, gradingKeepsSdr, formatHdrAutoPromotionWarning, sanitizeHdrAutoPromotionAsset, DEFAULT_HDR10_MASTERING, HDR_AUTO_PROMOTION_PIPELINE, } from "./utils/hdr.js";
|
|
97
97
|
export { renderProvenanceArgs, appendRenderProvenanceArgs, readRenderProvenance, PROVENANCE_RENDERER_TAG, PROVENANCE_VERSION_TAG, PROVENANCE_RENDERER_NAME, PROVENANCE_VERSION, } from "./utils/renderProvenance.js";
|
|
98
98
|
export { DrawElementCaptureError, isDrawElementCaptureError, } from "./services/drawElementCaptureError.js";
|
|
99
99
|
export { inAgentSandbox, isOneProcessOverPipe, machServiceDenied, oneProcessOverPipe, pipeLaunchClosedOnMac, sandboxDeniedRemediation, } from "./services/sandboxLaunch.js";
|
|
@@ -21,6 +21,7 @@ export interface VideoElement {
|
|
|
21
21
|
loop: boolean;
|
|
22
22
|
hasAudio: boolean;
|
|
23
23
|
hidden?: boolean;
|
|
24
|
+
graded?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface ExtractedFrames {
|
|
26
27
|
videoId: string;
|
|
@@ -263,7 +264,9 @@ export interface ImageElement {
|
|
|
263
264
|
src: string;
|
|
264
265
|
start: number;
|
|
265
266
|
end: number;
|
|
267
|
+
graded?: boolean;
|
|
266
268
|
}
|
|
269
|
+
export declare function hasGradedCanvas(html: string): boolean;
|
|
267
270
|
export declare function parseImageElements(html: string): ImageElement[];
|
|
268
271
|
export declare function sdrCanvasColourFilters(metadata: VideoMetadata, toneMappedToSdr?: boolean): string[];
|
|
269
272
|
export declare function extractVideoFramesRange(...args: Parameters<typeof extractVideoFramesRangeUnredacted>): Promise<ExtractedFrames>;
|
|
@@ -11,6 +11,7 @@ import { basename, join } from "path";
|
|
|
11
11
|
import { cpus } from "os";
|
|
12
12
|
import { createConcurrencyLimit } from "../utils/concurrencyLimit.js";
|
|
13
13
|
import { parseHTML } from "linkedom";
|
|
14
|
+
import { HF_COLOR_GRADING_ATTR } from "@hyperframes/core";
|
|
14
15
|
import { isPathInside } from "@hyperframes/parsers/asset-paths";
|
|
15
16
|
import { resolveProjectRelativeSrc } from "@hyperframes/parsers/asset-resolution";
|
|
16
17
|
import { alphaDecoderFor } from "@hyperframes/parsers/media-alpha";
|
|
@@ -427,10 +428,15 @@ export function parseVideoElements(html) {
|
|
|
427
428
|
(isAudibleVideoElement(el) && isMemberGroupHidden(groupsById, el))
|
|
428
429
|
? { hidden: true }
|
|
429
430
|
: {}),
|
|
431
|
+
...(el.hasAttribute(HF_COLOR_GRADING_ATTR) ? { graded: true } : {}),
|
|
430
432
|
});
|
|
431
433
|
}
|
|
432
434
|
return videos;
|
|
433
435
|
}
|
|
436
|
+
export function hasGradedCanvas(html) {
|
|
437
|
+
return (parseHTML(unwrapTemplate(html)).document.querySelector(`canvas[${HF_COLOR_GRADING_ATTR}]`) !==
|
|
438
|
+
null);
|
|
439
|
+
}
|
|
434
440
|
export function parseImageElements(html) {
|
|
435
441
|
const images = [];
|
|
436
442
|
const { document } = parseHTML(unwrapTemplate(html));
|
|
@@ -465,7 +471,13 @@ export function parseImageElements(html) {
|
|
|
465
471
|
else {
|
|
466
472
|
end = Infinity;
|
|
467
473
|
}
|
|
468
|
-
images.push({
|
|
474
|
+
images.push({
|
|
475
|
+
id,
|
|
476
|
+
src,
|
|
477
|
+
start,
|
|
478
|
+
end,
|
|
479
|
+
...(el.hasAttribute(HF_COLOR_GRADING_ATTR) ? { graded: true } : {}),
|
|
480
|
+
});
|
|
469
481
|
}
|
|
470
482
|
return images;
|
|
471
483
|
}
|
package/dist/utils/hdr.d.ts
CHANGED
|
@@ -88,6 +88,16 @@ export declare function findHdrAutoPromotion(sources: readonly {
|
|
|
88
88
|
asset: string;
|
|
89
89
|
colorSpace: VideoColorSpace | null;
|
|
90
90
|
}[]): HdrAutoPromotion | null;
|
|
91
|
+
/** Grading is SDR-only, so in auto mode a composition with graded media renders SDR, as `--sdr` does. */
|
|
92
|
+
export declare function gradingKeepsSdr(hdrMode: "auto" | "force-hdr" | "force-sdr" | undefined, media: {
|
|
93
|
+
videos: readonly {
|
|
94
|
+
graded?: boolean;
|
|
95
|
+
}[];
|
|
96
|
+
images: readonly {
|
|
97
|
+
graded?: boolean;
|
|
98
|
+
}[];
|
|
99
|
+
gradedCanvas?: boolean;
|
|
100
|
+
}): boolean;
|
|
91
101
|
export declare function formatHdrAutoPromotionWarning(promotion: HdrAutoPromotion): string;
|
|
92
102
|
/**
|
|
93
103
|
* Analyze a set of video color spaces to determine if the composition
|
package/dist/utils/hdr.js
CHANGED
|
@@ -84,6 +84,12 @@ export function findHdrAutoPromotion(sources) {
|
|
|
84
84
|
}
|
|
85
85
|
: null;
|
|
86
86
|
}
|
|
87
|
+
/** Grading is SDR-only, so in auto mode a composition with graded media renders SDR, as `--sdr` does. */
|
|
88
|
+
export function gradingKeepsSdr(hdrMode, media) {
|
|
89
|
+
return ((hdrMode ?? "auto") === "auto" &&
|
|
90
|
+
(media.gradedCanvas === true ||
|
|
91
|
+
[...media.videos, ...media.images].some(({ graded }) => graded === true)));
|
|
92
|
+
}
|
|
87
93
|
export function formatHdrAutoPromotionWarning(promotion) {
|
|
88
94
|
return `[Render] HDR auto-promotion triggered by "${promotion.triggeringAsset}", output: ${promotion.output.colorSpace} / ${promotion.output.codec}`;
|
|
89
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/engine",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.224",
|
|
4
4
|
"description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"puppeteer": "~25.11.0",
|
|
60
60
|
"puppeteer-core": "^25.11.0",
|
|
61
61
|
"undici": "7.25.0",
|
|
62
|
-
"@hyperframes/core": "^0.8.
|
|
63
|
-
"@hyperframes/parsers": "^0.8.
|
|
62
|
+
"@hyperframes/core": "^0.8.224",
|
|
63
|
+
"@hyperframes/parsers": "^0.8.224"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^25.0.10",
|