Skip to content

Events

Every Video is a typed EventEmitter. Events provide process visibility without changing Promise semantics.

ts
video.on('start', (command) => console.log(command));
video.on('stderr', (chunk) => process.stderr.write(chunk));
video.on('progress', ({ frames, fps, time, speed, percent }) => {
  console.log({ frames, fps, time, speed, percent });
});
video.on('end', ({ code, args }) => console.log(code, args));
video.on('error', (error) => console.error(error));

await video.save(output);

Progress model

PropertyTypeMeaning
timenumberEncoded media time in seconds
percentnumber?Percentage when source duration is known
framesnumber?Processed video frames
fpsnumber?Current processing rate
speednumber?Multiple of real-time speed

An error listener is optional. Without one, a failed operation rejects its Promise normally instead of triggering an unhandled EventEmitter exception.

Process results

The end event receives the executable, exact arguments, exit code, and retained stdout/stderr. Output is tailed to maxBuffer; exceeding that limit never kills a long conversion.

Built around FFmpeg. Designed for modern Node.js.