Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FFmpegProcess

Hierarchy

  • FFmpegProcess

Index

Properties

args

args: keyof string[]

Command line arguments used to spawn the process.

ffmpegPath

ffmpegPath: string

Path of the running ffmpeg executable.

pid

pid: number

UNSTABLE: Deprecated, not for use in new projects.

deprecated

Use FFmpegProcess.unwrap().pid instead.

Returns the process identifier (PID) of the process.

Methods

abort

  • abort(): Promise<void>
  • Aborts the conversion allowing FFmpeg to finish the generated files correctly. This waits for FFmpeg to exit but doesn't guarantee that FFmpeg will succeed, any possible errors should still be handled.

    Returns Promise<void>

complete

  • complete(): Promise<void>
  • Returns a Promise which resolves when the process exits, or rejects when the process exits with a non-zero status code. If the ChildProcess emits an error event, the Promise will be rejected with that error.

    example
    const process = cmd.spawn();
    await process.complete();
    console.log('Conversion complete!');

    To handle errors:

    const process = await cmd.spawn();
    try {
      await process.complete();
      console.log('Conversion complete!');
    } catch (e) {
      console.error('Conversion failed!', error);
    }

    Returns Promise<void>

kill

  • kill(signal?: NodeJS.Signals | number): boolean

pause

  • pause(): boolean
  • Pauses the conversion, returns true if the operation succeeds or false if it fails.

    Returns boolean

progress

  • progress(): AsyncGenerator<Progress, void, void>
  • Returns an AsyncGenerator representing the real-time progress of the conversion.

    example
    const process = await cmd.spawn();
    for await (const progress of process.progress()) {
      console.log('Speed:', progress.speed);
    }

    Using NodeJS Streams:

    const process = await cmd.spawn();
    const progressStream = Readable.from(process.progress());
    progressStream.on('data', (progress) => {
      console.log('Speed:', progress.speed);
    });

    Returns AsyncGenerator<Progress, void, void>

resume

  • resume(): boolean
  • Resumes the conversion, returns true if the operation succeeds or false if it fails.

    Returns boolean

unwrap

  • unwrap(): ChildProcess
  • Returns the underlying NodeJS' ChildProcess instance.

    Returns ChildProcess