1

I am using drawtext in FFMPEG kit to overlay text on an image. I want to increase the spacing between the letters (tracking). How to acheive this. I was only able to find line_spacing but couldnot find letter_spacing

Expected to increase the space or distance between each letters in a text

  • If you drop `DrawText` and use ASS subtitles instead, it has a format parameter `spacing` where you can define extra space (in pixels) between characters. It may be an option. http://www.tcax.org/docs/ass-specs.htm – Rolf of Saxony Apr 14 '23 at 10:44

1 Answers1

0

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.