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

Video output when using --frame-skip should include all frames #81

Open
Breakthrough opened this issue Feb 11, 2022 · 3 comments
Open

Comments

@Breakthrough
Copy link
Owner

As identified in #70, using frame-skip also results in the same frames being skipped in the resulting video output. This is undesirable, and will require some changes so that we avoid frame skipping when we're in a motion event.

To accomplish this correctly, proper seeking needs to be added, since we need to go back and re-process all the frames we skipped so that --time-before can be respected. Another issue also arises when using --bounding-box, since we would need to interpolate the box between frames.

A better and more robust solution might be to just start processing every frame once we detect some motion, and only use frame skipping when we are looking for events, with a slight performance penalty. Although this would be a slight performance hit, encoding the actual video is more computationally expensive than the background subtraction itself, so this approach has some merit.

@Breakthrough Breakthrough added this to the v1.5 milestone Feb 11, 2022
@Breakthrough
Copy link
Owner Author

This might actually be easier if video output is first moved to a separate process as part of #52, and integration with PySceneDetect's VideoManager (pin to v0.5.6.1 for now).

@Breakthrough Breakthrough pinned this issue Feb 15, 2022
@Breakthrough Breakthrough changed the title Video output when using --frame-skip should include all source frames Video output when using --frame-skip should include all frames Feb 15, 2022
@Breakthrough
Copy link
Owner Author

To go about this, when we seek backwards, all computations of the frame mask should set learning rate to 0 so we don't update the background mask. From that point forward everything should proceed as normal.

@Breakthrough Breakthrough unpinned this issue Jun 22, 2022
@Breakthrough Breakthrough modified the milestones: v1.5, v1.6 Jul 1, 2022
@Breakthrough
Copy link
Owner Author

This isn't fully supported yet using the default OpenCV output mode, but this should now function correctly in v1.5 if you use the -m ffmpeg or -m copy flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant