A simple way of implementing FFmpeg regardless of OS
const ffmpeg = require("ffmpeg-cli");
ffmpeg.run("-version");
console.log(ffmpeg.runSync("-version"));
No need to install other programs as ffmpeg-cli will download and extract necessary binaries for your OS!
- MacOS ~ 64 bit
- Linux ~ 32/64 bit
- Windows ~
32/64 bit
Returns the path of FFmpeg executable
ffmpeg.path;
// Ex: C:\Users\PotatoParser\Desktop\NodeJS\ffmpeg-cli\ffmpeg\win32x64\bin\ffmpeg.exe
Returns the output from FFmpeg
ffmpeg.runSync(commands);
// Ex: ffmpeg.runSync(`-i input.jpg -vf scale=320:240 output.png`);
Returns a Promise
ffmpeg.run(commands);
ffmpeg.run(commands).catch((error)=>{...}); // Catch errors
ffmpeg.run(commands).then((result)=>{...}); // Only results
ffmpeg.run(commands).then((result)=>{...}).catch((error)=>{...}); // Catches when errors found
Run to redownload (synchronously) ffmpeg files Returns true if download is successful
ffmpeg.forceDownload();