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 argparse
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from scenedetect import VideoManager, SceneManager
|
from scenedetect import open_video, SceneManager
|
||||||
from scenedetect.detectors import ContentDetector
|
from scenedetect.detectors import ContentDetector
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
import torch
|
import torch
|
||||||
|
|
@ -421,15 +421,12 @@ def analyze_scenes_strategy(video_path, scenes):
|
||||||
return strategies
|
return strategies
|
||||||
|
|
||||||
def detect_scenes(video_path):
|
def detect_scenes(video_path):
|
||||||
video_manager = VideoManager([video_path])
|
video = open_video(video_path)
|
||||||
scene_manager = SceneManager()
|
scene_manager = SceneManager()
|
||||||
scene_manager.add_detector(ContentDetector())
|
scene_manager.add_detector(ContentDetector())
|
||||||
video_manager.set_downscale_factor()
|
scene_manager.detect_scenes(video=video)
|
||||||
video_manager.start()
|
|
||||||
scene_manager.detect_scenes(frame_source=video_manager)
|
|
||||||
scene_list = scene_manager.get_scene_list()
|
scene_list = scene_manager.get_scene_list()
|
||||||
fps = video_manager.get_framerate()
|
fps = video.frame_rate
|
||||||
video_manager.release()
|
|
||||||
return scene_list, fps
|
return scene_list, fps
|
||||||
|
|
||||||
def get_video_resolution(video_path):
|
def get_video_resolution(video_path):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue