Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,8 @@ for file in [INTRO_VIDEO, OUTRO_VIDEO, MUSIC_BG, EJEMPLO_VIDEO]:
|
|
| 25 |
# Configuraci贸n de chunks
|
| 26 |
CHUNK_SIZE = 60 # 1 minuto por chunk
|
| 27 |
SEGMENT_DURATION = 18 # Duraci贸n de cada segmento
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
def eliminar_archivo_tiempo(ruta, delay=1800):
|
| 31 |
def eliminar():
|
|
@@ -72,7 +73,7 @@ def create_slide_transition(clip1, clip2, duration=1):
|
|
| 72 |
clip1.fx(vfx.fadeout, duration).set_end(clip1.duration),
|
| 73 |
clip2.fx(vfx.fadein, duration)
|
| 74 |
.set_start(clip1.duration - duration)
|
| 75 |
-
.set_position(lambda t: ('center',
|
| 76 |
], size=(1280, 720))
|
| 77 |
|
| 78 |
return transition.set_duration(clip1.duration + duration)
|
|
@@ -98,16 +99,21 @@ async def procesar_video(video_input, texto_tts, voz_seleccionada):
|
|
| 98 |
audios.append(tts_audio.set_start(0).volumex(0.85))
|
| 99 |
audio_final = CompositeAudioClip(audios).set_duration(duracion_video)
|
| 100 |
|
| 101 |
-
# Dividir video en segmentos
|
| 102 |
segments = []
|
| 103 |
current_time = 0
|
| 104 |
while current_time < duracion_video:
|
| 105 |
end_time = current_time + SEGMENT_DURATION
|
| 106 |
if end_time > duracion_video:
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
# Asegurar que haya al menos un segmento
|
| 113 |
if not segments:
|
|
|
|
| 25 |
# Configuraci贸n de chunks
|
| 26 |
CHUNK_SIZE = 60 # 1 minuto por chunk
|
| 27 |
SEGMENT_DURATION = 18 # Duraci贸n de cada segmento
|
| 28 |
+
OVERLAP = 2 # Segundos a eliminar entre segmentos
|
| 29 |
+
TRANSITION_DURATION = 1 # Duraci贸n de la transici贸n slide
|
| 30 |
|
| 31 |
def eliminar_archivo_tiempo(ruta, delay=1800):
|
| 32 |
def eliminar():
|
|
|
|
| 73 |
clip1.fx(vfx.fadeout, duration).set_end(clip1.duration),
|
| 74 |
clip2.fx(vfx.fadein, duration)
|
| 75 |
.set_start(clip1.duration - duration)
|
| 76 |
+
.set_position(lambda t: ('center', 720 + (-720*(t/duration))))
|
| 77 |
], size=(1280, 720))
|
| 78 |
|
| 79 |
return transition.set_duration(clip1.duration + duration)
|
|
|
|
| 99 |
audios.append(tts_audio.set_start(0).volumex(0.85))
|
| 100 |
audio_final = CompositeAudioClip(audios).set_duration(duracion_video)
|
| 101 |
|
| 102 |
+
# Dividir video en segmentos CON manejo de overlap original
|
| 103 |
segments = []
|
| 104 |
current_time = 0
|
| 105 |
while current_time < duracion_video:
|
| 106 |
end_time = current_time + SEGMENT_DURATION
|
| 107 |
if end_time > duracion_video:
|
| 108 |
+
break # Terminar si ya no hay suficiente tiempo
|
| 109 |
+
|
| 110 |
+
# Extraer segmento eliminando 2 segundos al final
|
| 111 |
+
full_segment = video_original.subclip(current_time, end_time)
|
| 112 |
+
if segments and full_segment.duration >= OVERLAP:
|
| 113 |
+
full_segment = full_segment.subclip(0, full_segment.duration - OVERLAP)
|
| 114 |
+
|
| 115 |
+
segments.append(full_segment)
|
| 116 |
+
current_time += (SEGMENT_DURATION - OVERLAP)
|
| 117 |
|
| 118 |
# Asegurar que haya al menos un segmento
|
| 119 |
if not segments:
|