#!/usr/bin/env python3 """ EXTRACTOR DE MUERTES - CON TIMESTAMPS MANUALES ============================================== Instrucciones: 1. Ir a https://www.op.gg/summoners/euw/XOKAS%20THE%20KING-KEKY 2. Buscar los 3 juegos del stream (18 Feb 2026) 3. Para cada juego, anotar los timestamps de muertes (en minutos:segundos) 4. Pegar los datos abajo en formato: JUEGO 1: 41:06, 43:15, 47:30 JUEGO 2: 52:29, 72:23, 80:30, 84:36 JUEGO 3: 100:00, etc. 5. Ejecutar este script """ import subprocess import os from datetime import timedelta VIDEO = "stream_2699641307_1080p60.mp4" OUTPUT = "highlights_muertes_finales" # ========================================== # PEGAR TIMESTAMPS AQUÍ (formato min:seg) # ========================================== TIMESTAMPS_MANUALES = """ JUEGO 1: 41:06 43:15 47:30 JUEGO 2: 52:29 72:23 80:30 84:36 JUEGO 3: 100:00 """ def parse_time(time_str): """Convierte min:seg a segundos totales""" parts = time_str.strip().split(":") if len(parts) == 2: return int(parts[0]) * 60 + int(parts[1]) return int(parts[0]) def extract_clip(timestamp, numero, juego): """Extrae clip de muerte""" start = max(0, timestamp - 10) duration = 20 # 10s antes + 10s después output = f"{OUTPUT}/muerte_{numero:02d}_juego{juego}_{timestamp}s.mp4" cmd = [ "ffmpeg", "-y", "-ss", str(start), "-t", str(duration), "-i", VIDEO, "-c:v", "h264_nvenc", "-preset", "fast", "-cq", "23", "-r", "60", "-c:a", "copy", output, ] try: subprocess.run(cmd, capture_output=True, timeout=120, check=True) return output except: return None def main(): print("=" * 70) print("EXTRACTOR DE MUERTES - TIMESTAMPS MANUALES") print("=" * 70) print() # Parsear timestamps timestamps = [] juego_actual = 0 for line in TIMESTAMPS_MANUALES.strip().split("\n"): line = line.strip() if not line: continue if "JUEGO" in line: juego_actual = int(line.split()[1].replace(":", "")) print(f"Juego {juego_actual} encontrado") elif ":" in line: try: ts = parse_time(line) timestamps.append( {"timestamp": ts, "juego": juego_actual, "original": line} ) except: pass if not timestamps: print("❌ No se encontraron timestamps válidos") print("Edita el archivo y agrega timestamps en formato min:seg") return print(f"\n✓ {len(timestamps)} muertes encontradas") print() # Extraer clips os.makedirs(OUTPUT, exist_ok=True) clips = [] for i, ts in enumerate(timestamps, 1): print(f"[{i}/{len(timestamps)}] Juego {ts['juego']} - {ts['original']}") clip = extract_clip(ts["timestamp"], i, ts["juego"]) if clip: size = os.path.getsize(clip) / (1024 * 1024) print(f" ✓ {size:.1f}MB") clips.append(clip) else: print(f" ✗ Error") # Concatenar if clips: print("\n" + "=" * 70) print("CREANDO VIDEO FINAL") print("=" * 70) concat = "/tmp/concat_final.txt" with open(concat, "w") as f: for c in clips: f.write(f"file '{os.path.abspath(c)}'\n") final = "HIGHLIGHTS_MUERTES_FINAL.mp4" cmd = [ "ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", concat, "-c:v", "h264_nvenc", "-preset", "medium", "-cq", "20", "-r", "60", "-c:a", "aac", "-b:a", "128k", final, ] subprocess.run(cmd, capture_output=True, timeout=300, check=True) size = os.path.getsize(final) / (1024 * 1024) print(f"✓ Video final: {final}") print(f" Tamaño: {size:.1f}MB") print(f" Muertes: {len(clips)}") print(f" Duración: ~{len(clips) * 20 // 60}m {len(clips) * 20 % 60}s") print("\n" + "=" * 70) print("✓ COMPLETADO") print("=" * 70) if __name__ == "__main__": main()