fluent-ffmpeg/node-fluent-ffmpeg

videotomp3 conversion issue

Prameelagolusula opened this issue · 2 comments

(function(){
console.log("node");
var ffmpeg = require('fluent-ffmpeg');

var args = process.argv.slice(2);

function baseName(str) {
var base = str.substring(str.lastIndexOf('/') + 1);
if (base.lastIndexOf(".") !== -1) {
base = base.substring(0, base.lastIndexOf("."));
}
return base;
}

args.forEach(function(val, index, array) {
var filename = val;
console.log(filename);
var basename = baseName(filename);
console.log(basename);

  ffmpeg(filename)
      .toFormat('mp3')
      .saveToFile(basename + '.mp3')
      .on('error', (err) => {
          console.log(err);
      })
      .on('progress', (progress) => {
          console.log("...frames: " + progress.frames);
      })
      .on('end', () => {
          console.log("Finished processing");
      })
      .run();

});
})();

C:\Users\samit\Desktop\videotomp3>node index.js video.mp4
node
video.mp4
video
Error: Output format mp3 is not available
at C:\Users\samit\Desktop\videotomp3\node_modules\fluent-ffmpeg\lib\capabilities.js:589:21
at fn (C:\Users\samit\Desktop\videotomp3\node_modules\async\lib\async.js:582:34)
at Immediate._onImmediate (C:\Users\samit\Desktop\videotomp3\node_modules\async\lib\async.js:498:34)
at process.processImmediate (node:internal/timers:478:21)
Error: Output format mp3 is not available
at C:\Users\samit\Desktop\videotomp3\node_modules\fluent-ffmpeg\lib\capabilities.js:589:21
at fn (C:\Users\samit\Desktop\videotomp3\node_modules\async\lib\async.js:582:34)
at Immediate._onImmediate (C:\Users\samit\Desktop\videotomp3\node_modules\async\lib\async.js:498:34)
at process.processImmediate (node:internal/timers:478:21) this the error im getting