Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -55,15 +55,14 @@ def process_video(text):
|
|
55 |
|
56 |
selected_video = random.choice(video_files)
|
57 |
video = VideoFileClip(selected_video)
|
58 |
-
|
59 |
start_time = random.uniform(0, max(0, video.duration - 60))
|
60 |
video = video.subclip(start_time, min(start_time + 60, video.duration))
|
61 |
video = video.resize(height=1920).crop(x1=video.w // 2 - 540, x2=video.w // 2 + 540)
|
62 |
|
63 |
text_lines = text.split()
|
64 |
-
|
65 |
-
|
66 |
-
text_clip = TextClip(
|
67 |
text_clip = text_clip.set_position('center').set_duration(video.duration)
|
68 |
|
69 |
final = CompositeVideoClip([video, text_clip])
|
|
|
55 |
|
56 |
selected_video = random.choice(video_files)
|
57 |
video = VideoFileClip(selected_video)
|
|
|
58 |
start_time = random.uniform(0, max(0, video.duration - 60))
|
59 |
video = video.subclip(start_time, min(start_time + 60, video.duration))
|
60 |
video = video.resize(height=1920).crop(x1=video.w // 2 - 540, x2=video.w // 2 + 540)
|
61 |
|
62 |
text_lines = text.split()
|
63 |
+
text = "\n".join([" ".join(text_lines[i:i+8]) for i in range(0, len(text_lines), 8)])
|
64 |
+
|
65 |
+
text_clip = TextClip(text, fontsize=70, color='white', size=video.size, method='caption')
|
66 |
text_clip = text_clip.set_position('center').set_duration(video.duration)
|
67 |
|
68 |
final = CompositeVideoClip([video, text_clip])
|