false,'error'=>'need 2+ screenshots']); exit; } $list = "/tmp/ffmpeg-list-".uniqid().".txt"; $f = ''; foreach ($ss as $s) $f .= "file '$s'\nduration 2\n"; file_put_contents($list, $f); $cmd = "ffmpeg -y -f concat -safe 0 -i $list -vf 'scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2' -c:v libx264 -pix_fmt yuv420p -t 20 $out 2>&1 | tail -1"; $r = trim(shell_exec($cmd)); $ok = file_exists($out) && filesize($out) > 1000; echo json_encode(['ok'=>$ok,'video'=>"/generated/$name",'frames'=>count($ss),'engine'=>'ffmpeg']);