@@ -11,8 +11,6 @@ Inspired by [PySceneDetect](https://github.com/Breakthrough/PySceneDetect), Shut
1111- ** Flexible** : Supports both rule-based and machine-learning-based approaches.
1212
1313## Installation
14-
15- ### Build from Source
1614Ensure that FFmpeg, OpenCV, and CMake are installed.
1715```
1816sudo apt install libopencv-dev ffmpeg cmake
@@ -47,17 +45,35 @@ See [documentation](docs/cli_documentation.md) for details.
4745
4846## API
4947### Python
50- Install ` libshutoh ` by running:
48+ Install Shutoh by running:
5149```
5250pip install git+https://github.com/awkrail/shutoh.git
5351```
5452To detect scenes with ` ContentDetector() ` , run the following code:
5553``` python
5654from libshutoh import detect, ContentDetector
57- detector = ContentDetector.initialize_detector()
55+ detector = ContentDetector.initialize_detector(threshold = 27 , min_scene_len = 15 )
56+ scenes = detect(' video/input.mp4' , detector)
57+ for i, scene in enumerate (scene_list):
58+ print (' Scene %2d : Start %s / Frame %d , End %s / Frame %d ' % (
59+ i+ 1 ,
60+ scene[0 ].get_timecode(), scene[0 ].get_frames(),
61+ scene[1 ].get_timecode(), scene[1 ].get_frames(),))
62+ ```
63+ Using ` scenedetect.split_video_ffmpeg ` , we can also split the video into each scene:
64+ ``` python
65+ from libshutoh import detect, ContentDetector
66+ from scenedetect import split_video_ffmpeg
67+ detector = ContentDetector.initialize_detector(threshold = 27 , min_scene_len = 15 )
5868scenes = detect(' video/input.mp4' , detector)
69+ split_video_ffmpeg(' vide/input.mp4' , scenes, show_progress = True )
5970```
60- See [ Python API documentation] ( docs/python_documentation.md ) for details.
71+ If you want to use other detectors, replace the detector with the new one:
72+ ``` python
73+ from libshutoh import AdaptiveDetector
74+ detector = AdaptiveDetector.initialize_detector()
75+ ```
76+ ** Detector list:** AdaptiveDetector, ContentDetector, HashDetector, HistogramDetector, ThresholdDetector
6177
6278### C++
6379The simpletest code is as follow:
@@ -98,14 +114,6 @@ FetchContent_Declare(
98114FetchContent_MakeAvailable(shutoh)
99115target_link_libraries(YOUR_LIBRARY PUBLIC shutoh OTHER_LIBRARIES)
100116```
101- See [ C++ API documentation] ( docs/cpp_documentation.md ) for details.
102-
103- ## Tests
104- Run test using ` ctest ` :
105- ``` shell
106- cd build
107- ctest
108- ```
109117
110118## Contribution
111119Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
0 commit comments