UNPKG

@eleven-am/transcoder

Version:

High-performance HLS transcoding library with hardware acceleration, intelligent client management, and distributed processing support for Node.js

124 lines 4.21 kB
import { TaskEither } from '@eleven-am/fp'; import { DatabaseConnector } from './databaseConnector'; import { MediaSource } from './mediaSource'; import { QualityService } from './qualityService'; import { AudioQualityEnum, HardwareAccelerationConfig, MediaMetadata, VideoQualityEnum } from './types'; interface MasterPlaylist { master: string; video: { index: number; quality: VideoQualityEnum; }; audio: { index: number; quality: AudioQualityEnum; }; } export declare class MetadataService { private readonly qualityService; private readonly databaseConnector; constructor(qualityService: QualityService, databaseConnector: DatabaseConnector); /** * Get metadata for a file, extracting it if necessary * @param source The media source to get metadata from */ getMetadata(source: MediaSource): TaskEither<MediaMetadata>; /** * Detect the best codec for the given source video * This is especially important for CUDA which has specific decoders per codec * @param source The media source to detect the codec from * @param hwConfig Hardware acceleration configuration * @returns A TaskEither with the updated hardware acceleration configuration */ detectOptimalCodecConfig(source: MediaSource, hwConfig: HardwareAccelerationConfig | null): TaskEither<HardwareAccelerationConfig | null>; /** * Get the master playlist for the media file * @returns The master playlist as a string */ getMasterPlaylist(source: MediaSource): TaskEither<MasterPlaylist>; /** * Create metadata for a file * @param source Media source to create metadata for * @returns TaskEither containing the created metadata */ createMetadata(source: MediaSource): TaskEither<void>; /** * Extract metadata * @param fileId Unique identifier for the media file * @param source Media source to extract metadata from */ private extractMetadataWithLock; /** * Wait for another node to finish extracting metadata * @param fileId The file ID to wait for */ private waitForMetadata; /** * Extract keyframes from a file using ffprobe * @param source Media source to extract keyframes from * @param videoIndex Index of the video stream * @returns TaskEither containing keyframe data */ private extractKeyframes; /** * Extract media information from a file using ffprobe * @returns TaskEither containing media metadata * @param fileId Unique identifier for the media file * @param source Media source to extract metadata from */ private extractMediaInfo; /** * Run ffprobe with the given arguments * @param args Arguments to pass to ffprobe * @private */ private probe; /** * Process a video stream from FFprobe output */ private processVideoStream; /** * Process an audio stream from FFprobe output */ private processAudioStream; /** * Process a subtitle stream from FFprobe output */ private processSubtitleStream; /** * Generate MIME codec string */ private generateMimeCodec; /** * Get MIME codec string for a codec */ private getMimeCodec; /** * Get subtitle extension for a codec */ private getSubtitleExtension; /** * Check if the video codec is HLS-compatible for direct playback */ private isVideoHLSCompatible; /** * Check if the audio codec is HLS-compatible for direct playback */ private isAudioHLSCompatible; /** * Generate audio rendition entries for HLS master playlist * @param audio The audio stream information * @returns Object containing rendition entries and compatibility info * @private */ private generateAudioRenditionEntries; /** * Generate video rendition entries for HLS master playlist * @param video The video stream information * @returns Object containing media types and mapped profile * @private */ private generateVideoRenditionEntries; } export {}; //# sourceMappingURL=metadataService.d.ts.map