Reputation: 805
I want to have a thumbnail of 0.0 sec of a video. Currently I am using node-fluent-ffmpeg to generate thumbnail. Following is the code:
ffmpeg(tempLocalFile)
.screenshots({
timestamps: [0.0],
filename: 'xx.png',
folder: tempFilePath
}).on('end', function() {
console.log('done');
});
But the problem is, it is taking too much of time to do the process. It is normally taking 30sec to generate the thumbnail. Which keeps increasing if the mp4 file size increases.
So my question is, Is there any fast way to generate the thumbnail. Can we improve above code to improve the performance.
ps: The machine this code is running is 512MB RAM 800MHz
Upvotes: 0
Views: 2889
Reputation: 9471
There is a trick to make ffmpeg only decode a single frame. You simply define the -ss
flag before the input. That will force it to only decode the specified frame, as opposed to the whole video.
ffmpeg -ss 0 -i input.mp4 -vframes 1 output.jpg
I'm not sure how this could be done in fluent-ffmpeg, or if it's even possible. You could file an issue
Upvotes: 1