I'm trying to extract frames from a video on angular. I found several post here on SO, especially this post https://stackoverflow.com/a/32708998, i've tried to implement first solution but i can't get any frame i still don't know why. So i research about it again and i found this resource videotoframes he already has a type version, after some workaround i finally can extract the frames from video like this and put it to canvas.
But the thing is, i need to specify how many frames would i wanted from this. here's what i did
loadImages() {
this.loading = true;
this.video.getFrames('/assets/ForBiggerBlazes.mp4', 375, VideoToFramesMethod.totalFrames).then((frames) => {
console.log(frames);
frames.forEach((frame) => {
var canvas = document.createElement('canvas');
canvas.width = frame.width;
canvas.height = frame.height;
canvas.getContext('2d').putImageData(frame, 0, 0);
document.getElementsByTagName('div')[0].appendChild(canvas);
});
});
}
number 375
is an estimate how many frame my video is, is there any way to get how many frames a video have on upload?