import { type LibX264Preset } from "./gpu-encoder.js";
export interface StreamingEncodeOptions {
    /** Total frame count of the output video. */
    totalFrames: number;
    /** Output frames per second. Drives the ffmpeg `-r` input flag. */
    fps: number;
    /** Output file path (mp4). */
    outputPath: string;
    /** Output dimensions; ffmpeg infers from JPEG headers but we pass
     *  these for the `-s` flag as a sanity guard against malformed input. */
    width: number;
    height: number;
    /** ffmpeg preset (libx264 vocabulary, gets translated). */
    preset?: LibX264Preset;
    /** Output bitrate in kbps. */
    videoBitrateKbps: number;
    /** Optional audio track to mux in (mp3 / aac path). When undefined,
     *  output is video-only — caller is responsible for a separate audio
     *  pass downstream. */
    audioPath?: string;
    /** Audio bitrate kbps if audioPath is set. */
    audioBitrateKbps?: number;
    /** AbortSignal to kill the ffmpeg process mid-stream. */
    signal?: AbortSignal;
    /**
     * Wire format of the per-frame buffers produced by `producer`. ffmpeg
     * decodes with the matching `-vcodec`. Default "mjpeg" (zero-cost
     * decode, what Chrome screenshot + Remotion's `imageFormat: "jpeg"`
     * already emit). Switch to "png" if the producer can only emit PNG
     * (e.g. lossless archival path); ffmpeg will pay an extra zlib decode
     * per frame but the streaming arch is otherwise identical.
     */
    inputCodec?: "mjpeg" | "png";
}
export interface StreamingEncodeProducer {
    /**
     * Produce one frame as a JPEG buffer for `frameIndex`. Producer is
     * free to render in parallel — ordering is enforced by the encoder
     * via FrameReorderBuffer.
     *
     * Throwing rejects the entire encode and aborts ffmpeg.
     */
    produceFrame(frameIndex: number): Promise<Buffer>;
    /** Hint to producer that no more frames will be requested. Used to
     *  release resources (close Chrome tabs, free worker pools, etc). */
    finalize?(): Promise<void>;
}
/**
 * Encode `producer`'s frames to `outputPath` via ffmpeg image2pipe.
 *
 * Returns a Promise that resolves with the output path on success.
 *
 * Architecture:
 *   1. Spawn ffmpeg with `-f image2pipe -vcodec mjpeg -i -` reader.
 *   2. Walk frames 0..totalFrames-1 in order, calling producer.produceFrame.
 *   3. Each frame's JPEG buffer goes to ffmpeg.stdin; ffmpeg encodes.
 *
 * For *parallel* production (the actual perf win) the producer should
 * fan out internally — e.g. a Puppeteer worker pool — and use the
 * FrameReorderBuffer to coordinate. See producer-puppeteer-pool.ts
 * (TODO) for the canonical implementation.
 */
export declare function streamingEncode(producer: StreamingEncodeProducer, opts: StreamingEncodeOptions): Promise<string>;
//# sourceMappingURL=streaming-encoder.d.ts.map