Skip to content

Commit b71e262

Browse files
committed
[docs] Reorganize docs for 0.7
Place things in a more natural order and reduce verbosity to make it easier to identify what each module does.
1 parent 8755b4f commit b71e262

File tree

5 files changed

+52
-35
lines changed

5 files changed

+52
-35
lines changed

docs/api.rst

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
``scenedetect`` 🎬 Package
44
***********************************************************************
55

6-
The `scenedetect` API is easy to integrate with most application workflows, while also being highly extensible. See the `Getting Started`_ section below for some common use cases and integrations. The `scenedetect` package contains several modules:
6+
The `scenedetect` API is easy to integrate with most application workflows, while also being highly extensible. See the `Getting Started`_ section below for some common use cases and integrations. The `scenedetect` package is organized into several sub-modules:
77

8-
* :ref:`scenedetect 🎬 <scenedetect-functions>`: Includes the :func:`scenedetect.detect <scenedetect.detect>` function which takes a path and a :ref:`detector <scenedetect-detectors>` to find scene transitions (:ref:`example <scenedetect-quickstart>`), and :func:`scenedetect.open_video <scenedetect.open_video>` for video input
8+
* :ref:`scenedetect 🎬 <scenedetect-functions>`: high-level functions like :func:`scenedetect.detect() <scenedetect.detect>` to quickly analyze a video with any :ref:`detection algorithm <scenedetect-detectors>` (:ref:`example <scenedetect-quickstart>`) and get a list of timecode pairs as a result
99

10-
* :ref:`scenedetect.scene_manager 🎞️ <scenedetect-scene_manager>`: The :class:`SceneManager <scenedetect.scene_manager.SceneManager>` acts as a way to coordinate detecting scenes (via `SceneDetector` instances) on video frames (via :ref:`VideoStream <scenedetect-video_stream>` instances).
11-
12-
* :ref:`scenedetect.detectors 🕵️ <scenedetect-detectors>`: Detection algorithms:
10+
* :ref:`scenedetect.detectors 🕵️ <scenedetect-detectors>`: detection algorithms:
1311

1412
* :mod:`ContentDetector <scenedetect.detectors.content_detector>`: detects fast cuts using weighted average of HSV changes
1513

@@ -21,27 +19,33 @@ The `scenedetect` API is easy to integrate with most application workflows, whil
2119

2220
* :mod:`HashDetector <scenedetect.detectors.hash_detector>`: finds fast cuts using perceptual image hashing
2321

24-
* :ref:`scenedetect.video_stream 🎥 <scenedetect-video_stream>`: Video input is handled through the :class:`VideoStream <scenedetect.video_stream.VideoStream>` interface. Implementations for common video libraries are provided in :mod:`scenedetect.backends`:
25-
26-
* OpenCV: :class:`VideoStreamCv2 <scenedetect.backends.opencv.ideoStreamCv2>`
27-
* PyAV: :class:`VideoStreamAv <scenedetect.backends.pyav.VideoStreamAv>`
28-
* MoviePy: :class:`VideoStreamMoviePy <scenedetect.backends.moviepy.VideoStreamMoviePy>`
29-
30-
* :ref:`scenedetect.output ✂️ <scenedetect-output>`: Output formats:
22+
* :ref:`scenedetect.output ✂️ <scenedetect-output>`: Output formats:
3123

3224
* :func:`split_video_ffmpeg <scenedetect.output.split_video_ffmpeg>` and :func:`split_video_mkvmerge <scenedetect.output.split_video_mkvmerge>` split a video based on the detected scenes
3325

3426
* :func:`save_images <scenedetect.scene_manager.save_images>` can save an arbitrary number of images from each scene
3527

3628
* :func:`write_scene_list <scenedetect.scene_manager.write_scene_list>` can be used to save scene/cut info as CSV, :func:`write_scene_list_html <scenedetect.scene_manager.write_scene_list_html>` for HTML
3729

