@mastra/core
Version:
33 lines • 1.25 kB
TypeScript
/**
* Pure-JS Motion-JPEG AVI muxer.
*
* Writes a list of JPEG frames into an AVI 1.0 container so that the resulting
* `.avi` file plays in QuickTime / Preview / VLC / Chromium without depending
* on ffmpeg or any native module.
*
* Implements the bare minimum of the RIFF/AVI spec needed for an MJPEG video
* stream with no audio. All fields are little-endian.
*
* Reference: https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference
*/
/** A single MJPEG frame to mux. */
export interface MjpegFrame {
/** JPEG bytes (must start with the SOI marker 0xFF 0xD8). */
bytes: Uint8Array;
/** Milliseconds since recording start. Used to compute the average frame rate. */
timestampMs: number;
}
export interface MjpegAviOptions {
/** Frame width in pixels. */
width: number;
/** Frame height in pixels. */
height: number;
}
/**
* Encode a list of MJPEG frames as an AVI 1.0 file.
*
* The file is written incrementally to disk so we don't have to hold the whole
* AVI in memory — large recordings can be hundreds of MB.
*/
export declare function writeMjpegAviFile(filePath: string, frames: readonly MjpegFrame[], opts: MjpegAviOptions): void;
//# sourceMappingURL=mjpeg-avi.d.ts.map