Video Exportv0.1.0 · MIT

NODE.JS · ELECTRON

Video Export SDK

Encode ordered PNG or RGBA frames and an optional soundtrack into a verified H.264 MP4. The host supplies FFmpeg and FFprobe; the library owns bounded input, backpressure, cancellation and atomic publication.

Use Node.js ≥24.18.1 <25 or Electron's Node/main process. Capture and rendering belong to your application. This package has no browser encoder, GPU, renderer or application-project dependency.

Install and integrate

npm install @karoly-pfaff/video-export@0.1.0

The package registry is GitHub Packages. Configure your scope and read credentials when required. An unpublished candidate can be installed from its local archive:

@karoly-pfaff:registry=https://npm.pkg.github.com
npm install /absolute/path/video-export.tgz

Provide absolute paths to compatible FFmpeg/FFprobe executables. Software encoding requires libx264, raw RGBA and AAC support; PNG normalization uses pngjs. The host installs/distributes native tools and owns their licenses. The SDK's own code is MIT. It does not download tools.

On Electron, call the SDK in the main process or a Node worker; the renderer submits bounded work through the host's bridge. Map renderer shutdown/cancellation to one AbortController. Keep FFmpeg and FFprobe from the same compatible build.

Request planner

Choose a profile to generate a settings object for a roughly ten-second export. This runs entirely locally and creates no video. Integer frame counts determine the actual duration at fractional frame rates.

Enable JavaScript to generate settings. All API reference and recipes below remain readable without it.

ENCODING

RGBA frames to MP4

This complete recipe generates thirty synthetic 320×180 frames. Supply absolute native tool/output paths and an AbortSignal. The host can replace the producer with captured frames while retaining the same packet contract.

import { encodeVideo, createEncodingPreferences } from '@karoly-pfaff/video-export';
import type { MediaTools, VideoFrame, VideoExportResult } from '@karoly-pfaff/video-export';

/** Generates one second of already composed synthetic RGBA; supply your renderer instead. */
async function* createFrames(): AsyncGenerator<VideoFrame> {
  for (let index = 0; index < 30; index++) {
    const bytes = Buffer.alloc(320 * 180 * 4, 255);
    for (let offset = 0; offset < bytes.length; offset += 4) {
      bytes[offset] = index * 8;
      bytes[offset + 1] = 110;
      bytes[offset + 2] = 190;
    }
    yield await Promise.resolve({ index, bytes });
  }
}

export async function exportRgba(
  outputPath: string,
  tools: MediaTools,
  signal: AbortSignal,
): Promise<VideoExportResult> {
  return await encodeVideo(
    {
      tools,
      outputPath,
      width: 320,
      height: 180,
      frameRate: { numerator: 30, denominator: 1 },
      frameCount: 30,
      input: { kind: 'rgba-stream', alphaMode: 'opaque', frames: createFrames() },
      encoding: createEncodingPreferences({ mode: 'software' }),
      threads: 2,
    },
    signal,
  );
}

RGBA8 is tightly packed, width × height × 4 bytes, ordered R,G,B,A. Omitted or straight alpha composites over the RGB background, black by default. Explicit opaque accepts already composed RGB colors, ignores alpha bytes/background and skips alpha handling. The MP4 is opaque.

PNG streams and explicit sequences

A stream yields { index, bytes }; a sequence supplies absolute paths in exact order. Filenames are never sorted or globbed. Both validate the PNG signature, matching geometry, CRCs and single-image envelope; animation and trailing content are rejected.

import { encodeVideo } from '@karoly-pfaff/video-export';
import type { EncodeVideoRequest, VideoFrame, VideoExportResult } from '@karoly-pfaff/video-export';

/** Files must be absolute, ordered explicitly and match request.frameCount and geometry. */
export async function exportPngFiles(
  request: EncodeVideoRequest,
  files: readonly string[],
  signal: AbortSignal,
): Promise<VideoExportResult> {
  return await encodeVideo({ ...request, input: { kind: 'png-sequence', files } }, signal);
}

