Platform independent binary installer of FFprobe for node projects
npx @tessl/cli install tessl/npm-ffprobe-installer--ffprobe@2.1.0FFprobe Installer is a platform-independent binary installer for FFprobe (part of the FFmpeg suite) that automatically downloads and provides access to the appropriate static binary for the current operating system and architecture. It provides a simple API that exposes the path to the FFprobe executable, version information, and homepage URL.
npm install @ffprobe-installer/ffprobeconst ffprobe = require('@ffprobe-installer/ffprobe');For destructuring:
const { path, version, url } = require('@ffprobe-installer/ffprobe');ESM imports (Node.js with "type": "module" or TypeScript):
import ffprobe from '@ffprobe-installer/ffprobe';
// or
import { path, version, url } from '@ffprobe-installer/ffprobe';const ffprobe = require('@ffprobe-installer/ffprobe');
// Access the FFprobe binary path
console.log('FFprobe path:', ffprobe.path);
console.log('FFprobe version:', ffprobe.version);
console.log('FFprobe homepage:', ffprobe.url);
// Use with child_process.spawn
const { spawn } = require('child_process');
const ffprobeProcess = spawn(ffprobe.path, ['-version']);
ffprobeProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
// Use with fluent-ffmpeg
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfprobePath(ffprobe.path);The package automatically installs the correct binary for your platform:
Platform detection is automatic based on os.platform() and os.arch(), with support for npm configuration overrides via npm_config_platform and npm_config_arch environment variables. Binary integrity is verified automatically on load.
unsafe-perm=true to .npmrc if you encounter permissions issuesapp.asar with app.asar.unpacked in the path when using Asar packagingProvides the complete path to the platform-specific FFprobe executable.
/**
* Main export object containing FFprobe binary information
* @type {{path: string, version: string, url: string}}
*/
const ffprobe = {
/** Absolute path to the platform-specific FFprobe executable */
path: string,
/** Version information of the FFprobe binary */
version: string,
/** Homepage URL of the FFprobe project */
url: string
};The absolute path to the FFprobe executable for the current platform.
/**
* Absolute path to the platform-specific FFprobe executable.
* Points to 'ffprobe.exe' on Windows and 'ffprobe' on other platforms.
* @type {string}
*/
ffprobe.pathUsage Example:
const ffprobe = require('@ffprobe-installer/ffprobe');
const { execFile } = require('child_process');
// Execute FFprobe with the binary path
execFile(ffprobe.path, ['-i', 'input.mp4'], (error, stdout, stderr) => {
if (error) {
console.error('Error:', error);
return;
}
console.log('FFprobe output:', stdout);
});The version information of the installed FFprobe binary.
/**
* Version information of the FFprobe binary.
* Extracted from the platform-specific package's package.json.
* @type {string}
*/
ffprobe.versionUsage Example:
const ffprobe = require('@ffprobe-installer/ffprobe');
console.log(`Using FFprobe version: ${ffprobe.version}`);
// Output: Using FFprobe version: 5.1.2The homepage URL of the FFprobe project.
/**
* Homepage URL of the FFprobe project.
* Extracted from the platform-specific package's package.json.
* @type {string}
*/
ffprobe.urlUsage Example:
const ffprobe = require('@ffprobe-installer/ffprobe');
console.log(`FFprobe homepage: ${ffprobe.url}`);
// Output: FFprobe homepage: https://ffmpeg.org/The package throws errors in the following cases:
try {
const ffprobe = require('@ffprobe-installer/ffprobe');
console.log('FFprobe is available at:', ffprobe.path);
} catch (error) {
if (error.message.includes('Unsupported platform')) {
console.error('Your platform is not supported');
} else if (error.message.includes('Could not find ffprobe executable')) {
console.error('FFprobe binary is missing or corrupted');
} else {
console.error('Unknown error:', error.message);
}
}