npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lumixland/ffmpeg

v0.1.0

Published

A lightweight, dependency-free Node.js FFmpeg wrapper for fast and simple audio/video conversion.

Readme

@lumixland/ffmpeg

A lightweight, dependency-light TypeScript wrapper for running FFmpeg from Node.js.

Highlights

  • Automatically prefers a system ffmpeg if available.
  • Falls back to an optional @lumixland/ffmpeg-binaries package that ships prebuilt platform binaries.
  • Minimal runtime surface: resolves a binary path and runs ffmpeg with arguments.

Installation

This package declares @lumixland/ffmpeg-binaries as a peer dependency. To ensure the binaries are available at runtime, install both packages in your application:

pnpm add @lumixland/ffmpeg @lumixland/ffmpeg-binaries

If you already have ffmpeg installed on the host system, installing @lumixland/ffmpeg-binaries is optional.

Quick usage

import ffmpeg from "@lumixland/ffmpeg";

async function convert() {
  const path = await ffmpeg.resolveFFmpegBinary();
  console.log("Using ffmpeg at", path);
  await ffmpeg.runFFmpeg(["-i", "in.mp4", "out.mp4"]);
}

API API

The package exposes a small, focused runtime surface: a set of convenience converters and a couple of low-level helpers for locating and running an ffmpeg binary.

Top-level exports (from package root)

  • resolveFFmpegBinary(): Promise<string> — Resolve a usable ffmpeg binary. Returns the system ffmpeg command if available, otherwise attempts to load @lumixland/ffmpeg-binaries and return its ffmpegPath export. Throws when no binary is found.
  • runFFmpeg(args: string[], options?: { cwd?: string }): Promise<string> — Run ffmpeg with the given arguments. Resolves with the collected stderr output when ffmpeg exits with code 0, rejects with an Error otherwise.

Converters

All converters are re-exported from the package root and also available under the default export object. Each converter returns a Promise that resolves to a ConvertResult ({ output: string }) for single-file outputs, or a string path/pattern when appropriate (for example extractFrames returns the frame pattern).

Implemented converters

| Converter export | Signature | Description | Status | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------: | --------------------------------------------------------------------------------------------------------------- | ----------: | | pcmToMp3 | pcmToMp3(input: string, output: string, opts?: ConvertOptions): Promise<ConvertResult> | Convert raw PCM (s16le) to MP3. Options: sampleRate, channels, bitrate. | Implemented | | audioToWav | audioToWav(input: string, output: string, opts?: ConvertOptions): Promise<ConvertResult> | Convert any audio to WAV (PCM16). Options: sampleRate, channels. | Implemented | | audioToFlac | audioToFlac(input: string, output: string, opts?: ConvertOptions): Promise<ConvertResult> | Convert audio to FLAC. Optional bitrate. | Implemented | | audioToAac | audioToAac(input: string, output: string, opts?: ConvertOptions): Promise<ConvertResult> | Convert audio to AAC in an MP4/M4A-friendly container. Options: bitrate, sampleRate, channels. | Implemented | | audioToOgg | audioToOgg(input: string, output: string, opts?: ConvertOptions): Promise<ConvertResult> | Convert audio to Ogg Vorbis. Options: bitrate, sampleRate, channels. | Implemented | | videoToH264Mp4 | videoToH264Mp4(input: string, output: string, opts?: { bitrate?: number; width?: number; height?: number; fps?: number }): Promise<ConvertResult> | Transcode video to H.264 in MP4. Options for bitrate, scale and framerate. | Implemented | | videoToVp9Webm | videoToVp9Webm(input: string, output: string, opts?: { bitrate?: number; width?: number; height?: number }): Promise<ConvertResult> | Transcode video to VP9 in WebM. | Implemented | | extractAudioToMp3 | extractAudioToMp3(input: string, output: string, bitrate?: number): Promise<ConvertResult> | Extract the audio track from a video and save as MP3. | Implemented | | extractFrames | extractFrames(input: string, framePattern: string, opts?: { fps?: number }): Promise<string> | Extract frames to disk using a filename pattern (e.g. frame-%04d.jpg). Returns the pattern string on success. | Implemented | | remux | remux(input: string, output: string): Promise<ConvertResult> | Remux the streams into a different container without re-encoding (-c copy). | Implemented | | toMp4 | toMp4(input: string, output: string, opts?: { crf?: number; preset?: string }): Promise<ConvertResult> | Convert arbitrary input to MP4 using libx264 with sane defaults for web delivery. | Implemented |

Planned / not yet implemented converters

| Converter | Notes | | -------------- | -------------------------------------------------------------------------------------------------------- | | gifFromVideo | Planned: exported helper to create optimized GIFs from video (not implemented yet). | | thumbnail | Planned: create a single thumbnail image at a given timestamp (not implemented yet). | | concatVideos | Planned: helper to concatenate multiple video files (complexities around codecs and intermediate files). |

Types

  • ConvertOptions — exported type describing commonly used options for audio converters (sampleRate, channels, bitrate). See the source src/types.ts for the full definition.
  • ConvertResult{ output: string } for single-file outputs.

Notes

  • The @lumixland/ffmpeg-binaries package is declared as an optional peer dependency so consumers can decide whether to include it. When using pnpm workspaces, the workspace reference will ensure local linking.
  • TypeScript users: local declaration files improve DX when importing the binaries package dynamically.