/** Yield validated PNG packets indexed 0..frameCount-1; honor cancellation in the producer. */
export async function exportPngStream(
  request: EncodeVideoRequest,
  frames: AsyncIterable<VideoFrame>,
  signal: AbortSignal,
): Promise<VideoExportResult> {
  return await encodeVideo({ ...request, input: { kind: 'png-stream', frames } }, signal);
}

Indices are zero-based, consecutive and exact: missing, extra, duplicate or out-of-order packets fail. Keep each packet immutable until the next producer pull. Only one frame is pulled, copied/normalized and written with backpressure at a time; no prefetch is performed. Honor cancellation in the producer and release its own source resources.

Request fields, units and defaults

EncodeVideoRequest
Field Contract
tools Absolute ffmpeg/ffprobe paths, no embedded NUL. Executables belong to the host.
width, height Positive even integers, 2–16384 per axis. Decoded frame limit: 128 MiB RGBA.
frameRate Positive safe integer numerator/denominator. Reduced components must fit signed 32-bit FFmpeg time bases. Use reduceFrameRate; no fps rounding.
frameCount Positive safe integer and exact EOF. Rational frame ticks and estimated output space must remain safely representable.
input rgba-stream, png-stream or png-sequence. Maximum PNG: 64 MiB.
outputPath Absolute .mp4 path, new destination. Same-volume hard-link support is required.
audio Optional absolute local path and nonnegative offsetSeconds (default 0). Uses the first audio stream; trims to exact video duration.
encoding Default h264-aac-v1, high quality, balanced speed, automatic encoder. createEncodingPreferences validates partial overrides.
threads Software video threads: integer 1–8, default 2. Legacy settings retain their fixed thread policy.
background RGB tuple of integers 0–255, default black. Ignored only for explicitly opaque RGBA.
onProgress Optional synchronous callback; return void. Thenables and callback errors reject before publication.
preflightCache Optional in-process handle created by createEncoderPreflightCache; do not persist it in project data.

Duration is frameCount × denominator / numerator seconds. Use frameDurationSeconds for safe tick accounting and formatFrameRate for FFmpeg's rational text. Insufficient soundtrack duration is rejected within one video frame plus one AAC packet (1024/48000 s); source audio metadata is probed without counting decoded audio frames.

Quality and encoder policy

Default preferences are high quality, balanced CPU speed and automatic encoder selection. Optional audio uses an absolute path and offsetSeconds ≥0, default zero, selecting its first audio stream.

Output is H.264/yuv420p MP4 with optional AAC 320 kb/s at 48 kHz. Quality is compact/high/maximum; CPU speed balanced/thorough selects medium/slow. Automatic mode can select qualified Intel QSV and fall back to software during preflight only. Explicit intel-qsv requires successful hardware/CQP and exact-profile qualification. No runtime retry replays a consumed producer.

The explicit legacy-libx264-v1 recipe retains fast/CRF18, two threads, maxrate20M/bufsize40M and AAC192. No legacy snapshot is silently converted. NVENC, AMF and VideoToolbox are outside the qualified encoder set.

Qualified profile values

Quality Software CRF QSV quantizer Minimum preflight SSIM
compact 23 24 0.95
high 18 18 0.98
maximum 16 14 0.99

QSV must prove hardware CQP mode and matching target usage. These values define the current versioned recipes; they are not guaranteed output bitrates or cross-machine performance promises.

CAPABILITIES

Preflight and safe cache reuse

inspectEncoders(tools, signal, cache?) reads actual tool version/configuration identities and encoder listings, then qualifies listed libx264/QSV implementations. An encoder name appearing in a list is not proof it works. qualifyVideoEncoder(request, signal) additionally checks exact geometry, cadence, preferences and SSIM before capture begins; it never opens the producer.

