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.

4
  • 1
    Do you know what ffmpeg does to generate that PNG? I think it has to find the right codec to decode that OGV file, find the first frame that is not black and then convert it to PNG. Not the same as downloading a file. Commented Mar 17, 2016 at 17:16
  • Yes, but still I believe it can be done faster. Commented Mar 17, 2016 at 17:41
  • Well then you'll have to find the software that does it faster. I don't know of any but it still won't be as fast as downloading a file. Commented Mar 17, 2016 at 17:44
  • how do you get the images from the output folder? Commented Jul 15, 2017 at 22:26

1 Answer 1

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.

1
  • 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
    Commented Oct 12, 2021 at 13:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.