qqwjq1981 commited on
Commit
a332ef9
·
verified ·
1 Parent(s): df8571d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -414,11 +414,13 @@ def create_subtitle_clip_pil(text, start_time, end_time, video_width, video_heig
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
 
 
414
 
415
  img_np = np.array(img)
416
  margin = int(video_height * 0.05)
417
+ img_clip = ImageClip(img_np) # Create the ImageClip first
418
+ image_height = img_clip.size[1]
419
  txt_clip = (
420
+ img_clip # Use the already created clip
421
  .set_start(start_time)
422
  .set_duration(end_time - start_time)
423
+ .set_position(("center", video_height - image_height - margin))
424
  .set_opacity(0.9)
425
  )
426