import {
  createEncoderPreflightCache,
  qualifyVideoEncoder,
  encodeVideo,
} from '@karoly-pfaff/video-export';
import type {
  EncodeVideoRequest,
  VideoExportResult,
  EncoderPreflightCache,
} from '@karoly-pfaff/video-export';

/** Reuse the returned handle for a sequential batch with the same actual tool/runtime revision. */
export function createBatchCache(environmentIdentity: string): EncoderPreflightCache {
  return createEncoderPreflightCache({ environmentIdentity });
}

export async function qualifyThenExport(
  request: EncodeVideoRequest,
  signal: AbortSignal,
): Promise<VideoExportResult> {
  // Both calls must receive the same cache handle, geometry and encoding preferences.
  const { tools, width, height, frameRate, encoding, threads, preflightCache } = request;
  await qualifyVideoEncoder(
    {
      tools,
      width,
      height,
      frameRate,
      ...(encoding === undefined ? {} : { encoding }),
      ...(threads === undefined ? {} : { threads }),
      ...(preflightCache === undefined ? {} : { preflightCache }),
    },
    signal,
  );
  return await encodeVideo(request, signal);
}

Attach one returned cache handle to requests in a sequential batch, including the preflight and encoding calls. environmentIdentity must identify the actual native runtime/shared-library environment. For QSV reuse, additionally supply hardwareIdentity from the real adapter/driver/runtime revision. Without it, hardware probes stay live.

ttlMs
Default 30000 ms, maximum 60000 ms. Expiry does not slide on a hit.
maximumEntries
Default 32, maximum 64; oldest entries are evicted.
clear()
Invalidates retained entries and in-flight results that finish later.

Only successful completed probes are cached. Canonical executable paths/stat identities, fresh tool version/configuration digests, all requested profile fields and encoder options bind cache keys. Version and encoder-list commands still run on hits. Missing executable identity bypasses reuse. Concurrent misses do not share promises or cancellation.

Runtime encoder/tool/output-verification failures clear the request handle. Every export retains input validation, final file verification and no-overwrite publication. A cache hit is not a performance guarantee or permission to skip correctness checks.

HOST INTEGRATION

Progress, cancellation and resource ownership

import { encodeVideo, VideoExportError } from '@karoly-pfaff/video-export';
import type {
  EncodeVideoRequest,
  VideoExportResult,
  VideoProgress,
} from '@karoly-pfaff/video-export';

/** The host owns the controller and updates UI synchronously from progress notifications. */
export async function exportWithProgress(
  request: EncodeVideoRequest,
  controls: {
    readonly signal: AbortSignal;
    readonly onProgress: (progress: VideoProgress) => void;
  },
): Promise<VideoExportResult | undefined> {
  try {
    return await encodeVideo({ ...request, onProgress: controls.onProgress }, controls.signal);
  } catch (error) {
    if (error instanceof VideoExportError && error.code === 'cancelled') return undefined;
    throw error;
  }
}

The host creates the AbortController, passes its signal through capture and export, and calls abort() when cancelled. The producer owns arbitrary pending source work. The SDK invokes and observes iterator.return() without waiting forever for uncooperative host code; it kills and reaps its own native child processes.

Progress stages are preflight, encoding, verifying and publishing. Notifications contain acceptedFrames, encodedFrames and totalFrames. Keep callbacks synchronous; update state or enqueue host work rather than return an async promise. No callback runs after atomic publication, and late abort cannot reclassify an already published file.

The result includes outputPath, byteLength, width/height, exact rational frameRate, decoded frameCount, stream durations/start times, sampleRate/channels, encoder selection/preflight evidence and tool identities. cleanupComplete=false reports leftover owned staging while preserving a successful destination. Only SDK staging is cleaned; caller directories and existing/racing output files are never removed or overwritten.

Errors and retries

Catch VideoExportError and inspect its stable code. For image comparison failures, ImageVerificationError also contains the zero-based frameIndex and normalized imageError. Backend causes can contain local diagnostics; retain them only in host-controlled logging. Library code does not print or terminate the process.

