I am generating a Screenshot by using ffmpeg. Its generating the thumbnail but its taking too long (more than 2 minutes).
I have referred this link
create thumbnails from big movies with FFmpeg takes too long
But I have to set in my nodejs code
ffmpeg(main_folder_path)
.on('filenames', function(filenames) {
console.log('Will generate ' + filenames.join(', '))
})
.on('end', function() {
console.log('Screenshots taken');
})
.screenshots({
pro_root_path+'public/uploads/inspection/'+req.body.clientID+'/images/'
timestamps: [30.5, '20%', '01:10.123'],
filename: 'thumbnail-at-%s-seconds.png',
folder: pro_root_path+'public/uploads/inspection/'+req.body.clientID+'/images/',
size: '320x240'
});
I used timestamp But even though its taking more than 2 minutes. How do I fix this Issue.
I'm not a fan of the fluent-ffmpeg "screenshot" command. ffmpeg has a built-in screenshot capability, and it's much more flexible. Most notably, it allows you to take advantage of ffmpeg's ability to quickly seek on on the "input" rather than the "output". ("Seeking on output" basically means that it will process every single frame between the start of the video and the one that you want to screenshot.)
Fortunately, fluent-ffmpeg allows you to use any command line parameters, by way of
outputOptions
. The following command would take a screenshot at the 15-minute mark. It takes about 1 second on my machine.Without the command '-frames 1', it would take a screenshot for every frame of the video.
As an illustration of just how powerful this can be, the following command makes consecutive sprited 5x5 images (25 images per file) of an entire video. Great for making thumbnails.