diff --git a/lib/video-canvas/smart-edit/render.ts b/lib/video-canvas/smart-edit/render.ts index bebb693c5..7f0e1ee53 100644 --- a/lib/video-canvas/smart-edit/render.ts +++ b/lib/video-canvas/smart-edit/render.ts @@ -88,7 +88,7 @@ export async function renderEditPlan( audio = `a${i}`; } await ffmpeg([ - ...normalized.flatMap((file) => ["-i", file]), + ...normalized.flatMap((file) => ["-threads", "2", "-i", file]), "-filter_complex", filters.join(";"), "-map", diff --git a/services/smart-edit/analyze.py b/services/smart-edit/analyze.py index d581e6af2..c8bc3fde0 100644 --- a/services/smart-edit/analyze.py +++ b/services/smart-edit/analyze.py @@ -41,6 +41,8 @@ def analyze(data): result={'scenes':[], 'active':[], 'subtitles':[], 'beats':[], 'warnings':[]} duration=data.get('duration',0) if data.get('video'): + import cv2 + cv2.setNumThreads(2) from scenedetect import detect,AdaptiveDetector result['scenes']=[[round(a.get_seconds()*1e6),round(b.get_seconds()*1e6)] for a,b in detect(data['video'],AdaptiveDetector(min_scene_len=15),start_in_scene=True)] or [[0,duration]] if data.get('audio'):