node-fluent-ffmpeg: info.percent returns undefined
Hello, i have this code, i want to show the percentage of the conversion `
var infs = fs.createReadStream(path);
var self = this;
var command = ffmpeg(infs);
command.on('end', function() {
return cb(null);
});
command.on('error', function() {
return cb(err);
});
command.on('progress', function(info) {
console.log('progress ' + info.percent + '%');
});
command.save(dest);`
and it show undefined in the console: ‘progress undefined%’
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (7 by maintainers)
I too get
progress undefined%when doing this:What am I doing wrong?
Follow the prompts to solve this problem.
use .output(out_path) instead of save, and add .run() to the chain
calculating percentage uses ffprobe, if you have installed ffmpeg via node-ffmpeg-installer, you should install node-ffprobe-installer too
UPDATE: So I got it to work, somewhat.
This is how I’m showing the percentage. Unfortunately, this only works when converting to mp3. Any reason why this is?