/** * chrome-live screencast recording — mp4 assembly for the frames a * `browser_screencast_stop` hands back. * * The frames arrive as base64 JPEG (or PNG) stills straight from CDP * `Page.screencastFrame`. mp4 encoding needs a real video toolchain: ffmpeg * (checked for on PATH at encode time; the tool answers with a clear "install * ffmpeg" error when absent rather than failing obscurely). * * Stateless-MCP note: nothing live lives here — the long-lived frame buffer is * owned by the chrome-live adapter instance (module-level `entries` in * adapters/browser-chrome/src/live.ts, reached through the module-scope * `liveInstances` map in browser-tools.ts). This module is a pure * frames-in → file-out function, so per-request tool factory re-runs can never * strand recording state (the liveInstances bug class). */ /** Frame shape shared with the adapter's ChromeLiveScreencastFrame (structural — no adapter import). */ interface ScreencastFrameLike { data: string; format: "jpeg" | "png"; timestampMs: number; index: number; width?: number; height?: number; } /** * Build the concat-demuxer list for `frames`. Each `duration` is the time * the frame is SHOWN, i.e. the gap to the NEXT frame (ts[i+1] - ts[i]), * clamped into [0.05, 2] seconds; using the gap BEHIND shifted every frame's * show time one frame late. The last frame has no successor and is shown for * the fallback interval, then named again (the concat demuxer ignores the * duration of the final entry). */ declare function buildScreencastConcatList(frames: ScreencastFrameLike[]): string[]; /** * Encode buffered screencast frames into an mp4 at `outPath`. * * Uses the concat demuxer with a per-frame `duration` from * `buildScreencastConcatList` (frames arrive on an irregular cadence), * re-timed to 10fps so players handle the sparse stream. * Resolves the output path; throws with a clear cause when ffmpeg is missing * or fails. */ declare function encodeScreencastFramesToMp4(frames: ScreencastFrameLike[], outPath: string, opts?: { fps?: number; }): Promise; /** Ensure the output directory exists (the session dir normally does, but be safe). */ declare function prepareScreencastOutDir(dir: string): Promise; /** `ffmpeg` presence — exported so tools/tests can degrade gracefully without guessing. */ declare function hasFfmpeg(): Promise; export { type ScreencastFrameLike, buildScreencastConcatList, encodeScreencastFramesToMp4, hasFfmpeg, prepareScreencastOutDir };