making thumbnail of video using ffmpeg in node.js

the metadata uses the

var exec = require(‘child_process’).exec;
module.exports = {
  get: function(inputfile, callback) {
    try
    {
      exec(‘ffmpeg -i ‘ + inputfile, function(err, stdout, stderr) {
to execute the ffmpeg commands.
Ref :
var ffmpeg = require('fluent-ffmpeg');
var sys = require('sys');

var proc = new ffmpeg('youtube.flv')
  .withSize('120x90')
  .takeScreenshots({ count: 1, timemarks: [ '00:00:02.000', '6' ] }, __dirname, function(err) {
    console.log('screenshots were saved')
  });
  var ffmpegmeta = require('fluent-ffmpeg').Metadata;

// make sure you set the correct path to your video file
ffmpegmeta.get('youtube.flv', function(metadata) {
   var w=metadata.resolution.w;
   var h=metadata.resolution.h;
   var proc = new ffmpeg('youtube.flv')
  .withSize(w+'x'+h)
  .takeScreenshots({ count: 1, timemarks: [ '00:00:03.000', '6' ] }, __dirname, function(err) {
    console.log('screenshots were saved')
  });
  console.log(require('util').inspect(metadata, false, null));
});

Ref :

https://github.com/schaermu/node-fluent-ffmpeg/

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in Node.js. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s