josephrocca / getVideoFrames.js

Simple JavaScript library to break a video down into individual frames (uses WebCodecs API and MP4Box.js)
MIT License
38 stars 4 forks source link

Frames not generating properly. #3

Closed bshahTibicle closed 1 year ago

bshahTibicle commented 1 year ago

Hello @josephrocca,

I have integrate mod.js in my Web application.

If i was select video of 10 minutes & 24fps then (601024) 14400 frames need to generate. But i got only 3000 frames. on "onFrame(frame:any) {}" function of "getVideoFrames({})", i get only 3000 frames.

so i have checked code in mod.js, below function called 15 times. and chunk count match near about 14400. async #onSamples(track_id, ref, samples) { }

Can you please check this? how can i get all frames in "onFrame(frame:any) {}" function?

vlasakjiri commented 1 year ago

I have encourtered similar issue, where even a short video (5-10s) does not generate all the samples that are specified in the info.VideoTracks.num_samples property.

josephrocca commented 1 year ago

I unfortunately haven't looked at this code in ages. You are currently better positioned to solve this - if you do please open a pull request to help others who are having similar issues

pedrobroese commented 1 year ago

I have encourtered similar issue, where even a short video (5-10s) does not generate all the samples that are specified in the info.VideoTracks.num_samples property.

Take a look at this issue: https://github.com/gpac/mp4box.js/issues/243 With the code from there and mp4Box you'll be able to retrieve all frames from mp4 file in a reliable manner.

josephrocca commented 1 year ago

Okay this should be fixed now - I've just tested it with this video and it gives the correct number of frames. If you're still having troubles with v0.0.9, then please open another issue and provide an example video to use in this demo: https://jsbin.com/gehaqureca/edit?html,output