import { EventEmitter } from 'node:events'; declare const definitions: { readonly empty_input_filepath: readonly [100, "The input file path cannot be empty"]; readonly input_filepath_must_be_string: readonly [101, "The input file path must be a string"]; readonly invalid_option_name: readonly [102, "The option \"%s\" is invalid. Check the available options"]; readonly fileinput_not_exist: readonly [103, "The input file does not exist: %s"]; readonly format_not_supported: readonly [104, "The format \"%s\" is not supported by this FFmpeg build"]; readonly audio_channel_is_invalid: readonly [105, "The audio channel \"%s\" is not valid"]; readonly mkdir: readonly [106, "Could not create directory: %s"]; readonly extract_frame_invalid_everyN_options: readonly [107, "Specify only one of every_n_frames, every_n_seconds, or every_n_percentage"]; readonly invalid_watermark: readonly [108, "The watermark \"%s\" does not exist"]; readonly invalid_watermark_position: readonly [109, "Invalid watermark position \"%s\""]; readonly size_format: readonly [110, "The size \"%s\" is not supported"]; readonly resolution_square_not_defined: readonly [111, "The square-pixel resolution is not defined"]; readonly command_already_exists: readonly [112, "The command \"%s\" already exists"]; readonly codec_not_supported: readonly [113, "The codec \"%s\" is not supported by this FFmpeg build"]; readonly executable_not_found: readonly [114, "Could not start executable \"%s\""]; readonly process_failed: readonly [115, "FFmpeg exited with code %s"]; readonly process_timeout: readonly [116, "FFmpeg timed out after %s ms"]; readonly process_aborted: readonly [117, "FFmpeg was aborted"]; readonly invalid_probe_output: readonly [118, "ffprobe returned invalid JSON"]; readonly process_output_limit: readonly [119, "Process stdout exceeded maxBuffer (%s bytes)"]; readonly invalid_numeric_option: readonly [120, "The option \"%s\" must be %s"]; readonly invalid_time: readonly [121, "The %s value \"%s\" is invalid"]; readonly invalid_aspect_ratio: readonly [122, "The aspect ratio \"%s\" is invalid"]; readonly invalid_option_value: readonly [123, "The value supplied for option \"%s\" is invalid"]; readonly unsafe_output_path: readonly [124, "The output path \"%s\" is unsafe because it begins with \"-\""]; readonly invalid_color: readonly [125, "The FFmpeg color \"%s\" is invalid"]; }; type ErrorName = keyof typeof definitions; declare class FfmpegError extends Error { readonly code: number; readonly msg: string; readonly cause?: unknown; readonly stderr?: string; constructor(code: number, message: string, options?: { cause?: unknown; stderr?: string; }); } declare const errors: Record; declare const sizes: { readonly SQCIF: "128x96"; readonly QCIF: "176x144"; readonly CIF: "352x288"; readonly '4CIF': "704x576"; readonly QQVGA: "160x120"; readonly QVGA: "320x240"; readonly VGA: "640x480"; readonly SVGA: "800x600"; readonly XGA: "1024x768"; readonly UXGA: "1600x1200"; readonly QXGA: "2048x1536"; readonly SXGA: "1280x1024"; readonly QSXGA: "2560x2048"; readonly HSXGA: "5120x4096"; readonly WVGA: "852x480"; readonly WXGA: "1366x768"; readonly WSXGA: "1600x1024"; readonly WUXGA: "1920x1200"; readonly WOXGA: "2560x1600"; readonly WQSXGA: "3200x2048"; readonly WQUXGA: "3840x2400"; readonly WHSXGA: "6400x4096"; readonly WHUXGA: "7680x4800"; readonly CGA: "320x200"; readonly EGA: "640x350"; readonly HD480: "852x480"; readonly HD720: "1280x720"; readonly HD1080: "1920x1080"; }; declare const ratios: { readonly '4:3': number; readonly '3:2': number; readonly '14:9': number; readonly '16:9': number; readonly '21:9': number; }; declare const audioChannels: { readonly mono: 1; readonly stereo: 2; }; declare const presets: { readonly size: { readonly SQCIF: "128x96"; readonly QCIF: "176x144"; readonly CIF: "352x288"; readonly '4CIF': "704x576"; readonly QQVGA: "160x120"; readonly QVGA: "320x240"; readonly VGA: "640x480"; readonly SVGA: "800x600"; readonly XGA: "1024x768"; readonly UXGA: "1600x1200"; readonly QXGA: "2048x1536"; readonly SXGA: "1280x1024"; readonly QSXGA: "2560x2048"; readonly HSXGA: "5120x4096"; readonly WVGA: "852x480"; readonly WXGA: "1366x768"; readonly WSXGA: "1600x1024"; readonly WUXGA: "1920x1200"; readonly WOXGA: "2560x1600"; readonly WQSXGA: "3200x2048"; readonly WQUXGA: "3840x2400"; readonly WHSXGA: "6400x4096"; readonly WHUXGA: "7680x4800"; readonly CGA: "320x200"; readonly EGA: "640x350"; readonly HD480: "852x480"; readonly HD720: "1280x720"; readonly HD1080: "1920x1080"; }; readonly ratio: { readonly '4:3': number; readonly '3:2': number; readonly '14:9': number; readonly '16:9': number; readonly '21:9': number; }; readonly audio_channel: { readonly mono: 1; readonly stereo: 2; }; }; interface FfmpegSettings { /** Text encoding used for process output. Kept for compatibility. */ encoding?: BufferEncoding; /** Maximum runtime in milliseconds. Zero disables the timeout. */ timeout?: number; /** Maximum retained stdout/stderr bytes. Output is tailed, not used to kill FFmpeg. */ maxBuffer?: number; /** FFmpeg executable. Defaults to `ffmpeg`. */ ffmpegPath?: string; /** ffprobe executable. Inferred from ffmpegPath when possible. */ ffprobePath?: string; /** Overwrite output files with `-y`. Defaults to false (`-n`). */ overwrite?: boolean; /** Abort an active probe or conversion. */ signal?: AbortSignal; cwd?: string; env?: NodeJS.ProcessEnv; } interface ResolvedSettings { encoding: BufferEncoding; timeout: number; maxBuffer: number; ffmpegPath: string; ffprobePath: string; overwrite: boolean; signal?: AbortSignal; cwd?: string; env?: NodeJS.ProcessEnv; } /** Settings that may vary for each media opened through an FfmpegClient. */ type FfmpegOperationSettings = Pick; interface FfmpegConfiguration { modules: string[]; /** Legacy union of writable formats and available encoders. */ encode: string[]; decode: string[]; formats: { encode: string[]; decode: string[]; }; codecs: { encode: string[]; }; } interface Ratio { x: number; y: number; string: string; value: number; } interface Resolution { w: number; h: number; } interface MediaMetadata { filename: string; title: string; artist: string; album: string; track: string; date: string; synched: boolean; duration: { raw: string; seconds: number; }; video: { container: string; bitrate: number; stream: number; codec: string; resolution: Resolution; resolutionSquare: Partial; aspect: Partial; rotate: number; fps: number; pixelString: string; pixel: number; }; audio: { codec: string; bitrate: number; sample_rate: number; stream: number; channels: { raw: string; value: number; }; }; /** Original ffprobe response for advanced consumers. */ raw: FfprobeResult; } interface FfprobeStream { index?: number; codec_name?: string; codec_type?: string; width?: number; height?: number; bit_rate?: string; sample_rate?: string; channels?: number; channel_layout?: string; avg_frame_rate?: string; r_frame_rate?: string; sample_aspect_ratio?: string; display_aspect_ratio?: string; start_time?: string; tags?: Record; side_data_list?: Array<{ rotation?: number; }>; [key: string]: unknown; } interface FfprobeResult { streams?: FfprobeStream[]; format?: { filename?: string; format_name?: string; duration?: string; start_time?: string; bit_rate?: string; tags?: Record; [key: string]: unknown; }; chapters?: unknown[]; [key: string]: unknown; } interface WatermarkSettings { position?: 'NE' | 'NC' | 'NW' | 'SE' | 'SC' | 'SW' | 'C' | 'CE' | 'CW'; margin_nord?: number; margin_sud?: number; margin_east?: number; margin_west?: number; } interface ExtractFrameSettings { start_time?: string | number | null; duration_time?: string | number | null; frame_rate?: number | null; size?: string | null; number?: number | null; every_n_frames?: number | null; every_n_seconds?: number | null; every_n_percentage?: number | null; keep_pixel_aspect_ratio?: boolean; keep_aspect_ratio?: boolean; padding_color?: string; file_name?: string | null; quality?: number; } interface Progress { frames?: number; fps?: number; time: number; speed?: number; percent?: number; } /** Identifies one terminal operation emitted through a shared Video event stream. */ type MediaOperationKind = 'save' | 'audio' | 'frames' | 'watermark'; /** Immutable correlation data passed as the second argument of every Video lifecycle event. */ interface MediaOperationContext { readonly operationId: string; readonly kind: MediaOperationKind; readonly destination: string; } type LegacyCallback = (error: Error | null, result: T | null) => void; interface ProcessResult { command: string; args: string[]; code: number; stdout: string; stderr: string; } declare function parseProgress(chunk: string, duration: number): Progress | undefined; interface VideoEvents { start: [command: string, context: MediaOperationContext]; progress: [progress: Progress, context: MediaOperationContext]; stderr: [chunk: string, context: MediaOperationContext]; end: [result: ProcessResult, context: MediaOperationContext]; error: [error: unknown, context: MediaOperationContext]; } declare class Video extends EventEmitter { private readonly settings; readonly file_path: string; readonly info_configuration: FfmpegConfiguration; readonly metadata: MediaMetadata; private commands; private inputs; private filtersComplex; private options; constructor(filePath: string, settings: ResolvedSettings, configuration: FfmpegConfiguration, metadata: MediaMetadata); addCommand(command: string, argument?: string | number): this; /** Alias that better describes arbitrary modern FFmpeg arguments. */ addOutputOption(command: string, argument?: string | number): this; addInput(input: string): this; addFilterComplex(filter: string): this; setDisableAudio(): this; setDisableVideo(): this; setVideoFormat(format: string): this; setVideoCodec(codec: string): this; setVideoBitRate(bitrate: string | number): this; setVideoFrameRate(framerate: number): this; setVideoStartTime(time: string | number): this; setVideoDuration(duration: string | number): this; setVideoAspectRatio(aspect: string | number): this; setVideoSize(size: string, keepPixelAspectRatio?: boolean, keepAspectRatio?: boolean, paddingColor?: string): this; setVideoQuality(quality: string | number): this; setAudioCodec(codec: string): this; setAudioFrequency(frequency: number): this; setAudioChannels(channels: number): this; setAudioBitRate(bitrate: string | number): this; setAudioQuality(quality: string | number): this; setMetadata(key: string, value: string | number): this; setMetadata(values: Record): this; setThreads(threads: number): this; setWatermark(watermarkPath: string, settings?: WatermarkSettings): this; private resolveWatermark; getCommand(destination: string): { command: string; args: string[]; display: string; }; save(destination: string): Promise; save(destination: string, callback: LegacyCallback): void; fnExtractSoundToMP3(destination: string): Promise; fnExtractSoundToMP3(destination: string, callback: LegacyCallback): void; fnExtractFrameToJPG(destinationFolder: string): Promise; fnExtractFrameToJPG(destinationFolder: string, settings: ExtractFrameSettings): Promise; fnExtractFrameToJPG(destinationFolder: string, callback: LegacyCallback): void; fnExtractFrameToJPG(destinationFolder: string, settings: ExtractFrameSettings, callback: LegacyCallback): void; fnAddWatermark(watermarkPath: string): Promise; fnAddWatermark(watermarkPath: string, callback: LegacyCallback): void; fnAddWatermark(watermarkPath: string, settings: WatermarkSettings): Promise; fnAddWatermark(watermarkPath: string, settings: WatermarkSettings, callback: LegacyCallback): void; fnAddWatermark(watermarkPath: string, destination: string): Promise; fnAddWatermark(watermarkPath: string, destination: string, callback: LegacyCallback): void; fnAddWatermark(watermarkPath: string, destination: string, settings: WatermarkSettings): Promise; fnAddWatermark(watermarkPath: string, destination: string, settings: WatermarkSettings, callback: LegacyCallback): void; private buildArgs; private calculateDimension; private extractFrames; private createSavePlan; private progressDuration; private execute; private currentBuilder; private consumeBuilder; private runOperation; private createOperationContext; } interface FfmpegFactory { (input: string, settings?: FfmpegSettings): Promise