@ohierro/ffmpeg-node
v0.1.10
Published
FFmpeg CLI wrapper for Nodejs
Downloads
26
Maintainers
Readme
ffmpeg-node
Simple TypeScript wrapper for FFmpeg CLI commands including the ability to stop the recording
Installation
npm install --save @ohierro/ffmpeg
Needs to have ffmpeg
installed and available in PATH
API
- Import the module
import * as FFmpeg from '@ohierro/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();