Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
Extract frames from video angular

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.

enter image description here

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The average HTML frame rate is 24 FPS, so if the video is 30 seconds, the total frame number is 30 x 24 Get the time of the video

const videoDOM=document.getElementById("video"); 
videoDom.duration

this will give u NaN, so to avoid that, we need to wait for the duration to change then call videoDom.duration


videoDom.ondurationchange = () => {
   this.vidDuration = vid.duration;
};

that way we can get an actual duration

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!