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,6 +871,11 @@ 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 |
video_final.write_videofile(
|
875 |
output_path,
|
876 |
fps=24,
|
@@ -878,6 +883,10 @@ def crear_video(prompt_type, input_text, selected_voice, musica_file=None):
|
|
878 |
codec="libx264",
|
879 |
audio_codec="aac",
|
880 |
preset="medium",
|
|
|
|
|
|
|
|
|
881 |
logger='bar'
|
882 |
)
|
883 |
|
|
|
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 |
+
# A帽ade esto para forzar la resoluci贸n a 1920x1080
|
875 |
+
if video_final.size[0] != 1920 or video_final.size[1] != 1080:
|
876 |
+
logger.info(f"Redimensionando video de {video_final.size} a 1920x1080")
|
877 |
+
video_final = video_final.resize(newsize=(1920, 1080))
|
878 |
+
|
879 |
video_final.write_videofile(
|
880 |
output_path,
|
881 |
fps=24,
|
|
|
883 |
codec="libx264",
|
884 |
audio_codec="aac",
|
885 |
preset="medium",
|
886 |
+
ffmpeg_params=[
|
887 |
+
'-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2',
|
888 |
+
'-crf', '23'
|
889 |
+
],
|
890 |
logger='bar'
|
891 |
)
|
892 |
|