Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -859,7 +859,7 @@ def crear_video(prompt_type, input_text, selected_voice, musica_file=None):
|
|
859 |
except Exception as e:
|
860 |
logger.warning(f"Error ajustando duraci贸n del audio final: {str(e)}")
|
861 |
|
862 |
-
|
863 |
logger.info("Renderizando video final...")
|
864 |
video_final = video_base.set_audio(final_audio)
|
865 |
|
@@ -871,10 +871,16 @@ def crear_video(prompt_type, input_text, selected_voice, musica_file=None):
|
|
871 |
output_path = os.path.join(temp_dir_intermediate, output_filename)
|
872 |
logger.info(f"Escribiendo video final a: {output_path}")
|
873 |
|
874 |
-
#
|
875 |
-
|
876 |
-
|
877 |
-
video_final
|
|
|
|
|
|
|
|
|
|
|
|
|
878 |
|
879 |
video_final.write_videofile(
|
880 |
output_path,
|
@@ -884,7 +890,7 @@ def crear_video(prompt_type, input_text, selected_voice, musica_file=None):
|
|
884 |
audio_codec="aac",
|
885 |
preset="medium",
|
886 |
ffmpeg_params=[
|
887 |
-
'-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:
|
888 |
'-crf', '23'
|
889 |
],
|
890 |
logger='bar'
|
|
|
859 |
except Exception as e:
|
860 |
logger.warning(f"Error ajustando duraci贸n del audio final: {str(e)}")
|
861 |
|
862 |
+
# 7. Crear video final
|
863 |
logger.info("Renderizando video final...")
|
864 |
video_final = video_base.set_audio(final_audio)
|
865 |
|
|
|
871 |
output_path = os.path.join(temp_dir_intermediate, output_filename)
|
872 |
logger.info(f"Escribiendo video final a: {output_path}")
|
873 |
|
874 |
+
# SOLUCI脫N CON INDENTACI脫N ORIGINAL:
|
875 |
+
try:
|
876 |
+
# M茅todo directo que evita ANTIALIAS
|
877 |
+
if hasattr(video_final, 'fx') and callable(getattr(video_final.fx, 'resize', None)):
|
878 |
+
video_final = video_final.fx.resize(width=1920, height=1080)
|
879 |
+
else:
|
880 |
+
from moviepy.video.fx.all import resize
|
881 |
+
video_final = resize(video_final, width=1920, height=1080)
|
882 |
+
except Exception as e:
|
883 |
+
logger.warning(f"No se pudo redimensionar: {str(e)}. Usando tama帽o original con escalado FFmpeg")
|
884 |
|
885 |
video_final.write_videofile(
|
886 |
output_path,
|
|
|
890 |
audio_codec="aac",
|
891 |
preset="medium",
|
892 |
ffmpeg_params=[
|
893 |
+
'-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black',
|
894 |
'-crf', '23'
|
895 |
],
|
896 |
logger='bar'
|