Update app.py
Browse files
app.py
CHANGED
|
@@ -342,8 +342,9 @@ def create_subtitle_clip_pil(text, start_time, end_time, video_width, video_heig
|
|
| 342 |
w = bbox[2] - bbox[0]
|
| 343 |
draw.text(((subtitle_width - w) // 2, y), line, font=font, fill="yellow")
|
| 344 |
y += line_heights[idx] + 5
|
| 345 |
-
|
| 346 |
-
|
|
|
|
| 347 |
return txt_clip
|
| 348 |
except Exception as e:
|
| 349 |
logger.error(f"\u274c Failed to create subtitle clip: {e}")
|
|
|
|
| 342 |
w = bbox[2] - bbox[0]
|
| 343 |
draw.text(((subtitle_width - w) // 2, y), line, font=font, fill="yellow")
|
| 344 |
y += line_heights[idx] + 5
|
| 345 |
+
|
| 346 |
+
img_np = np.array(img) # <- ✅ Fix: convert to NumPy
|
| 347 |
+
txt_clip = ImageClip(img_np).set_start(start_time).set_duration(end_time - start_time).set_position("bottom").set_opacity(0.8)
|
| 348 |
return txt_clip
|
| 349 |
except Exception as e:
|
| 350 |
logger.error(f"\u274c Failed to create subtitle clip: {e}")
|