Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,14 +34,14 @@ def process_video(text):
|
|
34 |
start_time = random.uniform(0, max(0, video.duration - 60))
|
35 |
video = video.subclip(start_time, min(start_time + 60, video.duration))
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
video = video.crop(
|
45 |
|
46 |
text_lines = text.split()
|
47 |
text = "\n".join([" ".join(text_lines[i:i+8]) for i in range(0, len(text_lines), 8)])
|
|
|
34 |
start_time = random.uniform(0, max(0, video.duration - 60))
|
35 |
video = video.subclip(start_time, min(start_time + 60, video.duration))
|
36 |
|
37 |
+
# Resize the video to have a width of 1080 while keeping the aspect ratio
|
38 |
+
new_width = 1080
|
39 |
+
new_height = int(video.h * (new_width / video.w))
|
40 |
+
video = video.resize(width=new_width)
|
41 |
+
|
42 |
+
# Crop the video to a 9:16 aspect ratio
|
43 |
+
target_height = 1920
|
44 |
+
video = video.crop(y_center=video.h / 2, height=target_height)
|
45 |
|
46 |
text_lines = text.split()
|
47 |
text = "\n".join([" ".join(text_lines[i:i+8]) for i in range(0, len(text_lines), 8)])
|