Unable to use ffprobe in fluent-ffmpeg
Solution 1
I think the documentation you've read is actually for 2.x rather than 1.x.
Try upgrading your fluent-ffmpeg module with npm install --save [email protected]
Solution 2
For ffprobe, similar should be done for other extensions
This way no need of ffmpeg having to be installed in os
const ffmpeg = require('fluent-ffmpeg');
var ffprobe = require('ffprobe-static');
ffmpeg.setFfprobePath(ffprobe.path);
Solution 3
Try setting the FFprobe path before calling it:
ffmpeg.setFfprobePath("c:\\program files\\ffmpeg\\bin\\ffprobe.exe");
ffmpeg.ffprobe(sourceFile.path, function(err, metadata) {
if (err)
{
console.log(err);
}
else{
console.log(metadata);
}
});
![GJ.](https://i.stack.imgur.com/YsUD2.jpg?s=256&g=1)
GJ.
Updated on June 04, 2022Comments
-
GJ. about 2 years
I was intended to use ffprobe function to extract video information and here is my code:
var FFmpeg = require('fluent-ffmpeg'); //... var convert_using_ffmpeg = function (source, target) { var tempfile = path.join(config.tmproot, path.basename(target)); new FFmpeg({ source: source }) .withVideoCodec('libx264') .withVideoBitrate('512') .withAudioQuality(5) .withAudioCodec('libmp3lame') .withSize('360x288') //.ffprobe(function(err,data) { // console.dir(data); //}) .toFormat('flv') .on('error', function (err) { console.log('An error occurred: ' + err.message); }) .saveToFile(tempfile, function () { fs.rename(tempfile, target); }); };
The compiler simply said
Object #<FfmpegCommand> has no method 'ffprobe
when I execute the program. The fluent-ffmpeg API says I should add FFMPEG_PATH and FFPROBE_PATH environment variable before executing, but the fact is I could execute ffmpeg directly in command line even if it does not exist in PATH environment variable, and the node.js program runs successfully without evoking the ffprobe function. Plus the API also says ffprobe comes together with most distribution of ffmpeg, if so, how can I add ffprobe to the environment variable separately?I'm using fluent-ffmpeg 1.7.0 currently.
-
GJ. almost 10 yearsI tried but it seems that the module does not work at all after that, I can only get the output
An error occurred: spawn ENOENT
-
Ben Evans almost 10 yearsHave you definetly got ffprobe in your PATH? It's not always bundled with ffmpeg.
-
GJ. almost 10 yearsnope, i can't find ffprobe because i only have one ffmpeg.exe, but the problem seems unrelated to ffprobe since I have commented them.
-
Ben Evans almost 10 yearsYou will also need ffprobe.exe then as fluent-ffmpeg uses it to gather metadata before processing.
-
Ben Evans almost 10 yearsIf this doesn't work, I'd suggest opening an issue on that actual project rather than emailing maintainers as there's a pre-huge amount of knowledge from other people using and watching the project at github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues
-
GJ. almost 10 yearsThanks for your advice.
-
GJ. over 9 yearsthx for help but i almost forget how i solved this problem ._.
-
Daniel Lizik over 8 yearsI still haven't learned exactly what PATH is (I was trying to configure it w7 for an hour but didn't have any luck) and this fixed it perfectly.
-
Andrey Solera almost 7 yearsdoes this answer can be aplied to a server side in node js environment? And if so how ca I can do it