Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -413,7 +413,15 @@ def create_subtitle_clip_pil(text, start_time, end_time, video_width, video_heig
|
|
413 |
y += line_heights[idx] + 5
|
414 |
|
415 |
img_np = np.array(img)
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
return txt_clip
|
418 |
|
419 |
except Exception as e:
|
|
|
413 |
y += line_heights[idx] + 5
|
414 |
|
415 |
img_np = np.array(img)
|
416 |
+
margin = int(video_height * 0.05)
|
417 |
+
txt_clip = (
|
418 |
+
ImageClip(img_np)
|
419 |
+
.set_start(start_time)
|
420 |
+
.set_duration(end_time - start_time)
|
421 |
+
.set_position(lambda clip: print(f"Clip size: {clip.size}") or ("center", video_height - clip.size[1] - margin))
|
422 |
+
.set_opacity(0.9)
|
423 |
+
)
|
424 |
+
|
425 |
return txt_clip
|
426 |
|
427 |
except Exception as e:
|