Is there any good class library that can generate thumbnails when node uploads videos?

  node.js, question

Recently, I’ve been uploading videos and there’s no problem with it, but I want to generate a thumbnail when uploading. Do you want to ask about any good third-party class libraries?

A tool calledffmpeg, you have to install ffmpeg on the machine to capture the frame picture of the video.

The command to generate the picture isFfmeg-ia.avi-r1-swxh-fimage2a-percent 03d.jpeg-vframes1

If node is available, just use child_process.

function videoToJpeg(input){
 'use strict';
 const exec = require('child_process').exec;
 Constoutput = inputplus'. jpeg';
 const command = `ffmpeg -i ${input} -r 1 -s WxH -f image2 ${output} -vframes 1`;
 return new Promise((resolve,reject)=>{
 exec(command, (error, stdout, stderr) => {
 if(error) return reject(error);
 if(stderr) return reject(stderr);
 Videotogeg (_ _ dirname plus "./xxx.mp4")

Ffmpeg has many parameters, you should refer to it. understand the meaning of each parameter.