Repository navigation
ContentDetector merge filter: one short scene early on changes where (or whether) a much later cut is reported #585
Replies: 2 comments 2 replies
|
I can reproduce all four results on 0.7.2 (OpenCV 5.0.0). Your reading is right. Walking through
So a merge group only closes once the group itself spans A small change that disarms the filter, without emitting anything, once from scenedetect.detector import FlashFilter
_orig_filter_merge = FlashFilter._filter_merge
def _filter_merge(self, timecode, above_threshold):
# A lone short scene was merged into the previous one: once min_scene_len frames pass
# without a cut, disarm without emitting anything.
if (self._merge_triggered and not above_threshold
and self._min_length_met(self._last_above, timecode)
and not self._min_length_met(self._merge_start, self._last_above)):
self._merge_triggered = False
return []
return _orig_filter_merge(self, timecode, above_threshold)
FlashFilter._filter_merge = _filter_mergeWith this applied, using your If you don't want to patch, |
The current behaviour sounds inconsistent, and indeed I may have overlooked something here. Feel free to file a bug report for this. |
Uh oh!
There was an error while loading. Please reload this page.
I'm using ContentDetector with threshold=15 and min_scene_len of about 1s (default filter_mode) to split long sports broadcasts into shots. While testing on synthetic clips I noticed that a single short scene early in the video changes how a cut hundreds of frames later gets reported.
On 0.7.2 (same on 0.6.7 and 0.7.0, OpenCV 5.0.0):
The 2nd and 4th clips only add a cut at frame 110, which is 290 / 470 frames before the cut I care about. With it, the 400/415 pair comes out at 415 instead of 400, and the cut at 580 (20 frames before the end) is gone entirely. With
filter_mode=FlashFilter.Mode.SUPPRESSall four give 400 / 580 as I'd expect.From reading
_filter_merge, the 100→110 short scene sets_merge_triggered, and that only clears once_last_above - _merge_start >= min_scene_len, which a lone short scene never satisfies. So the filter stays armed through the quiet stretch, then holds the next real cut until another min_scene_len of quiet frames, and loses it if the video ends first. Your comment in #35 describes cuts being suppressed "until min-scene-len frames pass without a cut", so I expected it to reset somewhere in those 290 frames. #469 looks related, but there the difference came from changing min_scene_len, not from an earlier short scene with the same settings.Is this the intended merge behaviour, or should the merge state clear after min_scene_len frames without a cut?
All reactions