gnosticdev commited on
Commit
a666288
·
verified ·
1 Parent(s): 00d8b3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -26
app.py CHANGED
@@ -118,39 +118,25 @@ async def procesar_video(video_input, texto_tts, voz_seleccionada):
118
  audio_original
119
  )
120
 
121
- # Redimensionar temporalmente el video a un tamaño muy grande (4000px de ancho)
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
- video_resized = video_temporal.resize(height=target_height)
128
-
129
- # Manejar márgenes si es necesario
130
- current_width = video_resized.w
131
- current_height = video_resized.h
132
- if current_width < target_width:
133
- # Agregar márgenes laterales
134
- margin_left = (target_width - current_width) // 2
135
- margin_right = target_width - current_width - margin_left
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 = video_final.set_audio(audio_final)
150
 
151
  # Concatenar intro + video + outro SIN alteraciones
152
  video_final = concatenate_videoclips(
153
- [intro, video_con_audio, outro],
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
  )