How breakthrough/pyscenedetect works
PySceneDetect detects video cuts and turns them into scene boundaries, through either its Python API or CLI. The main workflow opens a video, processes frames with selected detection algorithms, and returns scene timecodes; CLI commands and API helpers can then save images, split video, or export scene data. The graph also shows video backends and stats support. Some links reflect documented or indexed dependencies rather than inspected call sites, so those are dashed and unverified.
Main entry points: scene_manager.py Scene manager · video_stream.py Video stream API · __init__.py Python API · controller.py CLI
Components 20
User entry points
- Python API
scenedetect/__init__.py - CLI
scenedetect/_cli/controller.py - CLI config
scenedetect/_cli/config.py - CLI context
scenedetect/_cli/context.py - CLI commands
scenedetect/_cli/commands.py
Video detection
- Scene manager
scenedetect/scene_manager.py - Detection algorithms
scenedetect/detectors - Detector interface
scenedetect/detector.py - Timecodes
scenedetect/common.py - Frame statistics
scenedetect/stats_manager.py
Media I/O
- Video stream API
scenedetect/video_stream.py - OpenCV backend
scenedetect/backends/opencv.py - PyAV backend
scenedetect/backends/pyav.py - MoviePy backend
scenedetect/backends/moviepy.py - Concatenated video
scenedetect/backends/concat.py
Scene results
- Image output
scenedetect/output/image.py - Video output
scenedetect/output/video.py - Scene exports
scenedetect/output/__init__.py
Other components
- User
- ffmpeg / mkvmerge
Connections 24
- User → Python API: calls
- User → CLI: runs
- Python API → Scene manager: runs detection
scenedetect/__init__.py - Python API → Video stream API: opens video
scenedetect/__init__.py - Python API → Detection algorithms: selects detector
scenedetect/__init__.py - CLI → CLI context: uses context
scenedetect/_cli/controller.py - CLI context → CLI config: reads config
scenedetect/_cli/context.py - CLI → Scene manager: runs detection
scenedetect/_cli/controller.py - CLI → CLI commands: dispatches commands
scenedetect/_cli/controller.py - Scene manager → Video stream API: reads frames
scenedetect/scene_manager.py - Scene manager → Detector interface: processes frames
scenedetect/scene_manager.py - Detection algorithms → Detector interface: implements
scenedetect/detectors/__init__.py - Scene manager → Frame statistics: records metrics
scenedetect/scene_manager.py - Scene manager → Timecodes: tracks boundaries
scenedetect/scene_manager.py - Video stream API → OpenCV backend: backend
scenedetect/backends/opencv.py - Video stream API → PyAV backend: backend
scenedetect/backends/pyav.py - Video stream API → MoviePy backend: backend
scenedetect/backends/moviepy.py - Video stream API → Concatenated video: backend
scenedetect/backends/concat.py - CLI commands → Image output: saves frames
scenedetect/_cli/commands.py - CLI commands → Video output: splits video
scenedetect/_cli/commands.py - CLI commands → Scene exports: exports scenes
scenedetect/_cli/commands.py - User → Image output: requests images
- User → Video output: requests split
- Video output → ffmpeg / mkvmerge: invokes tool