1

I have the following FFMPEG command which simply wipes text from left to right.
What I am trying to do is determine the total width of the text string so I can subtract this amount from the x position value, starting it off stage left.
Since this is determined by both the font size and the actual font used I am guessing this is impossible to determine accurately...but is there a way to fudge this ?

ffmpeg -y -i test_small.mov -acodec libmp3lame -vcodec libx264 -pix_fmt yuv420p -b:a 192k -b:v 1400k -ar 44100 -crf 18 -vf "drawtext=text=string1 string2 string3 string4 string5 string6 string7 :fontfile=foo.ttf: y=h-line_h-10:x=(2*n): fontcolor=white: fontsize=40: shadowx=2: shadowy=2" -an left_to_right_small.mp4
1
  • Note that your command uses -an while also specifying an audio codec. Your output will have no audio.
    – slhck
    Feb 7, 2015 at 22:13

1 Answer 1

4

Use tw. From the drawtext filter documentation:

text_w, tw
the width of the rendered text

Using your example you would simply add: x=(2*n)-tw

3
  • Duh, I was completely ignoring that for some reason.
    – slhck
    Feb 8, 2015 at 7:21
  • @slhck I learn (or forget) something new with just about every question.
    – llogan
    Feb 8, 2015 at 10:17
  • ditto, learn something every time I use FFMPEG
    – Bachalo
    Feb 8, 2015 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .