ffmpeg-lib
v1.2.1
Published
A comprehensive, fluent, and type-safe Node.js library for programmatic interaction with FFmpeg and FFprobe
Downloads
63
Maintainers
Readme
FFmpeg Lib
A comprehensive, fluent, and type-safe Node.js wrapper for FFmpeg and FFprobe geared heavily towards reliable operations, HLS streaming, multi-bitrate segmented encoding, and resilient lifecycle/error recovery.
Documentation Index
Please see the docs/ directory for detailed reading on various internal systems:
- 1. Getting Started - Installation and basic rapid initialization scenarios.
- 2. System FFmpeg Manager - Automatically managing, fetching, and locally authenticating
ffmpeg/ffprobebinaries without cluttering local paths. - 3. FFmpeg Fluent Command - Fluent abstraction for chaining intricate commands predictably.
- 4. Advanced HLS Orchestration - Demuxing, processing streaming topologies natively via the
VideoProcessingOrchestratorpipelines.
Installation
bun add ffmpeg-libQuick Examples
Basic Video Conversion
import { FFmpegCommand } from 'ffmpeg-lib';
const command = new FFmpegCommand();
await command
.input('input.mp4')
.output('output.mkv')
.videoCodec('libx264')
.videoBitrate('2000k')
.audioCodec('aac')
.run();Extracting Audio
import { FFmpegCommand } from 'ffmpeg-lib';
const command = new FFmpegCommand();
await command
.input('video.mp4')
.output('audio.mp3')
.noVideo()
.audioCodec('mp3')
.run();Generating Screenshots
import { FFmpegCommand } from 'ffmpeg-lib';
const command = new FFmpegCommand();
command.input('video.mp4');
const thumbnails = await command.screenshots({
timestamps: ['00:00:05', '00:00:10'],
folder: './thumbnails',
filename: 'thumb_%i.jpg',
size: '1280x720'
});For more details on operations, see Getting Started.
