Open-Sora icon indicating copy to clipboard operation
Open-Sora copied to clipboard

tools/scenedetect/scene_detect.py Enhanced Scene Detection with AdaptiveDetector

Open Deepchavda007 opened this issue 1 year ago • 2 comments


Enhanced Scene Detection with AdaptiveDetector

For improved results in scene detection, I recommend using the AdaptiveDetector instead of the ContentDetector. The AdaptiveDetector provides a more nuanced approach, especially for videos with varying lighting or content. Here's how you can use it in your project:

Code Snippet:

from scenedetect import AdaptiveDetector, detect_scenes, split_video_ffmpeg

# Path to the input video
video_path = 'your_video_path_here.mp4'

# Directory to save the output clips
video_dir = 'your_output_directory_here'

# Perform scene detection
scene_list = detect_scenes(
                video_path=video_path,
                scene_detector=AdaptiveDetector(
                    luma_only=True,
                    adaptive_threshold=1.5,
                    min_scene_len=3 
                ),
            )

# Split and save the detected scenes into separate clips
for i, scene in enumerate(scene_list):
    output_file = f"{video_dir}/clip_{i+1}.mp4"
    split_video_ffmpeg(
        video_path=video_path,
        scene_list=[scene],
        output_file_template=output_file,
    )

---.

Deepchavda007 avatar Mar 18 '24 04:03 Deepchavda007

Thanks for your suggestion! We will update this part in the future.

xyupeng avatar Mar 18 '24 05:03 xyupeng

Thanks you 😊

Deepchavda007 avatar Mar 18 '24 05:03 Deepchavda007

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] avatar Jun 08 '24 01:06 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Jun 15 '24 01:06 github-actions[bot]