Code Host response
invalid-request / invalid-frame Correct configuration, input geometry, packet order, bytes or soundtrack bounds.
tool-unavailable / encoder-unavailable Check installed tools and selected profile; capability preflight may be rerun before a fresh producer.
hardware-encode-failed Offer an explicit host retry with software and a new replayable source. Never silently replay captured work.
output-exists Choose a new path. The existing or racing destination is preserved.
insufficient-space Free space or select another destination.
verification-failed Keep the failed result unpublished and inspect safe diagnostics.
cancelled Report the explicit cancellation; do not show it as a completed export.
export-failed Report the failed operation and retain its host-controlled cause.

Automatic software fallback happens only in preflight. A runtime hardware failure never reconsumes an iterator. Host retry requires a fresh immutable request and replayable source. Atomic publication uses a same-volume hard link and never replaces caller data, including races.

CONTENT CHECKS

Verify an existing video before host publication

verifyVideoFile checks a host-encoded H.264/yuv420p MP4 with AAC 48 kHz audio. Supply expected geometry, exact frame rate/count, ordered RGB24 16×9 reference fingerprints (432 bytes per frame) and source audio. Reference bytes are snapshotted before awaiting tools.

import {
  verifyVideoFile,
  createImageFingerprintVerifier,
  decodeVerificationAudio,
  verifyAudioSamples,
} from '@karoly-pfaff/video-export';
import type {
  VideoVerificationRequest,
  VideoFileVerification,
  MediaTools,
  VideoAudioAnchor,
} from '@karoly-pfaff/video-export';

/** Host publication is allowed only after this resolves. Verification does not modify the file. */
export async function verifyExistingFile(
  request: VideoVerificationRequest,
  signal: AbortSignal,
): Promise<VideoFileVerification> {
  return await verifyVideoFile(request, signal);
}

/** The host has already decoded RGB24 16x9 samples, in original frame order. */
export function verifyDecodedImages(
  reference: Uint8Array,
  decodedChunks: readonly Buffer[],
): { readonly verifiedFrames: number; readonly maximumImageError: number } {
  const verifier = createImageFingerprintVerifier(reference);
  for (const chunk of decodedChunks) verifier.acceptChunk(chunk);
  return verifier.finish();
}

export async function compareSoundtrack(
  input: {
    readonly sourcePath: string;
    readonly outputPath: string;
    readonly durationSeconds: number;
    readonly tools: MediaTools;
  },
  signal: AbortSignal,
): Promise<readonly VideoAudioAnchor[]> {
  const options = { tools: input.tools, duration: input.durationSeconds };
  const source = await decodeVerificationAudio({ ...options, path: input.sourcePath }, signal);
  const output = await decodeVerificationAudio({ ...options, path: input.outputPath }, signal);
  return verifyAudioSamples(source, output);
}

Supported bounds are 108000 reference frames and 1800 seconds of source audio. The source audio path is local/absolute; durationSeconds is in seconds and format is an optional mp3/wav hint. If encoding used an audio offset, prepare the reference audio for exactly that selected interval; verification starts at reference sample zero.

FFprobe reads bounded stream/container metadata without frame decoding. One streaming FFmpeg video decode, limited to two video threads, supplies original integer-PTS timestamps and every image fingerprint together. Actual count, exact cadence, stream/codec/rate/duration/origin, missing or malformed timing and every image remain checked. No timestamp reset or frame-rate conversion is applied.

Source/output audio are independently decoded to identically filtered mono 8 kHz PCM. Three correlation anchors compare the strongest source window in each third; silent windows are explicit. Non-finite samples are rejected. Correlation must reach 0.9 and lag stay within one video frame. Image comparison uses a 0.04 normalized error threshold and rejects effectively black decoded output.

