Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,14 +17,14 @@ def merge_videos(video1_path, video2_path):
|
|
| 17 |
desired_height = 1280
|
| 18 |
desired_width = 720
|
| 19 |
|
| 20 |
-
# Comando ffmpeg
|
| 21 |
ffmpeg_cmd = (
|
| 22 |
-
f'ffmpeg -
|
| 23 |
f'-filter_complex '
|
| 24 |
-
f'"[0:v]
|
| 25 |
-
f'[1:v]
|
| 26 |
f'[v0][v1]vstack=inputs=2[v]" '
|
| 27 |
-
f'-map "[v]" -c:v
|
| 28 |
)
|
| 29 |
|
| 30 |
subprocess.run(ffmpeg_cmd, shell=True, check=True)
|
|
|
|
| 17 |
desired_height = 1280
|
| 18 |
desired_width = 720
|
| 19 |
|
| 20 |
+
# Comando ffmpeg ajustado para um meio termo entre qualidade e velocidade
|
| 21 |
ffmpeg_cmd = (
|
| 22 |
+
f'ffmpeg -i "{video1_path}" -i "{video2_path}" '
|
| 23 |
f'-filter_complex '
|
| 24 |
+
f'"[0:v]scale={desired_width}:{desired_height}:force_original_aspect_ratio=decrease,pad={desired_width}:{desired_height}:(ow-iw)/2:(oh-ih)/2[v0];'
|
| 25 |
+
f'[1:v]scale={desired_width}:{desired_height}:force_original_aspect_ratio=decrease,pad={desired_width}:{desired_height}:(ow-iw)/2:(oh-ih)/2[v1];'
|
| 26 |
f'[v0][v1]vstack=inputs=2[v]" '
|
| 27 |
+
f'-map "[v]" -c:v libx264 -preset medium -crf 21 {output_filename}'
|
| 28 |
)
|
| 29 |
|
| 30 |
subprocess.run(ffmpeg_cmd, shell=True, check=True)
|