/** * Video codec type for encoding */ export type CodecType = 'av1' | 'h264'; /** * Streaming format type */ export type StreamingFormat = 'dash' | 'hls'; /** * Тип аппаратного ускорителя */ export type HardwareAccelerator = 'nvenc' | 'qsv' | 'amf' | 'vaapi' | 'videotoolbox' | 'v4l2' | 'cpu'; /** * Опция выбора ускорителя (конкретный или auto) */ export type HardwareAccelerationOption = HardwareAccelerator | 'auto'; /** * Набор доступных энкодеров для конкретного ускорителя */ export interface HardwareEncoderInfo { accelerator: HardwareAccelerator; h264Encoder?: string; av1Encoder?: string; } /** * Набор доступных декодеров/accel */ export interface HardwareDecoderInfo { accelerator: HardwareAccelerator; } /** * Quality settings for a codec */ export interface CodecQualitySettings { /** CQ (Constant Quality) for GPU encoders (0-51, lower = better quality) */ cq?: number; /** CRF (Constant Rate Factor) for CPU encoders (0-51 for h264, 0-63 for av1, lower = better quality) */ crf?: number; } /** * Quality settings for video encoding */ export interface QualitySettings { /** Quality settings for H.264 codec */ h264?: CodecQualitySettings; /** Quality settings for AV1 codec */ av1?: CodecQualitySettings; } /** * Configuration options for DASH conversion */ export interface DashConvertOptions { /** Input video file path */ input: string; /** Output directory path */ outputDir: string; /** Segment duration in seconds (default: 2) */ segmentDuration?: number; /** Video quality profiles to generate */ profiles?: VideoProfile[]; /** Custom resolution profiles as strings (e.g., ['360p', '480p', '720p@60']) */ customProfiles?: string[]; /** Video codec selection: one or multiple (default: ['h264']) */ codec?: CodecType | CodecType[]; /** Streaming formats: list (default: ['dash','hls']) */ formats?: StreamingFormat[]; /** Предпочитаемый аппаратный ускоритель (auto по умолчанию) */ hardwareAccelerator?: HardwareAccelerationOption; /** Предпочитаемый аппаратный ускоритель для декодера (auto по умолчанию) */ hardwareDecoder?: HardwareAccelerationOption; /** Quality settings for video encoding (CQ/CRF values) */ quality?: QualitySettings; /** Generate thumbnail sprite (default: true) */ generateThumbnails?: boolean; /** Thumbnail sprite configuration */ thumbnailConfig?: ThumbnailConfig; /** Generate poster image (default: true) */ generatePoster?: boolean; /** Poster timecode in format HH:MM:SS or seconds (default: 00:00:01) */ posterTimecode?: string; /** Parallel encoding (default: true) */ parallel?: boolean; /** Callback for progress updates */ onProgress?: (progress: ConversionProgress) => void; } /** * Video quality profile */ export interface VideoProfile { /** Profile name (e.g., "1080p", "720p") */ name: string; /** Video width in pixels */ width: number; /** Video height in pixels */ height: number; /** Video bitrate (e.g., "5000k") */ videoBitrate: string; /** Audio bitrate (e.g., "128k") */ audioBitrate: string; /** Target FPS for this profile (default: 30) */ fps?: number; } /** * Thumbnail sprite configuration */ export interface ThumbnailConfig { /** Width of each thumbnail (default: 160) */ width?: number; /** Height of each thumbnail (default: 90) */ height?: number; /** Interval between thumbnails in seconds (default: 1) */ interval?: number; /** Number of thumbnails per row (default: 10) */ columns?: number; } /** * Conversion progress information */ export interface ConversionProgress { /** Current stage of conversion */ stage: 'analyzing' | 'encoding' | 'thumbnails' | 'manifest' | 'complete'; /** Progress percentage (0-100) - overall progress */ percent: number; /** Current profile being processed */ currentProfile?: string; /** Progress percentage for current profile (0-100) */ profilePercent?: number; /** Additional message */ message?: string; } /** * Result of DASH conversion */ export interface DashConvertResult { /** Path to generated DASH manifest (если форматы включают DASH) */ manifestPath?: string; /** Path to generated HLS manifest (если форматы включают HLS) */ hlsManifestPath?: string; /** Paths to generated video segments */ videoPaths: string[]; /** Path to thumbnail sprite (if generated) */ thumbnailSpritePath?: string; /** Path to thumbnail VTT file (if generated) */ thumbnailVttPath?: string; /** Path to poster image (if generated) */ posterPath?: string; /** Video duration in seconds */ duration: number; /** Generated profiles */ profiles: VideoProfile[]; /** Whether NVENC was used */ usedNvenc: boolean; /** Выбранный аппаратный ускоритель */ selectedAccelerator: HardwareAccelerator; /** Выбранный аппаратный декодер */ selectedDecoder: HardwareAccelerator; /** Список использованных кодеков */ codecs: CodecType[]; /** Список сгенерированных форматов */ formats: StreamingFormat[]; } /** * Video metadata */ export interface VideoMetadata { width: number; height: number; duration: number; fps: number; codec: string; hasAudio: boolean; // Есть ли аудиодорожка audioBitrate?: number; // Битрейт аудио в kbps videoBitrate?: number; // Битрейт видео в kbps } /** * Video optimizations (for future use) */ export interface VideoOptimizations { /** Apply deinterlacing */ deinterlace?: boolean; /** Apply denoising filter */ denoise?: boolean; /** Color correction / LUT file path */ colorCorrection?: string; /** Audio normalization */ audioNormalize?: boolean; /** Custom FFmpeg filters */ customFilters?: string[]; }