New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ffmpeg-lib

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ffmpeg-lib

A comprehensive, fluent, and type-safe Node.js library for programmatic interaction with FFmpeg and FFprobe

latest
Source
npmnpm
Version
1.1.5
Version published
Maintainers
1
Created
Source

FFmpegLib

A comprehensive, fluent, and type-safe Node.js library for programmatic interaction with FFmpeg and FFprobe.

NPM version Build Status License: MIT

FFmpegLib provides a powerful and intuitive interface to handle complex multimedia operations in Node.js. It abstracts the complexity of the FFmpeg command-line interface while offering full access to its capabilities, from simple conversions to advanced HLS packaging and media analysis.

Core Features

  • Fluent Command Builder (FFmpegCommand): A chainable, type-safe API for building complex FFmpeg commands.
  • Advanced Process Management (FFmpegManager): High-level control with job queuing, progress monitoring, and resource management.
  • HLS Packaging Suite: A complete toolset for HLS video processing, including segmentation, playlist generation, and variant stream creation.
  • Metadata Extraction (MediaMetadataExtractor): Easily extract detailed metadata from media files using FFprobe.
  • Test Media Generation (TestMediaGenerator): Create synthetic video, audio, and image files for testing purposes.
  • Full TypeScript Support: Modern, type-safe development experience with comprehensive type definitions.

Installation

npm install ffmpeg-lib
# or
yarn add ffmpeg-lib
# or
bun add ffmpeg-lib

Quick Start

Here's how easy it is to perform a video conversion while monitoring its progress:

import { FFmpegManager } from 'ffmpeg-lib';

// Initialize the manager with the path to your FFmpeg executable
const manager = new FFmpegManager('/usr/bin/ffmpeg');

// Listen for progress events
manager.on('progress', (event) => {
    console.log(`Progress: ${event.progress}% | Speed: ${event.speed}`);
});

// Listen for completion
manager.on('completed', (event) => {
    console.log(`Conversion finished in ${event.duration}ms!`);
});

// Execute a conversion command
async function convertVideo() {
    try {
        console.log('Starting conversion...');
        const result = await manager.convert('input.mov', 'output.mp4', {
            videoCodec: 'libx264',
            videoBitrate: '2000k',
            resolution: '1280x720',
            audioCodec: 'aac',
            audioBitrate: '128k'
        });
        console.log('Success!', result);
    } catch (error) {
        console.error('An error occurred:', error.message);
    }
}

convertVideo();

Core Components

FFmpegLib is organized into several powerful components. Choose the one that best fits your needs.

  • FFmpegCommand: For fine-grained, manual control over building and executing FFmpeg commands.
  • FFmpegManager: For high-level process management, job queuing, and event-driven monitoring.
  • MediaMetadataExtractor: To read and analyze media file properties with FFprobe.
  • TestMediaGenerator: A utility to create placeholder media for your test suites.
  • HLS Tools: A suite of classes for creating adaptive bitrate streaming content (HLS).

Full Documentation

For a deep dive into the API and advanced examples, please check our full documentation.

License

This project is licensed under the MIT License.

Keywords

ffmpeg

FAQs

Package last updated on 06 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts