Update deformes4D_engine.py
Browse files- deformes4D_engine.py +3 -23
deformes4D_engine.py
CHANGED
|
@@ -242,28 +242,8 @@ class Deformes4DEngine:
|
|
| 242 |
gc.collect()
|
| 243 |
torch.cuda.empty_cache()
|
| 244 |
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
progress(current_step / TOTAL_STEPS, desc="Gerando trilha sonora...")
|
| 248 |
-
try:
|
| 249 |
-
# Assume que seu audio_specialist tem um método que retorna o caminho do áudio
|
| 250 |
-
audio_path = audio_specialist_singleton.generate_standalone_audio(
|
| 251 |
-
prompt=global_prompt,
|
| 252 |
-
duration_seconds=self._get_video_duration(refined_silent_video_path),
|
| 253 |
-
output_dir=self.workspace_dir
|
| 254 |
-
)
|
| 255 |
-
|
| 256 |
-
refined_video_with_audio_path = os.path.join(self.workspace_dir, f"{base_name}_refined_with_audio.mp4")
|
| 257 |
-
self._combine_video_and_audio_ffmpeg(refined_silent_video_path, audio_path, refined_video_with_audio_path)
|
| 258 |
-
logger.info(f"Primeira masterização com áudio salva em: {refined_video_with_audio_path}")
|
| 259 |
-
# Você pode opcionalmente retornar este vídeo aqui como uma prévia
|
| 260 |
-
# yield {"preview_path": refined_video_with_audio_path}
|
| 261 |
-
except Exception as e:
|
| 262 |
-
logger.error(f"Falha na geração ou combinação de áudio: {e}. Prosseguindo sem áudio.")
|
| 263 |
-
audio_path = None # Garante que a variável exista
|
| 264 |
-
refined_video_with_audio_path = refined_silent_video_path # Usa o vídeo silencioso como fallback
|
| 265 |
-
|
| 266 |
-
# --- ATO III: MASTERIZAÇÃO FINAL (APLICAÇÃO DE HD) ---
|
| 267 |
current_step += 1
|
| 268 |
progress(current_step / TOTAL_STEPS, desc="Aprimoramento final (HD)...")
|
| 269 |
hq_silent_video_path = os.path.join(self.workspace_dir, f"{base_name}_hq_silent.mp4")
|
|
@@ -291,7 +271,7 @@ class Deformes4DEngine:
|
|
| 291 |
# os.rename(hq_silent_video_path, final_video_path)
|
| 292 |
|
| 293 |
logger.info(f"Processo concluído! Vídeo final salvo em: {hq_silent_video_path}")
|
| 294 |
-
yield {"final_path":
|
| 295 |
|
| 296 |
def refine_latents(self, latents: torch.Tensor,
|
| 297 |
fps: int = 24,
|
|
|
|
| 242 |
gc.collect()
|
| 243 |
torch.cuda.empty_cache()
|
| 244 |
|
| 245 |
+
|
| 246 |
+
# --- ATO II: MASTERIZAÇÃO FINAL (APLICAÇÃO DE HD) ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
current_step += 1
|
| 248 |
progress(current_step / TOTAL_STEPS, desc="Aprimoramento final (HD)...")
|
| 249 |
hq_silent_video_path = os.path.join(self.workspace_dir, f"{base_name}_hq_silent.mp4")
|
|
|
|
| 271 |
# os.rename(hq_silent_video_path, final_video_path)
|
| 272 |
|
| 273 |
logger.info(f"Processo concluído! Vídeo final salvo em: {hq_silent_video_path}")
|
| 274 |
+
yield {"final_path": hq_silent_video_path}
|
| 275 |
|
| 276 |
def refine_latents(self, latents: torch.Tensor,
|
| 277 |
fps: int = 24,
|