Repository navigation
Fix Hikvision motion clip boundaries and trim quiet tails - #404
Merged
spupuz merged 1 commit intoOct 2, 2026
Merged
Conversation
Contributor
Author
|
@spupuz this could be used in other places as well |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to #391, based on testing the Hikvision ISAPI integration with a real camera.
The observed alert stream repeatedly reported VMD
activebut did not reportinactiveduring the tested episodes. This is an observation about the tested stream, not an assumption that Hikvision cameras never send an end signal. Previously, stale motion could remain active until another stream chunk arrived. An alarm returning close to expiry could also split one apparent episode into separate clips with overlapping pre-capture footage.Simply shortening the timeout risks splitting nearby alarms; keeping the writer open avoids the split but records more quiet footage. This change separates those concerns: preserve the continuation window while recording, then conservatively remove an unnecessary quiet tail from the finished clip.
Changes
Conservative cleanup
This is a conservative frame-difference heuristic, not semantic person detection or a guarantee of finding the exact last-motion frame. Low-resolution sampling and excluding the top/bottom overlay bands have limitations; the opt-out allows cameras or scenes that do not suit the heuristic to retain their original clips.
Temporary diagnostic logs, parser counters, and unknown-event debugging instrumentation have been removed from the branch history. Normal error logging remains.
Verification
The test scripts are in the project's ignored local test directories (
scripts/tests/); these results are local verification, not new committed CI coverage. No automated browser/screenshot verification was performed, and broader lighting/weather conditions remain unverified.