/** * FFmpeg Video Processing Plugin * Transcode videos, generate thumbnails, create HLS streams, and extract metadata * * @module @plyaz/storage/plugins/video-processing * * @example * ```typescript * import { FFmpegVideoPlugin } from '@plyaz/storage/plugins'; * * const videoPlugin = new FFmpegVideoPlugin({ * ffmpegPath: '/usr/bin/ffmpeg', * ffprobePath: '/usr/bin/ffprobe', * resolutions: [ * { name: '480p', width: 854, height: 480, bitrate: '1000k' }, * { name: '720p', width: 1280, height: 720, bitrate: '2500k' }, * { name: '1080p', width: 1920, height: 1080, bitrate: '5000k' }, * ], * thumbnails: { * count: 5, * timestamps: [0.1, 0.25, 0.5, 0.75, 0.9], * }, * useQueue: true, * }); * ``` */ import { BasePlugin } from '../../base/BasePlugin'; import type { StoragePluginUploadResult, StoragePluginContext, StoragePluginHealth, FFmpegVideoPluginConfig, StorageVideoProcessingPluginStatistics } from '@plyaz/types/storage'; /** * FFmpeg Video Processing Plugin * Production-ready video processing using FFmpeg * * Features: * - Video transcoding to multiple resolutions * - Thumbnail generation at intervals * - HLS adaptive streaming * - Metadata extraction (duration, resolution, codec) * - Background queue processing */ export declare class FFmpegVideoPlugin extends BasePlugin { private readonly ffmpegPath; private readonly ffprobePath; private readonly resolutions; private readonly thumbnails?; private readonly hls?; private readonly useQueue; private readonly supportedMimeTypes; private readonly uploadVariants; private readonly tempDir; private videosProcessed; private variantsGenerated; constructor(config?: FFmpegVideoPluginConfig); /** * Initialize the plugin - set FFmpeg paths */ initialize(): Promise; /** * Process video after upload */ afterUpload(result: StoragePluginUploadResult, context: StoragePluginContext): Promise; /** * Process video - transcode and generate thumbnails */ private processVideo; /** * Extract video metadata using ffprobe */ private extractMetadata; /** * Generate video thumbnails */ private generateThumbnails; /** * Calculate evenly distributed timestamps for thumbnails */ private calculateTimestamps; /** * Generate HLS (HTTP Live Streaming) segments and playlists */ private generateHLS; /** * Transcode video to different resolution */ private transcodeVideo; /** * Check if file is a video */ private isVideoFile; /** * Health check */ healthCheck(): Promise; /** * Get processing statistics */ getStatistics(): StorageVideoProcessingPluginStatistics; /** * Helper: Clean up input temp file */ private cleanupInputPath; /** * Helper: Clean up output temp files */ private cleanupOutputPaths; }