@hyperframes/engine 0.4.6 → 0.4.8
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/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/services/browserManager.d.ts.map +1 -1
- package/dist/services/browserManager.js +6 -3
- package/dist/services/browserManager.js.map +1 -1
- package/dist/services/chunkEncoder.d.ts +14 -7
- package/dist/services/chunkEncoder.d.ts.map +1 -1
- package/dist/services/chunkEncoder.js +25 -9
- package/dist/services/chunkEncoder.js.map +1 -1
- package/dist/services/chunkEncoder.types.d.ts +4 -0
- package/dist/services/chunkEncoder.types.d.ts.map +1 -1
- package/dist/services/hdrCapture.d.ts +62 -0
- package/dist/services/hdrCapture.d.ts.map +1 -0
- package/dist/services/hdrCapture.js +259 -0
- package/dist/services/hdrCapture.js.map +1 -0
- package/dist/services/screenshotService.d.ts +115 -0
- package/dist/services/screenshotService.d.ts.map +1 -1
- package/dist/services/screenshotService.js +252 -19
- package/dist/services/screenshotService.js.map +1 -1
- package/dist/services/streamingEncoder.d.ts +18 -3
- package/dist/services/streamingEncoder.d.ts.map +1 -1
- package/dist/services/streamingEncoder.js +104 -50
- package/dist/services/streamingEncoder.js.map +1 -1
- package/dist/services/videoFrameExtractor.d.ts.map +1 -1
- package/dist/services/videoFrameExtractor.js +109 -18
- package/dist/services/videoFrameExtractor.js.map +1 -1
- package/dist/services/videoFrameInjector.d.ts +59 -0
- package/dist/services/videoFrameInjector.d.ts.map +1 -1
- package/dist/services/videoFrameInjector.js +290 -0
- package/dist/services/videoFrameInjector.js.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/alphaBlit.d.ts +105 -0
- package/dist/utils/alphaBlit.d.ts.map +1 -0
- package/dist/utils/alphaBlit.js +550 -0
- package/dist/utils/alphaBlit.js.map +1 -0
- package/dist/utils/ffprobe.d.ts +10 -0
- package/dist/utils/ffprobe.d.ts.map +1 -1
- package/dist/utils/ffprobe.js +7 -0
- package/dist/utils/ffprobe.js.map +1 -1
- package/dist/utils/hdr.d.ts +82 -0
- package/dist/utils/hdr.d.ts.map +1 -0
- package/dist/utils/hdr.js +87 -0
- package/dist/utils/hdr.js.map +1 -0
- package/dist/utils/layerCompositor.d.ts +36 -0
- package/dist/utils/layerCompositor.d.ts.map +1 -0
- package/dist/utils/layerCompositor.js +49 -0
- package/dist/utils/layerCompositor.js.map +1 -0
- package/dist/utils/shaderTransitions.d.ts +166 -0
- package/dist/utils/shaderTransitions.d.ts.map +1 -0
- package/dist/utils/shaderTransitions.js +894 -0
- package/dist/utils/shaderTransitions.js.map +1 -0
- package/package.json +3 -2
- package/src/config.ts +16 -0
- package/src/index.ts +61 -0
- package/src/services/browserManager.ts +6 -3
- package/src/services/chunkEncoder.test.ts +88 -0
- package/src/services/chunkEncoder.ts +35 -9
- package/src/services/chunkEncoder.types.ts +3 -0
- package/src/services/hdrCapture.test.ts +159 -0
- package/src/services/hdrCapture.ts +354 -0
- package/src/services/screenshotService.ts +271 -17
- package/src/services/streamingEncoder.test.ts +228 -0
- package/src/services/streamingEncoder.ts +153 -63
- package/src/services/videoFrameExtractor.ts +135 -31
- package/src/services/videoFrameInjector.ts +342 -0
- package/src/types.ts +34 -0
- package/src/utils/alphaBlit.test.ts +993 -0
- package/src/utils/alphaBlit.ts +643 -0
- package/src/utils/ffprobe.ts +22 -0
- package/src/utils/hdr.test.ts +191 -0
- package/src/utils/hdr.ts +137 -0
- package/src/utils/layerCompositor.test.ts +141 -0
- package/src/utils/layerCompositor.ts +58 -0
- package/src/utils/shaderTransitions.test.ts +674 -0
- package/src/utils/shaderTransitions.ts +1130 -0
- package/src/utils/uint16-alignment-audit.test.ts +125 -0
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" />
|
|
2
|
+
/**
|
|
3
|
+
* HDR Capture Service
|
|
4
|
+
*
|
|
5
|
+
* Captures HDR video frames via WebGPU float16 readback.
|
|
6
|
+
*
|
|
7
|
+
* The pipeline:
|
|
8
|
+
* 1. FFmpeg extracts raw HDR pixels (rgba64le) from video sources
|
|
9
|
+
* 2. Node converts HLG/PQ signal → linear light → float16
|
|
10
|
+
* 3. writeTexture uploads float16 data to WebGPU rgba16float texture
|
|
11
|
+
* 4. (Optional) WebGPU shader applies GSAP CSS transform
|
|
12
|
+
* 5. readback extracts float16 RGBA via base64 transfer
|
|
13
|
+
* 6. Node converts linear float16 → PQ signal → pipe to FFmpeg H.265
|
|
14
|
+
*
|
|
15
|
+
* Requirements:
|
|
16
|
+
* - Headed Chrome (not headless) — WebGPU unavailable in headless mode
|
|
17
|
+
* - GPU access (Metal on macOS, Vulkan+NVIDIA on Linux)
|
|
18
|
+
*
|
|
19
|
+
* Performance: ~6 fps at 1080x1920 via base64 transfer.
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, readdirSync } from "fs";
|
|
22
|
+
import { join } from "path";
|
|
23
|
+
import { homedir } from "os";
|
|
24
|
+
// ── PQ (SMPTE 2084) OETF ─────────────────────────────────────────────────────
|
|
25
|
+
const PQ_M1 = 0.1593017578125;
|
|
26
|
+
const PQ_M2 = 78.84375;
|
|
27
|
+
const PQ_C1 = 0.8359375;
|
|
28
|
+
const PQ_C2 = 18.8515625;
|
|
29
|
+
const PQ_C3 = 18.6875;
|
|
30
|
+
const PQ_MAX_NITS = 10000.0;
|
|
31
|
+
const SDR_NITS = 203.0;
|
|
32
|
+
function linearToPQ(L) {
|
|
33
|
+
const Lp = Math.max(0, (L * SDR_NITS) / PQ_MAX_NITS);
|
|
34
|
+
const Lm1 = Math.pow(Lp, PQ_M1);
|
|
35
|
+
return Math.pow((PQ_C1 + PQ_C2 * Lm1) / (1.0 + PQ_C3 * Lm1), PQ_M2);
|
|
36
|
+
}
|
|
37
|
+
function float16Decode(h) {
|
|
38
|
+
const sign = (h >> 15) & 1;
|
|
39
|
+
const exp = (h >> 10) & 0x1f;
|
|
40
|
+
const frac = h & 0x3ff;
|
|
41
|
+
if (exp === 0)
|
|
42
|
+
return (sign ? -1 : 1) * Math.pow(2, -14) * (frac / 1024);
|
|
43
|
+
if (exp === 31)
|
|
44
|
+
return frac ? NaN : sign ? -Infinity : Infinity;
|
|
45
|
+
return (sign ? -1 : 1) * Math.pow(2, exp - 15) * (1 + frac / 1024);
|
|
46
|
+
}
|
|
47
|
+
// ── Initialization ────────────────────────────────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* Inject the WebGPU HDR readback runtime into the page.
|
|
50
|
+
*
|
|
51
|
+
* Creates an rgba16float render texture that accepts writeTexture uploads
|
|
52
|
+
* and provides readback via base64 transfer.
|
|
53
|
+
*/
|
|
54
|
+
export async function initHdrReadback(page, width, height) {
|
|
55
|
+
return page.evaluate(async (w, h) => {
|
|
56
|
+
if (!navigator.gpu)
|
|
57
|
+
return false;
|
|
58
|
+
const adapter = await navigator.gpu.requestAdapter();
|
|
59
|
+
if (!adapter)
|
|
60
|
+
return false;
|
|
61
|
+
const device = await adapter.requestDevice();
|
|
62
|
+
const bytesPerPixel = 8; // rgba16float = 4 channels × 2 bytes
|
|
63
|
+
const bytesPerRow = Math.ceil((w * bytesPerPixel) / 256) * 256;
|
|
64
|
+
// Render texture — includes COPY_DST for writeTexture uploads
|
|
65
|
+
const renderTexture = device.createTexture({
|
|
66
|
+
size: [w, h],
|
|
67
|
+
format: "rgba16float",
|
|
68
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT |
|
|
69
|
+
GPUTextureUsage.COPY_SRC |
|
|
70
|
+
GPUTextureUsage.COPY_DST |
|
|
71
|
+
GPUTextureUsage.TEXTURE_BINDING,
|
|
72
|
+
});
|
|
73
|
+
const readBuffer = device.createBuffer({
|
|
74
|
+
size: bytesPerRow * h,
|
|
75
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,
|
|
76
|
+
});
|
|
77
|
+
const captureRuntime = {
|
|
78
|
+
device,
|
|
79
|
+
renderTexture,
|
|
80
|
+
readBuffer,
|
|
81
|
+
bytesPerRow,
|
|
82
|
+
width: w,
|
|
83
|
+
height: h,
|
|
84
|
+
/**
|
|
85
|
+
* Upload pre-converted float16 RGBA data and read it back.
|
|
86
|
+
* The float16 data must be row-aligned to bytesPerRow.
|
|
87
|
+
*
|
|
88
|
+
* Input: base64-encoded Uint16Array (float16 RGBA, row-padded)
|
|
89
|
+
* Output: base64-encoded readback of the same texture
|
|
90
|
+
*/
|
|
91
|
+
async uploadAndReadback(float16Base64) {
|
|
92
|
+
// Decode base64 → Uint8Array
|
|
93
|
+
const binary = atob(float16Base64);
|
|
94
|
+
const bytes = new Uint8Array(binary.length);
|
|
95
|
+
for (let i = 0; i < binary.length; i++)
|
|
96
|
+
bytes[i] = binary.charCodeAt(i);
|
|
97
|
+
// Upload to texture
|
|
98
|
+
device.queue.writeTexture({ texture: renderTexture }, bytes.buffer, { bytesPerRow, rowsPerImage: h }, [w, h]);
|
|
99
|
+
// Readback
|
|
100
|
+
const encoder = device.createCommandEncoder();
|
|
101
|
+
encoder.copyTextureToBuffer({ texture: renderTexture }, { buffer: readBuffer, bytesPerRow }, [w, h]);
|
|
102
|
+
device.queue.submit([encoder.finish()]);
|
|
103
|
+
await readBuffer.mapAsync(GPUMapMode.READ);
|
|
104
|
+
const readBytes = new Uint8Array(readBuffer.getMappedRange().slice(0));
|
|
105
|
+
readBuffer.unmap();
|
|
106
|
+
// Base64 encode in chunks
|
|
107
|
+
let b64 = "";
|
|
108
|
+
const chunkSize = 32768;
|
|
109
|
+
for (let i = 0; i < readBytes.length; i += chunkSize) {
|
|
110
|
+
const slice = readBytes.subarray(i, Math.min(i + chunkSize, readBytes.length));
|
|
111
|
+
b64 += String.fromCharCode(...slice);
|
|
112
|
+
}
|
|
113
|
+
return { base64: btoa(b64), bytesPerRow };
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
window.__hfHdrCapture = captureRuntime;
|
|
117
|
+
return true;
|
|
118
|
+
}, width, height);
|
|
119
|
+
}
|
|
120
|
+
// ── HDR frame conversion ──────────────────────────────────────────────────────
|
|
121
|
+
/**
|
|
122
|
+
* Convert raw rgba64le pixels (from FFmpeg) to a base64 string for FFmpeg encoding.
|
|
123
|
+
*
|
|
124
|
+
* For HLG sources: the pixel values are already HLG-encoded. We pass them through
|
|
125
|
+
* as-is (normalized to 16-bit) and tag the output as HLG. No OETF conversion needed —
|
|
126
|
+
* the HLG signal values ARE the correct encoding. Converting to linear and back to
|
|
127
|
+
* PQ produces worse results because every viewer's PQ→display tone-mapping differs
|
|
128
|
+
* from its HLG→display tone-mapping.
|
|
129
|
+
*
|
|
130
|
+
* The WebGPU round-trip is skipped for pass-through — the pixels go directly from
|
|
131
|
+
* FFmpeg extraction to FFmpeg encoding. WebGPU is only needed when transforms
|
|
132
|
+
* (scale, rotate, opacity from GSAP) must be applied to the HDR pixels.
|
|
133
|
+
*/
|
|
134
|
+
export function convertHdrFrameToRgb48le(rawRgba64le, width, height) {
|
|
135
|
+
const input = new Uint16Array(rawRgba64le.buffer, rawRgba64le.byteOffset, rawRgba64le.byteLength / 2);
|
|
136
|
+
// Convert RGBA → RGB (drop alpha) for rgb48le output
|
|
137
|
+
const output = Buffer.alloc(width * height * 6);
|
|
138
|
+
for (let y = 0; y < height; y++) {
|
|
139
|
+
for (let x = 0; x < width; x++) {
|
|
140
|
+
const srcIdx = (y * width + x) * 4;
|
|
141
|
+
const dstIdx = (y * width + x) * 6;
|
|
142
|
+
output.writeUInt16LE(input[srcIdx] ?? 0, dstIdx);
|
|
143
|
+
output.writeUInt16LE(input[srcIdx + 1] ?? 0, dstIdx + 2);
|
|
144
|
+
output.writeUInt16LE(input[srcIdx + 2] ?? 0, dstIdx + 4);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return output;
|
|
148
|
+
}
|
|
149
|
+
// ── Frame upload + readback ───────────────────────────────────────────────────
|
|
150
|
+
/**
|
|
151
|
+
* Upload a float16 frame to WebGPU and read it back.
|
|
152
|
+
* Call after converting with convertHdrFrameToFloat16Base64.
|
|
153
|
+
*/
|
|
154
|
+
export async function uploadAndReadbackHdrFrame(page, float16Base64) {
|
|
155
|
+
const result = await page.evaluate(async (b64) => {
|
|
156
|
+
const hdr = window.__hfHdrCapture;
|
|
157
|
+
if (!hdr)
|
|
158
|
+
throw new Error("HDR capture not initialized");
|
|
159
|
+
return hdr.uploadAndReadback(b64);
|
|
160
|
+
}, float16Base64);
|
|
161
|
+
return {
|
|
162
|
+
rawBuffer: Buffer.from(result.base64, "base64"),
|
|
163
|
+
bytesPerRow: result.bytesPerRow,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
// ── PQ conversion ─────────────────────────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* Convert float16 RGBA readback to PQ-encoded rgb48le for FFmpeg.
|
|
169
|
+
*/
|
|
170
|
+
export function float16ToPqRgb(rawBuffer, bytesPerRow, width, height) {
|
|
171
|
+
const data = new Uint16Array(rawBuffer.buffer, rawBuffer.byteOffset, rawBuffer.byteLength / 2);
|
|
172
|
+
const channelsPerRow = bytesPerRow / 2;
|
|
173
|
+
const output = Buffer.alloc(width * height * 6);
|
|
174
|
+
for (let y = 0; y < height; y++) {
|
|
175
|
+
for (let x = 0; x < width; x++) {
|
|
176
|
+
const srcIdx = y * channelsPerRow + x * 4;
|
|
177
|
+
const r = float16Decode(data[srcIdx] ?? 0);
|
|
178
|
+
const g = float16Decode(data[srcIdx + 1] ?? 0);
|
|
179
|
+
const b = float16Decode(data[srcIdx + 2] ?? 0);
|
|
180
|
+
const dstIdx = (y * width + x) * 6;
|
|
181
|
+
output.writeUInt16LE(Math.round(Math.min(1.0, linearToPQ(r)) * 65535), dstIdx);
|
|
182
|
+
output.writeUInt16LE(Math.round(Math.min(1.0, linearToPQ(g)) * 65535), dstIdx + 2);
|
|
183
|
+
output.writeUInt16LE(Math.round(Math.min(1.0, linearToPQ(b)) * 65535), dstIdx + 4);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return output;
|
|
187
|
+
}
|
|
188
|
+
// ── Chrome launch ─────────────────────────────────────────────────────────────
|
|
189
|
+
function resolveHeadedChromePath() {
|
|
190
|
+
const baseDir = join(homedir(), ".cache", "puppeteer", "chrome");
|
|
191
|
+
if (!existsSync(baseDir))
|
|
192
|
+
return undefined;
|
|
193
|
+
const versions = readdirSync(baseDir).sort().reverse();
|
|
194
|
+
for (const version of versions) {
|
|
195
|
+
const candidates = [
|
|
196
|
+
join(baseDir, version, "chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"),
|
|
197
|
+
join(baseDir, version, "chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"),
|
|
198
|
+
join(baseDir, version, "chrome-linux64", "chrome"),
|
|
199
|
+
join(baseDir, version, "chrome-win64", "chrome.exe"),
|
|
200
|
+
];
|
|
201
|
+
for (const binary of candidates) {
|
|
202
|
+
if (existsSync(binary))
|
|
203
|
+
return binary;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Launch a headed Chrome browser with WebGPU enabled.
|
|
210
|
+
*/
|
|
211
|
+
export async function launchHdrBrowser(width, height) {
|
|
212
|
+
let ppt;
|
|
213
|
+
try {
|
|
214
|
+
const mod = await import("puppeteer");
|
|
215
|
+
ppt = mod.default;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
const code = err?.code;
|
|
219
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") {
|
|
220
|
+
throw err;
|
|
221
|
+
}
|
|
222
|
+
const mod = await import("puppeteer-core");
|
|
223
|
+
ppt = mod.default;
|
|
224
|
+
}
|
|
225
|
+
if (!ppt)
|
|
226
|
+
throw new Error("Neither puppeteer nor puppeteer-core found");
|
|
227
|
+
const chromePath = resolveHeadedChromePath();
|
|
228
|
+
if (!chromePath) {
|
|
229
|
+
throw new Error("[HDR] No Chrome binary found. Install: npx @puppeteer/browsers install chrome@stable");
|
|
230
|
+
}
|
|
231
|
+
const browser = await ppt.launch({
|
|
232
|
+
headless: false,
|
|
233
|
+
executablePath: chromePath,
|
|
234
|
+
args: buildHdrChromeArgs(width, height),
|
|
235
|
+
});
|
|
236
|
+
const page = await browser.newPage();
|
|
237
|
+
await page.setViewport({ width, height });
|
|
238
|
+
return { browser, page };
|
|
239
|
+
}
|
|
240
|
+
export function buildHdrChromeArgs(width, height) {
|
|
241
|
+
return [
|
|
242
|
+
"--enable-unsafe-webgpu",
|
|
243
|
+
"--no-sandbox",
|
|
244
|
+
"--disable-setuid-sandbox",
|
|
245
|
+
"--window-position=-10000,-10000",
|
|
246
|
+
`--window-size=${width},${height}`,
|
|
247
|
+
"--disable-background-timer-throttling",
|
|
248
|
+
"--disable-backgrounding-occluded-windows",
|
|
249
|
+
"--disable-renderer-backgrounding",
|
|
250
|
+
"--disable-background-media-suspend",
|
|
251
|
+
"--disable-extensions",
|
|
252
|
+
"--disable-component-update",
|
|
253
|
+
"--disable-default-apps",
|
|
254
|
+
"--disable-sync",
|
|
255
|
+
"--no-zygote",
|
|
256
|
+
"--force-gpu-mem-available-mb=4096",
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=hdrCapture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hdrCapture.js","sourceRoot":"","sources":["../../src/services/hdrCapture.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAA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AAkC;QAClC,oCAAoC;QACpC,sBAAsB;QACtB,4BAA4B;QAC5B,wBAAwB;QACxB,gBAAgB;QAChB,aAAa;QACb,mCAAmC;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -20,6 +20,121 @@ export declare function beginFrameCapture(page: Page, options: CaptureOptions, f
|
|
|
20
20
|
* Fallback for environments where BeginFrame is unavailable (macOS, Windows).
|
|
21
21
|
*/
|
|
22
22
|
export declare function pageScreenshotCapture(page: Page, options: CaptureOptions): Promise<Buffer>;
|
|
23
|
+
/**
|
|
24
|
+
* Capture a screenshot with transparent background (PNG + alpha channel).
|
|
25
|
+
*
|
|
26
|
+
* Used in the two-pass HDR compositing pipeline — captures DOM content
|
|
27
|
+
* (text, graphics, SDR overlays) with transparency where the background shows,
|
|
28
|
+
* so it can be overlaid on top of native HDR video frames in FFmpeg.
|
|
29
|
+
*
|
|
30
|
+
* Sets and restores the background color override on every call. For sessions
|
|
31
|
+
* that capture many frames, prefer calling initTransparentBackground() once
|
|
32
|
+
* at session init, then captureAlphaPng() per frame to avoid the 2× CDP
|
|
33
|
+
* round-trip overhead.
|
|
34
|
+
*/
|
|
35
|
+
export declare function captureScreenshotWithAlpha(page: Page, width: number, height: number): Promise<Buffer>;
|
|
36
|
+
/**
|
|
37
|
+
* Set the page background to transparent once for a dedicated HDR DOM session.
|
|
38
|
+
*
|
|
39
|
+
* Call this once after session initialization. Then use captureAlphaPng() per
|
|
40
|
+
* frame instead of captureScreenshotWithAlpha() to skip the per-frame CDP
|
|
41
|
+
* background override round-trips.
|
|
42
|
+
*
|
|
43
|
+
* Only use on sessions that are exclusively dedicated to transparent capture
|
|
44
|
+
* (e.g., the HDR two-pass DOM layer session) — the background will stay
|
|
45
|
+
* transparent for the lifetime of the session.
|
|
46
|
+
*
|
|
47
|
+
* NOTE on the injected stylesheet: `Emulation.setDefaultBackgroundColorOverride`
|
|
48
|
+
* only replaces the *default* page background. Compositions almost always set
|
|
49
|
+
* `body { background: ... }` and `#root { background: ... }`, which paint over
|
|
50
|
+
* the override and ruin alpha capture for layered HDR compositing — the
|
|
51
|
+
* composition root's full-frame background paints across the entire viewport
|
|
52
|
+
* and wipes out HDR content captured beneath it.
|
|
53
|
+
*
|
|
54
|
+
* We force `html`, `body`, and any element marked as a composition root
|
|
55
|
+
* (`[data-composition-id]`) to transparent. In HDR layered compositing the HDR
|
|
56
|
+
* video itself is the backdrop, so DOM layers must only contribute their
|
|
57
|
+
* foreground UI pixels — never a page-spanning solid backdrop.
|
|
58
|
+
*/
|
|
59
|
+
export declare const TRANSPARENT_BG_STYLE_ID = "__hf_transparent_bg__";
|
|
60
|
+
export declare function initTransparentBackground(page: Page): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Capture a transparent-background PNG screenshot without setting the
|
|
63
|
+
* background color override. Requires initTransparentBackground() to have
|
|
64
|
+
* been called once on this session.
|
|
65
|
+
*
|
|
66
|
+
* Faster than captureScreenshotWithAlpha() for per-frame use in the HDR
|
|
67
|
+
* two-pass compositing loop.
|
|
68
|
+
*/
|
|
69
|
+
export declare function captureAlphaPng(page: Page, width: number, height: number): Promise<Buffer>;
|
|
70
|
+
/**
|
|
71
|
+
* Stylesheet ID used by applyDomLayerMask / removeDomLayerMask. Exposed so
|
|
72
|
+
* tests can assert presence/absence of the mask between captures.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DOM_LAYER_MASK_STYLE_ID = "__hf_dom_layer_mask__";
|
|
75
|
+
/**
|
|
76
|
+
* Mask the DOM so a single layer screenshot captures ONLY the layer's pixels.
|
|
77
|
+
*
|
|
78
|
+
* The HDR layered compositor walks z-ordered layers and blits each one over a
|
|
79
|
+
* shared canvas. DOM layers are full-page screenshots — a naive screenshot
|
|
80
|
+
* captures every painted pixel on the page, which means root background +
|
|
81
|
+
* static overlays + sibling-scene content all overwrite previously composited
|
|
82
|
+
* HDR content beneath. The mask narrows each screenshot to the elements that
|
|
83
|
+
* actually belong to this layer.
|
|
84
|
+
*
|
|
85
|
+
* Strategy:
|
|
86
|
+
*
|
|
87
|
+
* 1. Inject a stylesheet that hides every body descendant
|
|
88
|
+
* (`body * { visibility: hidden !important }`) and re-shows the layer's
|
|
89
|
+
* elements (and their descendants and their injected `__render_frame_*`
|
|
90
|
+
* siblings) via `visibility: visible !important`. CSS `visibility: visible`
|
|
91
|
+
* on a descendant overrides an ancestor's `visibility: hidden`, so deep
|
|
92
|
+
* layer elements remain visible even though intermediate parents are
|
|
93
|
+
* hidden by the mass-hide rule.
|
|
94
|
+
* 2. Inline-hide each `extraHideId` (and its `__render_frame_*` sibling) with
|
|
95
|
+
* `visibility: hidden !important`. Inline `!important` beats stylesheet
|
|
96
|
+
* `!important`, so this overrides the show rule for elements that fall
|
|
97
|
+
* under a show selector but should NOT paint — typically other-layer
|
|
98
|
+
* elements that are descendants of a container layer (for example HDR
|
|
99
|
+
* videos and other-layer SDR videos are descendants of `#root` when we
|
|
100
|
+
* capture the root DOM layer).
|
|
101
|
+
*
|
|
102
|
+
* Only `visibility` is set on extraHideIds — never `opacity`. CSS opacity is
|
|
103
|
+
* multiplicative through the descendant chain and a descendant cannot escape
|
|
104
|
+
* an ancestor's `opacity: 0`. If `#root` is in `extraHideIds` and we set
|
|
105
|
+
* `opacity: 0` on it, every descendant — including `#vid-5-b` and its
|
|
106
|
+
* `__render_frame_vid-5-b__` IMG — becomes invisible even with
|
|
107
|
+
* `visibility: visible !important`. `visibility` does NOT have this problem:
|
|
108
|
+
* a descendant with `visibility: visible` overrides an ancestor's
|
|
109
|
+
* `visibility: hidden`.
|
|
110
|
+
*
|
|
111
|
+
* Layout is preserved (visibility doesn't trigger reflow), so border-radius
|
|
112
|
+
* clipping, overflow:hidden, and absolute positioning continue to apply to
|
|
113
|
+
* the visible layer elements. Opacity is also preserved — an ancestor at
|
|
114
|
+
* `opacity: 0` (e.g. an inactive scene during a transition) still
|
|
115
|
+
* propagates to its descendants, which is the desired behavior during
|
|
116
|
+
* cross-scene blends.
|
|
117
|
+
*
|
|
118
|
+
* Idempotent across calls: an existing mask stylesheet is removed before a
|
|
119
|
+
* new one is installed, so consecutive `applyDomLayerMask` invocations leave
|
|
120
|
+
* exactly one stylesheet attached.
|
|
121
|
+
*/
|
|
122
|
+
export declare function applyDomLayerMask(page: Page, showIds: string[], extraHideIds: string[]): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Tear down the mask installed by applyDomLayerMask.
|
|
125
|
+
*
|
|
126
|
+
* Removes the mask stylesheet and clears the inline `visibility` properties
|
|
127
|
+
* set on `extraHideIds` (and their `__render_frame_*` siblings).
|
|
128
|
+
*
|
|
129
|
+
* IMPORTANT: We do NOT strip inline `opacity` here. applyDomLayerMask only
|
|
130
|
+
* ever sets `visibility` (never `opacity`), so any inline opacity present on
|
|
131
|
+
* a wrapper was put there by user animation code (typically GSAP) and must
|
|
132
|
+
* survive across per-layer captures. GSAP's seek with suppress-events does
|
|
133
|
+
* not re-apply tweens when the timeline is already at the target time, so if
|
|
134
|
+
* we strip opacity here and then seek to the same time for the next layer,
|
|
135
|
+
* GSAP won't put it back and the wrapper will render fully opaque.
|
|
136
|
+
*/
|
|
137
|
+
export declare function removeDomLayerMask(page: Page, extraHideIds: string[]): Promise<void>;
|
|
23
138
|
export declare function injectVideoFramesBatch(page: Page, updates: Array<{
|
|
24
139
|
videoId: string;
|
|
25
140
|
dataUri: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshotService.d.ts","sourceRoot":"","sources":["../../src/services/screenshotService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,eAAe,oDAA2D,CAAC;AAExF,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,gBAAgB,EAAE,UAAU,CAAC,CAO5F;AAED;;GAEG;AACH,MAAM,W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