File size: 490 Bytes
1425afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from moviepy.editor import TextClip
from .config import FONT_PATH


def word_clip(word):

    duration = word["end"] - word["start"]

    clip = TextClip(
        word["text"],
        font=FONT_PATH,
        fontsize=80,
        color="white",
        stroke_color="black",
        stroke_width=4,
        method="caption",
        size=(900, None),
    )

    return (
        clip.set_start(word["start"])
        .set_duration(duration)
        .set_position(("center", "center"))
    )