Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to generate video thumbnail in node.js?

I am building an app with node.js, I successfully uploaded the video, but I need to generate a video thumbnail for it. Currently I use node exec to execute a system command of ffmpeg to make the thumbnail.

   exec("C:/ffmpeg/bin/ffmpeg -i Video/" + Name  + " -ss 00:01:00.00 -r 1 -an -vframes 1 -f mjpeg Video/" + Name  + ".jpg")

This code is coming from a tutorial from http://net.tutsplus.com/tutorials/javascript-ajax/how-to-create-a-resumable-video-uploade-in-node-js/

the code above did generate a jpg file but it's not a thumbnail but a video screen shot, I wonder is there any other method to generate video thumbnail, or how to exec the ffmpeg command to make a real thumbnail (resized), and I prefer png file.

like image 806
paynestrike Avatar asked Oct 26 '12 01:10

paynestrike


1 Answers

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')
  });
like image 194
Risadinha Avatar answered Oct 04 '22 12:10

Risadinha