Skip to content

Commit

Permalink
Add new argument -f/--flicker to detect-content for #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
Breakthrough committed Aug 5, 2020
1 parent 2896e0e commit 2923aa0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ PySceneDetect Changelog

### 0.6 (TBD) &nbsp;<span class="fa fa-tags"></span>

* [feature] New flash/strobe/flicker suppression option for the content detector `-f` / `--flicker [N]` which allows for setting the amount of suppression in frames or as a unit of time (default is 2 frames)

method of `SceneManager` no longer requires passing an explicit base timecode
* [api] The `get_scene_list` method of `SceneManager` no longer requires passing an explicit base timecode

### 0.5.3 (July 12, 2020) &nbsp;<span class="fa fa-tags"></span>
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/command-line-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ Options:
file. [default: 30.0]
-m, --min-scene-len FRAMES Minimum size/length of any scene, in number of
frames. [default: 15]
-f, --flicker N Number of frames N to suppress false positive
detections caused by short strobes, flashes,
or pulses of bright light. [default: 2]
-h, --help Show this message and exit.
```

Expand Down
4 changes: 3 additions & 1 deletion manual/cli/detectors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ The ``detect-content`` detector takes the following options:
specified as exact number of frames, a time in
seconds followed by s, or a timecode in the format
HH:MM:SS or HH:MM:SS.nnn [default: 0.6s]

-f, --flicker N Number of frames N to suppress false positive
detections caused by short strobes, flashes,
or pulses of bright light. [default: 2]


Usage Examples
Expand Down
9 changes: 7 additions & 2 deletions scenedetect/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,13 @@ def time_command(ctx, start, duration, end):
'Minimum size/length of any scene. TIMECODE can be specified as exact'
' number of frames, a time in seconds followed by s, or a timecode in the'
' format HH:MM:SS or HH:MM:SS.nnn')
@click.option(
'--flicker', '-f', metavar='N',
type=click.IntRange(min=0), default=2, show_default=True, help=
'Number of frames N to suppress false positive detections caused by short'
' strobes, flashes, or pulses of bright light.')
@click.pass_context
def detect_content_command(ctx, threshold, min_scene_len):
def detect_content_command(ctx, threshold, min_scene_len, flicker):
""" Perform content detection algorithm on input video(s).
detect-content
Expand All @@ -434,7 +439,7 @@ def detect_content_command(ctx, threshold, min_scene_len):
# Need to ensure that a detector is not added twice, or will cause
# a frame metric key error when registering the detector.
ctx.obj.add_detector(scenedetect.detectors.ContentDetector(
threshold=threshold, min_scene_len=min_scene_len))
threshold=threshold, min_scene_len=min_scene_len, flicker_frames=flicker))



Expand Down

0 comments on commit 2923aa0

Please sign in to comment.