const { execFileSync } = require('child_process'); const fs = require('fs'); const path = require('path'); const ROOT = path.join(__dirname, '..', 'demo-videos'); const CHANNELS = [ { name: 'Tech Reviews', videos: ['Best Laptops of 2026', 'Phone Camera Comparison', 'Mechanical Keyboards Deep Dive', 'SSD vs HDD Speed Test'] }, { name: 'Cooking', videos: ['Homemade Pasta Night', 'Sourdough Basics', 'Street Food Tour', 'Weeknight Dinner Ideas'] }, { name: 'Travel Vlogs', videos: ['Lisbon in 3 Days', 'Mountain Cabin Adventure', 'City Street Food Hunt', 'Road Trip Highlights'] }, { name: 'Music Sessions', videos: ['Acoustic Cover Practice', 'Studio Session Recap', 'Live Performance Clip'] }, { name: 'Science Explained', videos: ['How Black Holes Form', 'The Human Brain, Visualized', 'Space Exploration Timeline', 'Quantum Computing Basics'] }, { name: 'Fitness', videos: ['10 Minute Full Body Routine', 'Morning Stretching Flow', 'Strength Training Guide'] }, ]; const COLORS = ['0x2b6cb0', '0x2f855a', '0x805ad5', '0xc05621', '0x0e7490', '0xb83280']; let total = 0; for (const ch of CHANNELS) { const dir = path.join(ROOT, ch.name); fs.mkdirSync(dir, { recursive: true }); ch.videos.forEach((title, i) => { const file = path.join(dir, `${i + 1}. ${title}.mp4`); if (fs.existsSync(file)) return; const dur = 6 + ((i * 3 + ch.name.length) % 10); const color = COLORS[(total + i) % COLORS.length]; const args = [ '-y', '-f', 'lavfi', '-i', `testsrc2=size=640x360:rate=24:duration=${dur}`, '-f', 'lavfi', '-i', `sine=frequency=${220 + i * 40}:duration=${dur}`, '-c:v', 'libx264', '-preset', 'ultrafast', '-crf', '30', '-c:a', 'aac', '-b:a', '96k', '-pix_fmt', 'yuv420p', file, ]; execFileSync('ffmpeg', args, { stdio: ['ignore', 'ignore', 'pipe'] }); // overlay channel name via drawtext if available (best effort) total++; }); } console.log(`Generated ${total} demo videos under ${ROOT}`);