Skip to content

Instantly share code, notes, and snippets.

@Talento90
Created August 7, 2019 16:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Talento90/885927ecc3663bd00add337fd7588851 to your computer and use it in GitHub Desktop.
Save Talento90/885927ecc3663bd00add337fd7588851 to your computer and use it in GitHub Desktop.
Generate Thumbnail from video using Node.js
"use strict";
const
ffmpegPath = require("@ffmpeg-installer/ffmpeg").path,
ffprobePath = require("@ffprobe-installer/ffprobe").path,
ffmpeg = require("fluent-ffmpeg");
ffmpeg.setFfprobePath(ffprobePath);
ffmpeg.setFfmpegPath(ffmpegPath);
async function generateThumbnail(videoPath) {
return ffmpeg(videoPath)
.thumbnail({
timestamps: ['50%'],
filename: 'thumbnail.png',
size: '320x240',
});
}
generateThumbnail('sample-video.mp4')
.then(() => console.log('Thumnail generated successfully'))
.catch((err) => console.error(err));
@Aashish-Kaushik
Copy link

can we use base64 in place of mp4 file

@Ishu1998
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment