diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index bc51c7a..0000000 Binary files a/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/loop.cpython-312.pyc b/__pycache__/loop.cpython-312.pyc index cc73119..aa556aa 100644 Binary files a/__pycache__/loop.cpython-312.pyc and b/__pycache__/loop.cpython-312.pyc differ diff --git a/__pycache__/video.cpython-312.pyc b/__pycache__/video.cpython-312.pyc index 28eaadd..3293874 100644 Binary files a/__pycache__/video.cpython-312.pyc and b/__pycache__/video.cpython-312.pyc differ diff --git a/__pycache__/vram_node.cpython-312.pyc b/__pycache__/vram_node.cpython-312.pyc deleted file mode 100644 index 0970150..0000000 Binary files a/__pycache__/vram_node.cpython-312.pyc and /dev/null differ diff --git a/image.py b/image.py index 06db9dc..992ca49 100644 --- a/image.py +++ b/image.py @@ -129,8 +129,8 @@ class SessionImageSender: break if not found: - print(f" -> ⚠️ ALERTA: No se detectó rostro frontal en NINGÚN frame. Salvando el ciclo usando el frame 0 por defecto.") - best_idx = 0 + print(f" -> ⚠️ ALERTA: No se detectó rostro frontal en NINGÚN frame. Aceptando todo el lote para evitar bucles infinitos.") + best_idx = batch_size - 1 except Exception as e: print(f" -> ⚠️ Error en OpenCV al validar: {e}") else: diff --git a/loop.py b/loop.py index c13bf7c..230c74d 100644 --- a/loop.py +++ b/loop.py @@ -162,14 +162,16 @@ class AutoLoopCalculatorLTX: print(f" -> ⚖️ Sin caras detectadas. Forzando corte equitativo: {ideal_cut}") effective_chunk_frames = math.ceil((best_cut - current_pos) / select_every_nth) - # Forzar a 8n + 1 - effective_chunk_frames = ((effective_chunk_frames - 1) // 8) * 8 + 1 + + # Redondear siempre hacia ARRIBA al (8n + 1) más cercano + effective_chunk_frames = ((effective_chunk_frames + 6) // 8) * 8 + 1 if effective_chunk_frames < 9: effective_chunk_frames = 9 # Mínimo vital LTX - if current_pos + (effective_chunk_frames * select_every_nth) > safe_source_frame_count: - effective_chunk_frames = (safe_source_frame_count - current_pos) // select_every_nth + # ELIMINAMOS el recorte final que rompe la regla 8n + 1 + if current_pos + (effective_chunk_frames * select_every_nth) >= safe_source_frame_count: + print(f" -> 🏁 Chunk final LTX detectado. Ajustando a {effective_chunk_frames} frames para mantener regla 8n+1.") skip_frames = current_pos diff --git a/video.py b/video.py index 5a22473..07338ec 100644 --- a/video.py +++ b/video.py @@ -468,13 +468,18 @@ class AutoLoopCalculatorWan: # 4. Cálculo final del chunk consolidado effective_chunk_frames = math.ceil((best_cut - current_pos) / select_every_nth) - effective_chunk_frames = (effective_chunk_frames // 4) * 4 + + # Redondear siempre hacia ARRIBA al múltiplo de 4 más cercano para evitar chunks inválidos + effective_chunk_frames = ((effective_chunk_frames + 3) // 4) * 4 if effective_chunk_frames < 4: effective_chunk_frames = 4 - if current_pos + (effective_chunk_frames * select_every_nth) > safe_source_frame_count: - effective_chunk_frames = (safe_source_frame_count - current_pos) // select_every_nth + # ELIMINAMOS el recorte final que rompe el múltiplo de 4. + # Si pedimos más frames de los que quedan, VHS duplicará el último frame automáticamente, + # salvando así el renderizado sin crashear el 3D VAE. + if current_pos + (effective_chunk_frames * select_every_nth) >= safe_source_frame_count: + print(f" -> 🏁 Chunk final detectado. Ajustando a {effective_chunk_frames} frames para mantener múltiplo de 4.") skip_frames = current_pos