Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFMPEG fast frame count #1004

Merged
merged 4 commits into from
Jun 2, 2020

Conversation

mleotta
Copy link
Member

@mleotta mleotta commented Jun 1, 2020

This is one last feature I'd like to get into KWIVER before the next release. This change allows FFMPEG to provide an accurate frame count quickly (in constant time) without scanning the whole video. Since we are now trusting the accuracy of seeking we can seek to the last key frame and advance to the end to find the last valid frame. There are existing tests that compare the output of num_frames() to a count of frames by stepping through all frames. These tests continue to pass. I've also validated that the frame counts are accurate on several real videos.

This change allows us to open very large videos in TeleSculptor in seconds without waiting minutes or hours to scan the whole video.

Instead of advancing through the entire video and counting every frame,
the new algorithm seeks to the last keyframe it can find and then advances
to the end to discover the frame number of the last frame.  With this change
the number of frames is accessible in constant time rather than linear in the
number of frames of video.
@mleotta mleotta requested a review from chetnieter June 1, 2020 17:20
@kwcvrobot
Copy link
Collaborator

@kwcvrobot
Copy link
Collaborator

@kwcvrobot
Copy link
Collaborator

@kwcvrobot
Copy link
Collaborator

@linus-sherrill linus-sherrill merged commit 5a7a959 into Kitware:release Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants