UNPKG

canvas-record

Version:

Record a video in the browser or directly on the File System from a canvas region (2D/WebGL/WebGPU) as MP4, WebM, MKV, MOV, GIF, PNG/JPG Sequence using WebCodecs and wasm when available.

35 lines (34 loc) 1.28 kB
/** * Check for WebCodecs support on the current platform. * @type {boolean} */ export const isWebCodecsSupported: boolean; export function downloadBlob(filename: any, blobPart: any, mimeType: any): void; export function captureCanvasRegion(canvas: any, x: any, y: any, width: any, height: any): any; export function formatDate(date: any): any; export function formatSeconds(seconds: any): string; export function nextMultiple(x: any, n?: number): number; export class Deferred { resolve: (value: any) => void; reject: (reason?: any) => void; promise: Promise<any>; } /** * Estimate the bit rate of a video rounded to nearest megabit. * Based on "H.264 for the rest of us" by Kush Amerasinghe. * * @example * ```js * // Full HD (1080p) * const bitRate = estimateBitRate(1920, 1080, 30, "variable"); * const bitRateMbps = bitRate * 1_000_000; // => 13 Mbps * ``` * * @param {number} width * @param {number} height * @param {number} frameRate * @param {number} motionRank A factor of 1, 2 or 4 * @param {"variable" | "constant"} bitrateMode * @returns {number} A bitrate value in bits per second */ export function estimateBitRate(width: number, height: number, frameRate?: number, motionRank?: number, bitrateMode?: "variable" | "constant"): number;