UNPKG

lw-ffmpeg-node

Version:

`lw-ffmpeg-node` is a lightweight Node.js library for manipulating video files using FFmpeg. It provides various methods to retrieve information about video files, compress videos, create video slices, crop videos, change video size and frame rate, and sa

34 lines (33 loc) 1.63 kB
export interface ProcessOptions { cwd?: string; quiet?: boolean; detached?: boolean; } export default class FFMPEGManipulator { static getInfo(filePath: string): Promise<{ codec_name: string; width: number; height: number; bit_rate: number; r_frame_rate: number; filename: string; duration: number; nb_streams: number; size: number; }>; static getVideoDuration(filePath: string): Promise<number>; static getVideoFramerate(filePath: string): Promise<number>; private static convertFractionStringToNumber; /** * * @param inputPath the path to the input file * @param outputPath the path to the output file * @description compresses a video file, copies audio track without encoding, encodes video using libx264 */ static compress(inputPath: string, outputPath: string, options?: ProcessOptions): Promise<void>; static createVideoSlice(input_path: string, output_path: string, inpoint: number, outpoint: number, options?: ProcessOptions): Promise<string>; static cropVideo(inputPath: string, outputPath: string, x: number, y: number, width: number, height: number, options?: ProcessOptions): Promise<void>; static changeSize(inputPath: string, outputPath: string, width: number, height: number, options?: ProcessOptions): Promise<void>; static changeFramerate(inputPath: string, outputPath: string, frameRate: number, options?: ProcessOptions): Promise<void>; static saveThumbnail(inputPath: string, outputPath: string, time: number, options?: ProcessOptions): Promise<void>; }