Repository navigation
Commit 2fa8290
authored
## Summary
- `AdaptiveDetector` was checking `min_scene_len` against the *current*
frame while emitting the cut `window_width` frames earlier. With the
reporter's `window_width=20` and `min_scene_len=24`, a second peak could
be written 4 frames after the previous cut (issue #408).
- The length check now uses the emitted target frame, which is what
0.6.4 (`d8397bc`) intended but did not actually change (the comparison
was left on the current frame after a rename).
Provenance: the owner identified the current-vs-target mismatch on the
issue; collaborator @wjs018 described the 100/124/104 example; the
reporter confirmed that example and measured a 4-frame clip with
ffprobe.
## Decision
- **Chose:** Compare `min_scene_len` to `target_timecode` (the cut that
is actually returned).
- **Alternative:** Keep the current-frame comparison and add
`window_width` to the threshold, or move AdaptiveDetector onto
`FlashFilter` like `ContentDetector`.
- **Why:** Smallest change that matches the owner's diagnosis and the
stated intent of `d8397bc`. Happy to switch to `FlashFilter` if you want
merge-mode behaviour here.
A second judgement call: the regression test uses synthetic luma steps
with the reporter's `window_width=20` / `min_scene_len=24`, not
`goldeneye.mp4`. Well-spaced cuts on that clip never enter the
`min_scene_len - window_width` window, so a goldeneye-only assertion
would pass with or without the fix.
## Checklist
- [x] New AdaptiveDetector unit test fails without the fix (`[100, 104,
140, 144]` vs `[100, 140]`) and passes with it
- [x] `ruff check` / `ruff format` on the touched Python files
- [x] Follows the Google Python Style Guide
- [x] Changelog entry under 0.7.2 (development section)
## Test plan
- [x] Synthetic luma cuts at frames 100/104 and 140/144 with
`window_width=20`, `min_scene_len=24`: without the fix the detector
emits `[100, 104, 140, 144]`; with the fix it emits `[100, 140]`.
- [x] `pytest tests/test_detectors.py::test_detectors_with_stats` (all
detectors including AdaptiveDetector, with a StatsManager)
- [ ] Optional: `detect-adaptive` on a clip with a decaying double peak
and `--min-scene-len 24 --frame-window 20`; no output scene should be
shorter than 24 frames.
Fixes #408
3 files changed
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
782 | 782 | | |
783 | 783 | | |
784 | 784 | | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
| |||
0 commit comments