The low-level createImageFingerprintVerifier accepts ordered RGB chunks when the host already owns decoding. decodeVerificationAudio returns bounded finite PCM; its duration option is seconds, maximum 1800. verifyAudioSamples checks sample-length tolerance, silence and correlation; its sample arrays must use the same 8 kHz/high-pass preparation. Full verifyVideoFile additionally enforces the video-frame audio-lag limit.

Verification is read-only and does not publish or modify source/output files. The host owns final publication and must not publish a rejected result.

Interpret verification results

Every decoded fingerprint is compared with a normalized mean absolute RGB error limit of 0.04. Missing/extra frames, invalid timestamps or entirely dark captured output fail. ImageVerificationError preserves zero-based frameIndex and imageError for host diagnostics. Keep direct-verifier reference bytes unchanged until finish().

Audio correlation uses identically filtered mono 8000 Hz samples and the strongest one-second window in each third. Results report sourceStartSeconds, lagSeconds, correlation and an explicit silent flag. Non-finite samples and mismatched content reject; non-silent correlation must be at least 0.9. Full verifyVideoFile additionally bounds audio lag to one video frame. The standalone comparison returns anchors so its caller can enforce its own timing contract.

PUBLIC CONTRACT

Complete API reference

The entries below are generated from the package's built public TypeScript declarations, including inherited fields and resolved preference types. Functions, classes, exported schemas and types use the same root import:

import { encodeVideo, verifyVideoFile } from '@karoly-pfaff/video-export';

All API entries are shown.

AudioSource
export interface AudioSource {
    readonly path: string;
    readonly offsetSeconds?: number | undefined;
}
createEncoderPreflightCache
export declare function createEncoderPreflightCache(options: EncoderPreflightCacheOptions): EncoderPreflightCache;
createEncodingPreferences
export declare function createEncodingPreferences(preferences?: Partial<EncodingPreferences>): EncodingPreferences;
createImageFingerprintVerifier
export declare function createImageFingerprintVerifier(expected: Uint8Array): {
    readonly acceptChunk: (chunk: Buffer) => void;
    readonly finish: () => {
        verifiedFrames: number;
        maximumImageError: number;
    };
};
decodeVerificationAudio
export declare function decodeVerificationAudio(input: {
    readonly path: string;
    readonly format?: 'mp3' | 'wav';
    readonly duration: number;
    readonly tools: MediaTools;
}, signal: AbortSignal): Promise<Float32Array>;
EncoderAvailability
export interface EncoderAvailability {
    readonly available: boolean;
    readonly reason: "qualified" | "not-listed" | "probe-failed";
}
EncoderCandidate
export type EncoderCandidate = {
    readonly quantizer: number;
    readonly threads: number;
    readonly asyncDepth: 4;
    readonly audioBitrateKbps: 192 | 320;
    readonly id: "legacy-libx264-v1";
    readonly encoder: "libx264";
    readonly preset: "fast";
    readonly legacy: true;
} | {
    readonly quantizer: number;
    readonly threads: number;
    readonly asyncDepth: 4;
    readonly audioBitrateKbps: 192 | 320;
    readonly id: "software-h264-v1";
    readonly encoder: "libx264";
    readonly preset: "medium" | "slow";
    readonly legacy: false;
} | {
    readonly quantizer: number;
    readonly threads: number;
    readonly asyncDepth: 4;
    readonly audioBitrateKbps: 192 | 320;
    readonly id: "intel-qsv-h264-v1";
    readonly encoder: "h264_qsv";
    readonly preset: "medium" | "slow";
    readonly legacy: false;
};
EncoderCapabilities
export interface EncoderCapabilities {
    readonly ffmpeg: ToolIdentity;
    readonly ffprobe: ToolIdentity;
    readonly software: EncoderAvailability;
    readonly intelQsv: EncoderAvailability;
}
EncoderPreflightCache
export interface EncoderPreflightCache {
    readonly clear: {};
}
EncoderPreflightCacheOptions
export interface EncoderPreflightCacheOptions {
    readonly environmentIdentity: string;
    readonly hardwareIdentity?: string | undefined;
    readonly ttlMs?: number | undefined;
    readonly maximumEntries?: number | undefined;
}
EncoderProbeRequest
export type EncoderProbeRequest = {
    readonly tools: MediaTools;
    readonly width: number;
    readonly height: number;
    readonly frameRate: FrameRate;
    readonly encoding?: "legacy-libx264-v1" | Readonly<{
        version: "h264-aac-v1";
        quality: "maximum" | "compact" | "high";
        speed: "balanced" | "thorough";
        mode: "automatic" | "software" | "intel-qsv";
    }> | undefined;
    readonly threads?: number | undefined;
    readonly preflightCache?: EncoderPreflightCache | undefined;
};
encodeVideo
export declare function encodeVideo(input: EncodeVideoRequest, signal: AbortSignal): Promise<VideoExportResult>;
EncodeVideoRequest
export interface EncodeVideoRequest {
    readonly preflightCache?: EncoderPreflightCache | undefined;
    readonly tools: MediaTools;
    readonly width: number;
    readonly height: number;
    readonly frameRate: FrameRate;
    readonly frameCount: number;
    readonly input: FrameInput;
    readonly audio?: AudioSource | undefined;
    readonly outputPath: string;
    readonly encoding?: "legacy-libx264-v1" | Readonly<{
        version: "h264-aac-v1";
        quality: "maximum" | "compact" | "high";
        speed: "balanced" | "thorough";
        mode: "automatic" | "software" | "intel-qsv";
    }> | undefined;
    readonly threads?: number | undefined;
    readonly background?: readonly [
        number,
        number,
        number
    ] | undefined;
    readonly onProgress?: ProgressCallback | undefined;
}
EncodingPreferences
export type EncodingPreferences = {
    readonly version: "h264-aac-v1";
    readonly quality: "maximum" | "compact" | "high";
    readonly speed: "balanced" | "thorough";
    readonly mode: "automatic" | "software" | "intel-qsv";
};
encodingPreferencesSchema

