@unaxiom/ffmpeg
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

ffmpeg-node

Simple TypeScript wrapper for FFmpeg CLI commands including the ability to stop the recording

Installation

npm install --save @unaxiom/ffmpeg

Needs to have ffmpeg installed and available in PATH

API

  • Import the module
import * as FFmpeg from '@unaxiom/ffmpeg';

Or require the module

var FFmpeg = require("./ffmpeg");
  • Create the object
var ffmpeg = new FFmpeg.FFmpeg();
  • Add an individual option
ffmpeg.addOption("-y");
  • Add an array of options
ffmpeg.addOptions([
        "-y",
        "-i", "screen.vb8.webm",
        "-vf", "setpts=80*PTS",
    ]);
  • Set the output file name
ffmpeg.setOutputFile("output.webm");
  • Set up a callback function when the process completes/quits
ffmpeg.setOnCloseCallback(function (code: number, signal: string) {
        console.log("Process quit from setOnCloseCallback with code -> " + code + " and signal -> " + signal);
    });
  • Run the process
ffmpeg.run(); // Accepts an optional boolean that supresses the standard output. Default is false.
  • Quit the process (graceful quit)
ffmpeg.quit();
  • Kill the process
ffmpeg.kill();

Package Sidebar

Install

npm i @unaxiom/ffmpeg

Weekly Downloads

95

Version

0.1.2

License

Apache-2.0

Last publish

Collaborators

  • apratheek