fix: Migrate scene detection to PySceneDetect 0.6+ API
VideoManager/SceneManager top-level imports were removed in 0.6+, causing ImportError on job start. Switched to open_video() and SceneManager.detect_scenes(video=...). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c6d5d51094
commit
771d7da552
1 changed files with 4 additions and 7 deletions
11
main.py
11
main.py
|
|
@ -5,7 +5,7 @@ import subprocess
|
|||
import argparse
|
||||
import re
|
||||
import sys
|
||||
from scenedetect import VideoManager, SceneManager
|
||||
from scenedetect import open_video, SceneManager
|
||||
from scenedetect.detectors import ContentDetector
|
||||
from ultralytics import YOLO
|
||||
import torch
|
||||
|
|
@ -421,15 +421,12 @@ def analyze_scenes_strategy(video_path, scenes):
|
|||
return strategies
|
||||
|
||||
def detect_scenes(video_path):
|
||||
video_manager = VideoManager([video_path])
|
||||
video = open_video(video_path)
|
||||
scene_manager = SceneManager()
|
||||
scene_manager.add_detector(ContentDetector())
|
||||
video_manager.set_downscale_factor()
|
||||
video_manager.start()
|
||||
scene_manager.detect_scenes(frame_source=video_manager)
|
||||
scene_manager.detect_scenes(video=video)
|
||||
scene_list = scene_manager.get_scene_list()
|
||||
fps = video_manager.get_framerate()
|
||||
video_manager.release()
|
||||
fps = video.frame_rate
|
||||
return scene_list, fps
|
||||
|
||||
def get_video_resolution(video_path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue