Carlos s commited on
Commit
c77141b
·
verified ·
1 Parent(s): 4362426

Update api/ltx_server.py

Browse files
Files changed (1) hide show
  1. api/ltx_server.py +6 -10
api/ltx_server.py CHANGED
@@ -428,16 +428,16 @@ class VideoService:
428
  i = 0
429
  end=1
430
  while i < n_chunks:
431
- start = end-1
432
  end += num_latente_por_chunk
433
  if end+2>=sum_latent:
434
  end = sum_latent-1
435
  i = n_chunks
436
  else:
437
  i += 1
438
- chunk = latents_brutos[:, :, start:end, :, :].clone()
439
  chunks.append(chunk)
440
- print(f"[DEBUG] chunk{i}[:, :, {start}:{end}, :, :] = {chunk.shape[2]}")
441
  else:
442
  print(f"[DEBUG] numero chunks minimo")
443
  print(f"[DEBUG] latents_brutos[:, :, :, :, :] = {latents_brutos.shape[2]}")
@@ -487,14 +487,12 @@ class VideoService:
487
  if i<total_partes-1:
488
  end_frame = self._get_total_frames(base) - poda
489
  else:
490
- print(f"[DEBUG] ultima iteracao")
491
  end_frame = self._get_total_frames(base)
492
 
493
  if i>0:
494
  start_frame = poda
495
  else:
496
  start_frame = 0
497
- print(f"[DEBUG] primeira iteracao")
498
 
499
  cmd_fim = (
500
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
@@ -511,7 +509,6 @@ class VideoService:
511
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
512
  f'-vf "trim=end_frame={poda},setpts=PTS-STARTPTS" -an "{video_fade_ini}"'
513
  )
514
- print(f"[DEBUG] video_fade_ini {i+1} ✅")
515
  subprocess.run(cmd_ini, shell=True, check=True)
516
 
517
  # --- TRANSIÇÃO ---
@@ -524,8 +521,7 @@ class VideoService:
524
  f'-frames:v {poda} "{video_fade}"'
525
  )
526
  subprocess.run(cmd_blend, shell=True, check=True)
527
- print(f"[DEBUG] transicao adicionada {i}/{i+1} {self._get_total_frames(video_fade)} frames ")
528
-
529
  nova_lista.append(video_fade)
530
 
531
  # --- FADE_FIM ---
@@ -535,10 +531,10 @@ class VideoService:
535
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
536
  f'-vf "trim=start_frame={end_frame-poda},setpts=PTS-STARTPTS" -an "{video_fade_fim}"'
537
  )
538
- print(f"[DEBUG] video_fade_fim {i+1} ✅")
539
  subprocess.run(cmd_fim, shell=True, check=True)
 
540
  nova_lista.append(video_podado)
541
- print(f"[DEBUG] Video podado {i+1} adicionado {self._get_total_frames(video_podado)} frames ")
542
 
543
 
544
 
 
428
  i = 0
429
  end=1
430
  while i < n_chunks:
431
+ start = end
432
  end += num_latente_por_chunk
433
  if end+2>=sum_latent:
434
  end = sum_latent-1
435
  i = n_chunks
436
  else:
437
  i += 1
438
+ chunk = latents_brutos[:, :, start-1:end+1, :, :].clone()
439
  chunks.append(chunk)
440
+ print(f"[DEBUG] chunk{i}[:, :, {start-1}:{end+1}, :, :] = {chunk.shape[2]}")
441
  else:
442
  print(f"[DEBUG] numero chunks minimo")
443
  print(f"[DEBUG] latents_brutos[:, :, :, :, :] = {latents_brutos.shape[2]}")
 
487
  if i<total_partes-1:
488
  end_frame = self._get_total_frames(base) - poda
489
  else:
 
490
  end_frame = self._get_total_frames(base)
491
 
492
  if i>0:
493
  start_frame = poda
494
  else:
495
  start_frame = 0
 
496
 
497
  cmd_fim = (
498
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
 
509
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
510
  f'-vf "trim=end_frame={poda},setpts=PTS-STARTPTS" -an "{video_fade_ini}"'
511
  )
 
512
  subprocess.run(cmd_ini, shell=True, check=True)
513
 
514
  # --- TRANSIÇÃO ---
 
521
  f'-frames:v {poda} "{video_fade}"'
522
  )
523
  subprocess.run(cmd_blend, shell=True, check=True)
524
+ print(f"[DEBUG] transicao adicionada {i}/{i+1} {self._get_total_frames(video_fade)} frames ")
 
525
  nova_lista.append(video_fade)
526
 
527
  # --- FADE_FIM ---
 
531
  f'ffmpeg -y -hide_banner -loglevel error -i "{base}" '
532
  f'-vf "trim=start_frame={end_frame-poda},setpts=PTS-STARTPTS" -an "{video_fade_fim}"'
533
  )
 
534
  subprocess.run(cmd_fim, shell=True, check=True)
535
+
536
  nova_lista.append(video_podado)
537
+ print(f"[DEBUG] Video podado {i+1} adicionado {self._get_total_frames(video_podado)} frames ")
538
 
539
 
540