1.0.0-beta.6 • Published 1 month ago

gamatek.ffmpeg v1.0.0-beta.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

FFmpeg Node.js Wrapper

This is a Node.js wrapper for FFmpeg, a powerful multimedia framework. It allows you to interact with FFmpeg in your Node.js applications and perform various multimedia operations.

Installation

To use this module in your Node.js project, you can install it using npm (or yarn) :

npm install gamatek.ffmpeg

Usage

Here's an example of how to use this wrapper to execute FFmpeg commands:

const FFmpeg = require("gamatek.ffmpeg");

// Create an FFmpeg instance by specifying the path to the FFmpeg executable (optional)
const ffmpeg = new FFmpeg("/path/to/ffmpeg");

// Optional
ffmpeg.setFfmpegPath("/path/to/ffmpeg");
ffmpeg.setFfprobePath("/path/to/ffprobe");

// Adds options to the FFmpeg command
ffmpeg.appendOption("-i", "input.mp4", "-vf", "scale=640:480", "output.mp4");

// Listen to events, such as "progress" and "end"
ffmpeg.on("progress", (progress) => {
    console.log("Progress:", progress);
    // or
    console.log(`${progress.percent.toFixed(1)}% | ${Math.floor(progress.remaining / 3600)}h ${Math.floor(progress.remaining / 60 % 60)}min ${Math.floor(progress.remaining % 60)}s`);
});

ffmpeg.on("end", () => {
    console.log("Conversion complete!");
});

// Executes the FFmpeg command
FFmpeg.getVideoDuration(ffmpeg, "input.mp4").then((duration) => {
    ffmpeg.setVideoDuration(duration);
    ffmpeg.exec();
});

Features

  • Easily execute FFmpeg commands in your Node.js applications.
  • Parse FFmpeg's progress and media information from the command line output.
  • Simple and flexible API for working with FFmpeg.
1.0.0-beta.6

1 month ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.0-beta.2

7 months ago

1.0.0-beta.3

7 months ago

1.0.0-beta.4

7 months ago

1.0.0-beta.5

7 months ago

1.0.0-beta.1

7 months ago

1.1.2

7 months ago

1.0.1

8 months ago

1.0.0

8 months ago