Update app.py
Browse files
app.py
CHANGED
@@ -44,23 +44,27 @@ def process_video(video_path, caption="Your Caption"):
|
|
44 |
keywords_list = [kw[0] for kw in keywords]
|
45 |
|
46 |
# === 4. Burn Caption onto Video ===
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
)
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
text_clip = text_clip.set_position(("center", "bottom")).set_duration(clip.duration)
|
66 |
|
|
|
44 |
keywords_list = [kw[0] for kw in keywords]
|
45 |
|
46 |
# === 4. Burn Caption onto Video ===
|
47 |
+
try:
|
48 |
+
# Try to use font name if available on system
|
49 |
+
text_clip = TextClip(
|
50 |
+
caption,
|
51 |
+
fontsize=50,
|
52 |
+
color='white',
|
53 |
+
font="Noto-Sans-Devanagari", # Use system-registered font name (must be installed)
|
54 |
+
method='caption',
|
55 |
+
size=(clip.w, None)
|
56 |
+
)
|
57 |
+
except Exception as e:
|
58 |
+
print("TextClip fallback triggered:", str(e))
|
59 |
+
# Fallback: don't specify font at all
|
60 |
+
text_clip = TextClip(
|
61 |
+
caption,
|
62 |
+
fontsize=50,
|
63 |
+
color='white',
|
64 |
+
method='caption',
|
65 |
+
size=(clip.w, None)
|
66 |
+
)
|
67 |
+
|
68 |
|
69 |
text_clip = text_clip.set_position(("center", "bottom")).set_duration(clip.duration)
|
70 |
|