4

I am using fluent-ffmpeg and ffmpeg in node:

var ffmpeg = require('fluent-ffmpeg');
var src = "http://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv";
ffmpeg(src)
.on('filenames', function(filenames) {
    console.log('Will generate ' + filenames.join(', ') + ' into tempfiles.')
})
.on('end', function() {
    console.log('1 Screenshot successfully taken');

})
.on('error', function(err, stdout, stderr) {
console.log("ffmpeg stdout:\n" + stdout);
console.log("ffmpeg stderr:\n" + stderr);
})
.screenshots({
    filename: randomResult,
    timemarks: [520.929831],
    folder: '/'
});

Usually, it takes 2-3 seconds to take one thumbnail. I need it to be 0.5-1 seconds for real-time development. I mean, what is the problem here - downloading a single png file on my computer takes way below 2-3 seconds to complete, why is ffmpeg lagging so much? something just doesn't seem right.

RunningFromShia
  • 590
  • 6
  • 20

1 Answers1

2

Per the fluent-ffmpeg docs "It will not work on input streams." so I suspect the entire file is trying to load.

You could try running ffmpeg as a child process directly using the -ss switch as explained in this post. This should bump your performance.

Community
  • 1
  • 1
Wainage
  • 4,892
  • 3
  • 12
  • 22
  • 1
    The frase "It will not work on input streams." helped me with other problems of fluent-ffmpeg and I think there's a lot of places where using streams will not work. Thank you! – Vencovsky Oct 12 '21 at 13:36