38-
* :ref:`scenedetect.common ⏱️ <scenedetect-common>`: Contains common types such as :class:`FrameTimecode <scenedetect.common.FrameTimecode>` used for timecode handing.
30+
* :ref:`scenedetect.backends 🎥 <scenedetect-backends>`: PySceneDetect supports multiple libraries as an input backend:
31+
32+
* OpenCV: :class:`VideoStreamCv2 <scenedetect.backends.opencv.ideoStreamCv2>`
33+
34+
* PyAV: :class:`VideoStreamAv <scenedetect.backends.pyav.VideoStreamAv>`
35+
36+
* MoviePy: :class:`VideoStreamMoviePy <scenedetect.backends.moviepy.VideoStreamMoviePy>`
37+
38+
* :ref:`scenedetect.common ⏱️ <scenedetect-common>`: common functionality such as :class:`FrameTimecode <scenedetect.common.FrameTimecode>` for timecode handling
39+
40+
* :ref:`scenedetect.scene_manager 🎞️ <scenedetect-scene_manager>`: the :class:`SceneManager <scenedetect.scene_manager.SceneManager>` coordinates performing scene detection on a video with one or more detectors
41+
42+
* :ref:`scenedetect.detector 🌐 <scenedetect-detector>`: the interface (:class:`SceneDetector <scenedetect.detector.SceneDetector>`) that detectors must implement to be compatible with PySceneDetect
3943

40-
* :ref:`scenedetect.detector 🌐 <scenedetect-detector>`: Contains :class:`SceneDetector <scenedetect.detector.SceneDetector>` interface which detection algorithms must implement.
44+
* :ref:`scenedetect.video_stream <scenedetect-video_stream>`: the interface (:class:`VideoStream <scenedetect.video_stream.VideoStream>`) that detectors must implement to be compatible with PySceneDetect
4145

42-
* :ref:`scenedetect.stats_manager 🧮 <scenedetect-stats_manager>`: Contains :class:`StatsManager <scenedetect.stats_manager.StatsManager>` class for caching frame metrics and loading/saving them to disk in CSV format for analysis.
46+
* :ref:`scenedetect.stats_manager 🧮 <scenedetect-stats_manager>`: the :class:`StatsManager <scenedetect.stats_manager.StatsManager>` allows you to store detection metrics for each frame and save them to CSV for further analysis
4347

44-
* :ref:`scenedetect.platform 🐱‍💻 <scenedetect-platform>`: Logging and utility functions.
48+
* :ref:`scenedetect.platform 🐱‍💻 <scenedetect-platform>`: logging and utility functions
4549

4650

4751
Most types/functions are also available directly from the `scenedetect` package to make imports simpler.

docs/api/output.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@
66
Ouptut
77
-------------------------------------------------
88

9-
.. automodule:: scenedetect.output
10-
:members:
11-
129
.. autofunction:: scenedetect.output.save_images
1310

14-
.. automodule:: scenedetect.output.video
15-
:members:
11+
.. autofunction:: scenedetect.output.is_ffmpeg_available
12+
13+
.. autofunction:: scenedetect.output.split_video_ffmpeg
14+
15+
.. autofunction:: scenedetect.output.is_mkvmerge_available
16+
17+
.. autofunction:: scenedetect.output.split_video_mkvmerge
18+
19+
.. autofunction:: scenedetect.output.write_scene_list_html
20+
21+
.. autofunction:: scenedetect.output.write_scene_list
22+
23+
.. autoclass:: scenedetect.output.SceneMetadata
24+
25+
.. autoclass:: scenedetect.output.VideoMetadata
26+
27+
.. autofunction:: scenedetect.output.default_formatter
28+

docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ Table of Contents
4646

4747
api
4848
api/detectors
49-
api/scene_manager
50-
api/common
51-
api/backends
5249
api/output
53-
api/stats_manager
50+
api/backends
51+
api/common
52+
api/scene_manager
5453
api/detector
5554
api/video_stream
55+
api/stats_manager
5656
api/platform
5757

5858
=======================================================================

