Files
dvc-cli/src/types/index.ts

189 lines
4.2 KiB
TypeScript

/**
* Video codec type for encoding
*/
export type CodecType = 'av1' | 'h264' | 'dual';
/**
* Streaming format type
*/
export type StreamingFormat = 'dash' | 'hls' | 'both';
/**
* 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 to use: 'av1', 'h264', or 'dual' for both (default: 'dual') */
codec?: CodecType;
/** Streaming format to generate: 'dash', 'hls', or 'both' (default: 'both') */
format?: StreamingFormat;
/** Enable NVENC hardware acceleration (auto-detect if undefined) */
useNvenc?: boolean;
/** 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 (if format is 'dash' or 'both') */
manifestPath?: string;
/** Path to generated HLS manifest (if format is 'hls' or 'both') */
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;
/** Codec type used for encoding */
codecType: CodecType;
/** Streaming format generated */
format: StreamingFormat;
}
/**
* Video metadata
*/
export interface VideoMetadata {
width: number;
height: number;
duration: number;
fps: number;
codec: string;
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[];
}