How to create a video in node.js?

I am creating an application using node.js, I have successfully uploaded the video, but I need to create a video thumbnail for it. I am currently using node exec to execute the ffmpeg system command to create a sketch.

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 taken from the tutorial at http://net.tutsplus.com/tutorials/javascript-ajax/how-to-create-a-resumable-video-uploade-in-node-js/

The above code generated the jpg file, but this is not a thumbnail, but a screenshot of the video. I wonder if there is another way to create a thumbnail of the video or how to execute the ffmpeg command to create a real thumbnail (resized), and I prefer a png file

+8
source share
6 answers

Resize by adding the -s wid parameter, thanksheight to your command.

+1
source

Link to the GitHub fluent-ffmpeg project .

Repeating an example from fooobar.com/questions/435609 / ... :

 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') }); 
+11
source

There is a node module for this: video-thumb

This basically just ends up exec ffmpeg call

+1
source

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

0
source

Instead, I would recommend using thumbsupply . In addition to providing you with thumbnails, it caches them to significantly improve performance.

 npm install --save thumbsuppply 

After installing the module, you can use it as follows.

 const thumbsupply = require('thumbsupply')("com.example.application"); thumbsupply.generateThumbnail('some-video.mp4') .then(thumb => { // serve thumbnail }) 
0
source

Using media-thumbnail , you can easily create thumbnails from your videos. The module basically wraps the functionality of ffmpeg thumbnails.

 const mt = require('media-thumbnail') mt.forVideo( './files/mappu.mp4', './thumbs/mappu.png', { width: 200 }) .then(() => console.log('Success'), err => console.error(err)) 

You can also create thumbnails from your images using this package.

0
source

All Articles