Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,39 +118,25 @@ async def procesar_video(video_input, texto_tts, voz_seleccionada):
|
|
| 118 |
audio_original
|
| 119 |
)
|
| 120 |
|
| 121 |
-
# Redimensionar
|
| 122 |
-
video_temporal = video_original.resize(width=4000)
|
| 123 |
-
|
| 124 |
-
# Redimensionar nuevamente al tamaño final deseado (1920x1080)
|
| 125 |
target_width = 1920
|
| 126 |
target_height = 1080
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
video_final = video_resized.margin(
|
| 137 |
-
left=margin_left,
|
| 138 |
-
right=margin_right,
|
| 139 |
-
color=(0, 0, 0) # Negro
|
| 140 |
-
)
|
| 141 |
-
else:
|
| 142 |
-
# Recortar horizontalmente si es más ancho que 1920
|
| 143 |
-
video_final = video_resized.crop(
|
| 144 |
-
x1=(current_width - target_width) // 2,
|
| 145 |
-
x2=current_width - (current_width - target_width) // 2
|
| 146 |
-
)
|
| 147 |
|
| 148 |
# Combinar video con audio
|
| 149 |
-
video_con_audio =
|
| 150 |
|
| 151 |
# Concatenar intro + video + outro SIN alteraciones
|
| 152 |
video_final = concatenate_videoclips(
|
| 153 |
-
[
|
| 154 |
method="compose", # Evitar problemas de grid
|
| 155 |
padding=0 # Sin espacio entre clips
|
| 156 |
)
|
|
|
|
| 118 |
audio_original
|
| 119 |
)
|
| 120 |
|
| 121 |
+
# Redimensionar todos los clips a 1920x1080
|
|
|
|
|
|
|
|
|
|
| 122 |
target_width = 1920
|
| 123 |
target_height = 1080
|
| 124 |
+
|
| 125 |
+
# Redimensionar intro
|
| 126 |
+
intro_resized = intro.resize((target_width, target_height))
|
| 127 |
+
|
| 128 |
+
# Redimensionar outro
|
| 129 |
+
outro_resized = outro.resize((target_width, target_height))
|
| 130 |
+
|
| 131 |
+
# Redimensionar video principal
|
| 132 |
+
video_resized = video_original.resize((target_width, target_height))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
# Combinar video con audio
|
| 135 |
+
video_con_audio = video_resized.set_audio(audio_final)
|
| 136 |
|
| 137 |
# Concatenar intro + video + outro SIN alteraciones
|
| 138 |
video_final = concatenate_videoclips(
|
| 139 |
+
[intro_resized, video_con_audio, outro_resized],
|
| 140 |
method="compose", # Evitar problemas de grid
|
| 141 |
padding=0 # Sin espacio entre clips
|
| 142 |
)
|