Open-Sora
Open-Sora copied to clipboard
tools/scenedetect/scene_detect.py Enhanced Scene Detection with AdaptiveDetector
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,
)
---.
Thanks for your suggestion! We will update this part in the future.
Thanks you 😊
This issue is stale because it has been open for 7 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.