scenedetect/_cli/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from scenedetect.common import FrameTimecode
2929
from scenedetect.detector import FlashFilter
3030
from scenedetect.detectors import ContentDetector
31-
from scenedetect.output.video import DEFAULT_FFMPEG_ARGS
31+
from scenedetect.output.video import _DEFAULT_FFMPEG_ARGS
3232
from scenedetect.scene_manager import Interpolation
3333

3434
PYAV_THREADING_MODES = ["NONE", "SLICE", "FRAME", "AUTO"]
@@ -441,7 +441,7 @@ class XmlFormat(Enum):
441441
"output": None,
442442
},
443443
"split-video": {
444-
"args": DEFAULT_FFMPEG_ARGS,
444+
"args": _DEFAULT_FFMPEG_ARGS,
445445
"copy": False,
446446
"filename": "$VIDEO_NAME-Scene-$SCENE_NUMBER",
447447
"high-quality": False,

scenedetect/output/video.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
logger = logging.getLogger("pyscenedetect")
4545

46-
COMMAND_TOO_LONG_STRING = """
46+
_COMMAND_TOO_LONG_STRING = """
4747
Cannot split video due to too many scenes (resulting command
4848
is too large to process). To work around this issue, you can
4949
split the video manually by exporting a list of cuts with the
@@ -52,10 +52,10 @@
5252
for details. Sorry about that!
5353
"""
5454

55-
FFMPEG_PATH: ty.Optional[str] = get_ffmpeg_path()
55+
_FFMPEG_PATH: ty.Optional[str] = get_ffmpeg_path()
5656
"""Relative path to the ffmpeg binary on this system, if any (will be None if not available)."""
5757

58-
DEFAULT_FFMPEG_ARGS = (
58+
_DEFAULT_FFMPEG_ARGS = (
5959
"-map 0:v:0 -map 0:a? -map 0:s? -c:v libx264 -preset veryfast -crf 22 -c:a aac"
6060
)
6161
"""Default arguments passed to ffmpeg when invoking the `split_video_ffmpeg` function."""
@@ -87,7 +87,7 @@ def is_ffmpeg_available() -> bool:
8787
Returns:
8888
True if `ffmpeg` can be invoked, False otherwise.
8989
"""
90-
return FFMPEG_PATH is not None
90+
return _FFMPEG_PATH is not None
9191

9292

9393
##
@@ -232,7 +232,7 @@ def split_video_mkvmerge(
232232
float(total_frames) / (time.time() - processing_start_time),
233233
)
234234
except CommandTooLong:
235-
logger.error(COMMAND_TOO_LONG_STRING)
235+
logger.error(_COMMAND_TOO_LONG_STRING)
236236
except OSError:
237237
logger.error(
238238
"mkvmerge could not be found on the system."
@@ -249,7 +249,7 @@ def split_video_ffmpeg(
249249
output_dir: ty.Optional[Path] = None,
250250
output_file_template: str = "$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4",
251251
video_name: ty.Optional[str] = None,
252-
arg_override: str = DEFAULT_FFMPEG_ARGS,
252+
arg_override: str = _DEFAULT_FFMPEG_ARGS,
253253
show_progress: bool = False,
254254
show_output: bool = False,
255255
suppress_output=None,
@@ -329,7 +329,7 @@ def split_video_ffmpeg(
329329
output_path.parent.mkdir(parents=True, exist_ok=True)
330330

331331
# Gracefully handle case where FFMPEG_PATH might be unset.
332-
call_list = [FFMPEG_PATH if FFMPEG_PATH is not None else "ffmpeg"]
332+
call_list = [_FFMPEG_PATH if _FFMPEG_PATH is not None else "ffmpeg"]
333333
if not show_output:
334334
call_list += ["-v", "quiet"]
335335
elif i > 0:
@@ -371,7 +371,7 @@ def split_video_ffmpeg(
371371
)
372372

373373
except CommandTooLong:
374-
logger.error(COMMAND_TOO_LONG_STRING)
374+
logger.error(_COMMAND_TOO_LONG_STRING)
375375
except OSError:
376376
logger.error(
377377
"ffmpeg could not be found on the system."

0 commit comments

Comments
 (0)