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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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
- txt_clip = ImageClip(img_np).set_start(start_time).set_duration(end_time - start_time).set_position(lambda clip: ("center", video_height - clip.size[1] - int(video_height * 0.05))).set_opacity(0.9)
 
 
 
 
 
 
 
 
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: