Technical Prompt and Demo Video:
Build an AI-powered tool that automatically detects and extracts viral-worthy clips from long videos.
Core Requirements:
Video Loading
// - Drag & drop or file picker for video files
// - Support: MP4, WebM, MOV
// - Load into hidden video element
// - Extract metadata: duration, resolution, fps
// - Generate thumbnail strip for timeline preview
Multi-Signal Detection
A) Audio Peak Detection
// - Create AudioContext, AnalyserNode
// - Calculate RMS energy per frame
// - Detect peaks: currentEnergy > avgEnergy * threshold
// - Store timestamps of all peaks
B) Motion Detection
// - Use canvas to capture frames at intervals
// - Compare pixel differences between frames
// - High difference = high motion
// - Detect sudden movements
C) Facial Detection (Bonus)
// - Use TensorFlow.js face-detection
// - Detect smiling faces (positive emotional moments)
// - Store timestamps with faces
Scoring Algorithm
// scoringFunction(timestamp) {
// audioScore = peaksNearby ? 2.0 : 1.0
// motionScore = motionLevel * 1.5
// faceScore = smilingFaces ? 1.5 : 1.0
// totalScore = audioScore * motionScore * faceScore
// return totalScore
// }
Clip Extraction
Configurable: min duration (5-30s), max duration (30-120s)
Merge overlapping high-score regions
Allow manual selection via timeline
Preview each clip before export
Export
Output format: MP4 (H.264)
Batch export all clips or selected
Progress indicator
Tech Stack:
Vanilla JavaScript
Canvas API (frame capture)
Web Audio API (audio analysis)
TensorFlow.js face-detection (optional)
FFmpeg.wasm or MediaRecorder (export)