I am using Moviepy to write text on videoclip. Without method=pango
it gives proper results
But when I use method=pango
it does not show the text and shows some unrecognizable characters
My textclip without pango looks like this:
(
TextClip(text_line.strip().upper(), font="URW-Bookman-Demi", fontsize=100, color='yellow')
.set_position(('center', 'center'))
.set_duration(end-start)
.set_start(start)
)
)
My textclip with pango looks like this:
(
TextClip(f'{text_line}<span foreground="#FF4567" background="black"><tt>{key}</tt></span>',
font="DejaVu Mono Sans", fontsize=100, color='yellow', method="pango")
.set_position(('center', 'center'))
.set_duration(end-start)
.set_start(start)
)
I want to have only a particular word colored, {key}
contains that word and {text_line}
is remaining sentence.
I'm running this in colab. Am I missing some dependencies? I'm installing following:
!apt update
!apt install -y libpango-1.0-0
!apt install -y libsdl-pango-dev
!apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0
!apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0
!apt install imagemagick
!apt install ffmpeg
!pip3 install moviepy
!sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
!pip install imageio
!pip install --upgrade imageio-ffmpeg
!pip install pycairo
!pip install PyGObject
Or is it the font? Or something else?