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

[keyframe] Do not fail when there are consecutive missing frames for the smart Keyframe Selection method #1510

Merged
merged 3 commits into from
Aug 25, 2023

Conversation

cbentejac
Copy link
Contributor

Description

This PR updates the behaviour when encoutering missing frames during the score computation for the smart keyframe selection method. Prior to it, when a frame was missing, we skipped it and attempted to read to the next one:

  • If it succeeded, the process kept on going normally with dummy scores being pushed for the missing one;
  • If it failed, the process was stopping with an error, and all the computations that had been made were lost.

Instead of stopping and failing when consecutive missing frames are encountered, the score computation keeps on going until it is able to read a frame or it has reached the end of the video. Dummy scores are pushed for every missing frame.

This should resolve alicevision/Meshroom#2153.

Additionally, this PR fixes a bug that could occur with the regular keyframe selection method when minFrameStep and maxFrameStep had specific values that led to a "step" value of 0, thus causing an infinite loop.

Features list

  • Keep on trying to read the video input when more than 1 missing frame has been encountered for the smart keyframe selection method;
  • Ensure the computed "step" value in the regular keyframe selection method is always superior to 0.

In some specific cases (e.g. when minFrameStep = 0 and maxFrameStep = 1),
the computed step could be equal to 0, meaning that the following `for`
loop would never progress, getting the whole program stuck.
@cbentejac cbentejac force-pushed the fix/keyframeSelectionFailures branch from 2f241e4 to 5f6289d Compare August 18, 2023 10:38
@cbentejac cbentejac marked this pull request as ready for review August 21, 2023 13:15
…sing

When a frame was missing in a VideoFeed, the behaviour used to be to skip
it and try to read the next one. If the next one was missing as well, the
whole process would stop and fail, with the assumption that the feed was
corrupted.

Instead of that, we now keep on skipping the frame and attempting to read
the next one until a valid frame is found or there is no frame left to
read. Dummy scores are still pushed for every frame that is missing.
…iles

Instead of stopping (and cancelling) the writing of the output SfMData
file whenever a frame cannot be read, we should check whether the feed
is a VideoFeed or not: if it is, then it is possible to encounter missing
or corrupted frames and these cases should be handled by skipping said
missing or corrupted frames; if it is not, then the frames should already
be on disk and there shouldn't be any error when reading them, hence the
`return false` statement.
@cbentejac cbentejac force-pushed the fix/keyframeSelectionFailures branch from e1f56e9 to 081f68e Compare August 24, 2023 20:29
@mugulmd mugulmd merged commit 6837204 into develop Aug 25, 2023
@mugulmd mugulmd deleted the fix/keyframeSelectionFailures branch August 25, 2023 11:50
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.

[request] KeyframeSelection node could fail more gracefully
2 participants