Skip to content

node-av / ffmpeg / ffmpegPath

Function: ffmpegPath()

ffmpegPath(): string

Defined in: src/ffmpeg/index.ts:54

Get the absolute path to the FFmpeg binary.

Returns the path to the FFmpeg executable that was automatically downloaded during package installation. The binary is platform-specific and matches the FFmpeg version used by the native bindings.

Returns

string

Absolute path to the FFmpeg binary

Examples

typescript
import { ffmpegPath } from 'node-av/ffmpeg';

const path = ffmpegPath();
console.log('FFmpeg binary at:', path);
// On Windows: C:\path\to\node_modules\node-av\binary\ffmpeg.exe
// On Unix: /path/to/node_modules/node-av/binary/ffmpeg
typescript
import { ffmpegPath } from 'node-av/ffmpeg';
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';

const execFileAsync = promisify(execFile);

async function convertVideo(input: string, output: string) {
  const args = [
    '-i', input,
    '-c:v', 'libx264',
    '-crf', '23',
    '-c:a', 'aac',
    output
  ];

  await execFileAsync(ffmpegPath(), args);
}