Bound per-input decoder and scene detection threads

This commit is contained in:
134 2026-09-17 16:41:31 +08:00
parent 9b78fbc9f7
commit 41e2db9ca7
2 changed files with 3 additions and 1 deletions

View File

@ -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",

View File

@ -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'):