2025-11-11 21:07:51 +03:00
|
|
|
/**
|
|
|
|
|
* Video codec type for encoding
|
|
|
|
|
*/
|
|
|
|
|
export type CodecType = 'av1' | 'h264' | 'dual';
|
|
|
|
|
|
2025-11-11 22:56:44 +03:00
|
|
|
/**
|
|
|
|
|
* Streaming format type
|
|
|
|
|
*/
|
|
|
|
|
export type StreamingFormat = 'dash' | 'hls' | 'both';
|
|
|
|
|
|
2025-11-08 19:41:20 +03:00
|
|
|
/**
|
|
|
|
|
* 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[];
|
|
|
|
|
|
2025-11-09 10:40:35 +03:00
|
|
|
/** Custom resolution profiles as strings (e.g., ['360p', '480p', '720p@60']) */
|
|
|
|
|
customProfiles?: string[];
|
|
|
|
|
|
2025-11-11 21:07:51 +03:00
|
|
|
/** Video codec to use: 'av1', 'h264', or 'dual' for both (default: 'dual') */
|
|
|
|
|
codec?: CodecType;
|
|
|
|
|
|
2025-11-11 22:56:44 +03:00
|
|
|
/** Streaming format to generate: 'dash', 'hls', or 'both' (default: 'both') */
|
|
|
|
|
format?: StreamingFormat;
|
|
|
|
|
|
2025-11-08 19:41:20 +03:00
|
|
|
/** Enable NVENC hardware acceleration (auto-detect if undefined) */
|
|
|
|
|
useNvenc?: boolean;
|
|
|
|
|
|
|
|
|
|
/** Generate thumbnail sprite (default: true) */
|
|
|
|
|
generateThumbnails?: boolean;
|
|
|
|
|
|
|
|
|
|
/** Thumbnail sprite configuration */
|
|
|
|
|
thumbnailConfig?: ThumbnailConfig;
|
|
|
|
|
|
2025-11-09 10:40:35 +03:00
|
|
|
/** Generate poster image (default: true) */
|
|
|
|
|
generatePoster?: boolean;
|
|
|
|
|
|
|
|
|
|
/** Poster timecode in format HH:MM:SS or seconds (default: 00:00:01) */
|
|
|
|
|
posterTimecode?: string;
|
|
|
|
|
|
2025-11-08 19:41:20 +03:00
|
|
|
/** 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;
|
2025-11-11 21:25:37 +03:00
|
|
|
|
|
|
|
|
/** Target FPS for this profile (default: 30) */
|
|
|
|
|
fps?: number;
|
2025-11-08 19:41:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 {
|
2025-11-11 22:56:44 +03:00
|
|
|
/** Path to generated DASH manifest (if format is 'dash' or 'both') */
|
|
|
|
|
manifestPath?: string;
|
|
|
|
|
|
|
|
|
|
/** Path to generated HLS manifest (if format is 'hls' or 'both') */
|
|
|
|
|
hlsManifestPath?: string;
|
2025-11-08 19:41:20 +03:00
|
|
|
|
|
|
|
|
/** Paths to generated video segments */
|
|
|
|
|
videoPaths: string[];
|
|
|
|
|
|
|
|
|
|
/** Path to thumbnail sprite (if generated) */
|
|
|
|
|
thumbnailSpritePath?: string;
|
|
|
|
|
|
|
|
|
|
/** Path to thumbnail VTT file (if generated) */
|
|
|
|
|
thumbnailVttPath?: string;
|
|
|
|
|
|
2025-11-09 10:40:35 +03:00
|
|
|
/** Path to poster image (if generated) */
|
|
|
|
|
posterPath?: string;
|
|
|
|
|
|
2025-11-08 19:41:20 +03:00
|
|
|
/** Video duration in seconds */
|
|
|
|
|
duration: number;
|
|
|
|
|
|
|
|
|
|
/** Generated profiles */
|
|
|
|
|
profiles: VideoProfile[];
|
|
|
|
|
|
|
|
|
|
/** Whether NVENC was used */
|
|
|
|
|
usedNvenc: boolean;
|
2025-11-11 21:07:51 +03:00
|
|
|
|
|
|
|
|
/** Codec type used for encoding */
|
|
|
|
|
codecType: CodecType;
|
2025-11-11 22:56:44 +03:00
|
|
|
|
|
|
|
|
/** Streaming format generated */
|
|
|
|
|
format: StreamingFormat;
|
2025-11-08 19:41:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Video metadata
|
|
|
|
|
*/
|
|
|
|
|
export interface VideoMetadata {
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
duration: number;
|
|
|
|
|
fps: number;
|
|
|
|
|
codec: string;
|
|
|
|
|
audioBitrate?: number; // Битрейт аудио в kbps
|
2025-11-09 03:28:43 +03:00
|
|
|
videoBitrate?: number; // Битрейт видео в kbps
|
2025-11-08 19:41:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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[];
|
|
|
|
|
}
|
|
|
|
|
|