how to generate video thumbnail in node.js?

There is a node module for this: video-thumb

It basically just wraps a call to exec ffmpeg


Resize by adding a -s widthxheight option to your command.


I recommend using https://www.npmjs.com/package/fluent-ffmpeg to call ffmpeg from Node.js


Reference to GitHub fluent-ffmpeg project.

Repeating example from original StackOverflow answer:

var proc = new ffmpeg('/path/to/your_movie.avi')
  .takeScreenshots({
      count: 1,
      timemarks: [ '600' ] // number of seconds
    }, '/path/to/thumbnail/folder', function(err) {
    console.log('screenshots were saved')
  });