Reputation: 21
I want to extract frames from a Video and save the frames
var express = require("express"),
var video = "./s/video.mp4";
var storeOutput = "./store"
function getVideoFrames(){
// get frames
}
Upvotes: 1
Views: 2729
Reputation: 5921
Generally, when it comes to work with video, ffmpeg is a great tool to use. There is a ffmpeg-extract-frames package on the npm repository, based on fluent-ffmpeg, that perform exactly that.
const extractFrames = require('ffmpeg-extract-frames')
extractFrames({
input: 's/video.mp4',
output: './store/frame-%d.jpg'
})
If you need, you can pass an array of time, in milliseconds, to the offsets
option to extract only specific frames.
extractFrames({
input: 's/video.mp4',
output: './store/screenshot-%i.jpg',
offsets: [
1000,
2000,
3000
]
})
Upvotes: 2