Skip to content

Instantly share code, notes, and snippets.

@Talento90
Created August 7, 2019 16:49
Show Gist options
  • Select an option

  • Save Talento90/885927ecc3663bd00add337fd7588851 to your computer and use it in GitHub Desktop.

Select an option

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));
@Ishu1998
Copy link
Copy Markdown

thanks

@dkrest1
Copy link
Copy Markdown

dkrest1 commented May 31, 2024

Thanks for this

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