this is not an answer, but only a workaround:
#!/bin/bash
echo "<style>
body {
background: #ff00ff;
}
div {
border: 2px solid red;
width: 90%
}
p {
display: table;
margin: 0 auto;
border: 2px solid blue;
font-size: 50px;
letter-spacing: 25px;
}</style>
<div>
<p>Test line 1
<p>Line test 2
<p>❤️
</div>" > /tmp/text.html
chromium --headless --screenshot="/tmp/text.png" --window-size=1280,720 /tmp/text.html
magick mogrify -trim /tmp/text.png
ffmpeg \
-ss 2 -to 9 -i "input 1.mp4" \
-loop 1 -i /tmp/text.png \
-filter_complex "
[1]colorkey=#ff00ff:0.00001[b];
[0][b]overlay=(W-w)/2:(H-h)/2:shortest=1
" -c:a copy /tmp/output.mp4
mpv /tmp/output.mp4
Chromium based browser does screenshot of html file. Imagemagick mogrify is not required. It can be removed.