/** * Analyze Video Handler * Downloads YouTube video via yt-dlp, extracts audio, transcribes via Whisper, * extracts frames per segment, describes each scene via Gemini 3 Flash vision * (per-scene; Phase-1 summary/style/cast still uses gpt-4o). * * Requires on the host machine: yt-dlp, ffmpeg, ffprobe, OPENAI_API_KEY * (Whisper + correction + Phase-1) and GEMINI_API_KEY (per-scene vision) env vars. */ import { AgentWebSocketClient } from './ws-client.js'; export interface AnalyzeVideoResult { source_title: string; duration_sec: number; language: string; transcript: string; summary: string; video_style: string; master_cast_prompt: string; characters: Array<{ name: string; description: string; }>; segments: Array<{ start: number; end: number; text: string; }>; scenes: Array<{ scene_number: number; timestamp_start: number; timestamp_end: number; thumbnail_base64: string; voiceover: string; visual_description: string; }>; stats?: { duration_ms: number; cost_usd: number; breakdown: Record; }; isError?: boolean; error?: string; } export declare function analyzeVideo(url: string, onProgress?: (step: string) => void): Promise; /** Extension task handler — wraps analyzeVideo with WS response + progress */ export declare function handleAnalyzeVideo(ws: AgentWebSocketClient, code: string, taskId: string, url: string): Promise;