-
Notifications
You must be signed in to change notification settings - Fork 463
[FIX] VideoManager read function failed on multiple videos #107
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
[FIX] VideoManager read function failed on multiple videos #107
Conversation
…ction if downscale factor was set
scenedetect/video_manager.py
Outdated
| if not read_frame and not self._get_next_cap(): | ||
| break | ||
| # Switch to the next capture when the current one is over | ||
| if not read_frame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be changed to while not read_frame instead now, since if for some reason the new cap doesn't return a frame, it will still be used below. Changing this to a while() would advance to the next cap, if any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I realized just now, a while loop is not the solution actually - have a better suggestion.
|
Hi @ivan23kor; Great find!! I have one small favour to ask - as part of the review, I think the if statement should be changed to a while to handle the case where a video doesn't have any frames for some reason. Do you agree/disagree? Just want to get your feedback on that before merging this. Thank you so much for the fix, much appreciated! |
|
Hi @ivan23kor; Sorry my mistake - no need for nested loops, I think it would be better to just change line 752 to Thanks!! |
|
The second commit is better, check it out! |
|
Very nice @ivan23kor! Thank you so much!! |
Traceback:
Reason:
set_downscale_factor()read()function of the created VideoManager object, e.g. via passing it to the SceneManagerdetect_scenes()asframe_sourceargumentThis happens because of the bug in video_manager.py around lines 750. If one of the captured videos is over, an empty numpy.ndarray is returned on line 745 and its further use leads to the aforementioned error.
The commit contains the bug fix in video_manager.py as well as an integration test (VideoManager + SceneManager) in tests/test_video_manager.py