Validates EncodingPreferences. parse(value) returns validated preferences or throws; safeParse(value) returns a success/data or error result.

formatFrameRate
export declare function formatFrameRate(rate: FrameRate): string;
frameDurationSeconds
export declare function frameDurationSeconds(shape: {
    readonly frameCount: number;
    readonly frameRate: FrameRate;
}): number;
FrameInput
export type FrameInput = {
    readonly kind: "png-stream";
    readonly frames: AsyncIterable<VideoFrame>;
} | {
    readonly kind: "rgba-stream";
    readonly frames: AsyncIterable<VideoFrame>;
    readonly alphaMode?: "straight" | "opaque" | undefined;
} | {
    readonly kind: "png-sequence";
    readonly files: readonly string[];
};
FrameRate
export interface FrameRate {
    readonly numerator: number;
    readonly denominator: number;
}
ImageVerificationError
export declare class ImageVerificationError extends VideoExportError {
    readonly frameIndex: number;
    readonly imageError: number;
    constructor(frameIndex: number, imageError: number);
}
inspectEncoders
export declare function inspectEncoders(input: MediaTools, signal: AbortSignal, cache?: EncoderPreflightCache): Promise<EncoderCapabilities>;
MediaTools
export interface MediaTools {
    readonly ffmpeg: string;
    readonly ffprobe: string;
}
ProgressCallback
export type ProgressCallback = (progress: VideoProgress) => void;
qualifyVideoEncoder
export declare function qualifyVideoEncoder(input: EncoderProbeRequest, signal: AbortSignal): Promise<SelectedEncoder>;
reduceFrameRate
export declare function reduceFrameRate(rate: FrameRate): FrameRate;
SelectedEncoder
export interface SelectedEncoder {
    readonly candidate: EncoderCandidate;
    readonly preflightSsim: number;
    readonly automaticSoftwareFallback: boolean;
}
ToolIdentity
export interface ToolIdentity {
    readonly version: string;
    readonly configuration: string;
    readonly sha256: string;
}
verifyAudioSamples
export declare function verifyAudioSamples(source: Float32Array, output: Float32Array): readonly VideoAudioAnchor[];
verifyVideoFile
export declare function verifyVideoFile(input: VideoVerificationRequest, signal: AbortSignal): Promise<VideoFileVerification>;
VideoAudioAnchor
export interface VideoAudioAnchor {
    readonly sourceStartSeconds: number;
    readonly lagSeconds: number;
    readonly correlation: number;
    readonly silent: boolean;
}
VideoContentVerification
export interface VideoContentVerification {
    readonly verifiedFrames: number;
    readonly maximumTimestampErrorSeconds: number;
    readonly maximumImageError: number;
    readonly audioSampleRate: 8000;
    readonly audioAnchors: readonly VideoAudioAnchor[];
}
VideoExportError
export declare class VideoExportError extends Error {
    readonly code: VideoExportErrorCode;
    constructor(code: VideoExportErrorCode, options?: ErrorOptions);
}
VideoExportErrorCode
export type VideoExportErrorCode = "invalid-request" | "invalid-frame" | "tool-unavailable" | "encoder-unavailable" | "hardware-encode-failed" | "output-exists" | "insufficient-space" | "verification-failed" | "cancelled" | "export-failed";
VideoExportResult
export interface VideoExportResult {
    readonly outputPath: string;
    readonly byteLength: number;
    readonly width: number;
    readonly height: number;
    readonly frameRate: FrameRate;
    readonly encoder: SelectedEncoder;
    readonly tools: EncoderCapabilities;
    readonly cleanupComplete: boolean;
    readonly videoStartSeconds: number;
    readonly audioStartSeconds: number | null;
    readonly frameCount: number;
    readonly durationSeconds: number;
    readonly audioDurationSeconds: number | null;
    readonly sampleRate: 48000 | null;
    readonly channels: number | null;
}
VideoFileVerification
export interface VideoFileVerification {
    readonly timing: {
        readonly videoStartSeconds: number;
        readonly audioStartSeconds: number | null;
        readonly frameCount: number;
        readonly durationSeconds: number;
        readonly audioDurationSeconds: number | null;
        readonly sampleRate: 48000 | null;
        readonly channels: number | null;
    };
    readonly content: VideoContentVerification;
}
VideoFrame
export interface VideoFrame {
    readonly index: number;
    readonly bytes: Uint8Array<ArrayBufferLike>;
}
VideoProgress
export interface VideoProgress {
    readonly stage: VideoProgressStage;
    readonly acceptedFrames: number;
    readonly encodedFrames: number;
    readonly totalFrames: number;
}
VideoProgressStage
export type VideoProgressStage = "encoding" | "preflight" | "verifying" | "publishing";
VideoVerificationRequest
export interface VideoVerificationRequest {
    readonly tools: MediaTools;
    readonly path: string;
    readonly width: number;
    readonly height: number;
    readonly frameRate: FrameRate;
    readonly frameCount: number;
    readonly fingerprints: Uint8Array<ArrayBufferLike>;
    readonly audio: {
        readonly path: string;
        readonly format?: "mp3" | "wav" | undefined;
        readonly durationSeconds: number;
    };
}

Runtime compatibility and licensing

The package targets Node.js 24.18.1–24.x and Electron's Node process with host-provided native tools. Windows synthetic software encoding/verification is qualified locally. macOS/Linux, hardware encoders and Electron installers require their own host qualification; this guide does not claim those runs occurred.

Own code is MIT. pngjs and Zod retain their own licenses. The host supplies FFmpeg/FFprobe and their build-specific notices. Native executables are not redistributed by this library. No private media, account or mandatory subscription is part of the examples. This guide needs no CDN, analytics, external fonts or runtime network.