MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / captureFrame

Function captureFrame

packages/engine/src/services/frameCapture.ts:1770–1788  ·  view source on GitHub ↗
(
  session: CaptureSession,
  frameIndex: number,
  time: number,
)

Source from the content-addressed store, hash-verified

1768}
1769
1770export async function captureFrame(
1771 session: CaptureSession,
1772 frameIndex: number,
1773 time: number,
1774): Promise<CaptureResult> {
1775 const { options, outputDir } = session;
1776 const { buffer, quantizedTime, captureTimeMs } = await captureFrameCore(
1777 session,
1778 frameIndex,
1779 time,
1780 );
1781
1782 const ext = options.format === "png" ? "png" : "jpg";
1783 const frameName = `frame_${String(frameIndex).padStart(6, "0")}.${ext}`;
1784 const framePath = join(outputDir, frameName);
1785 writeFileSync(framePath, buffer);
1786
1787 return { frameIndex, time: quantizedTime, path: framePath, captureTimeMs };
1788}
1789
1790/**
1791 * Capture a frame and return the screenshot as a Buffer instead of writing to disk.

Callers 4

runCaptureStageFunction · 0.90
captureFrameRangeFunction · 0.85
generateThumbnailFunction · 0.85
generateThumbnailFunction · 0.85

Calls 1

captureFrameCoreFunction · 0.85

Tested by

no test coverage detected