3

I have the following FFMPEG command which correctly wipes text across the bottom of a video.

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 :expansion=normal:fontfile=foo.ttf: y=h-line_h-10:x=(5*n): fontcolor=white: fontsize=40: shadowx=2: shadowy=2" -an left_to_right_small.mp4

But this only happens once. How do I alter this so that the animation loops with a delay between each loop?

5

This works:

-vf "drawtext=text=string1 string2 string3 string4 string5 string6 string7 :expansion=normal:fontfile=foo.ttf: y=h-line_h-10:x=(mod(5*n\,w+tw)-tw): fontcolor=white: fontsize=40: shadowx=2: shadowy=2"

See Desmos for how it works.

Graph

x-axis is the video width.

y-axis is time.

The black line is the width of the image (adjustable in Desmos through a slider, x).

The black shade is the text in my formula.

t in Desmos corresponds to tw in FFmpeg CMD, which is the width of the text.

Blue area is the text in your original formula.

| improve this answer | |
  • Thats awesome! How would I set the number of loops? – Bachalo Feb 9 '15 at 2:29
  • @eco_bach It's not as easy as it looks. You can use an if. – Timothy Gu Feb 9 '15 at 2:33
  • @eco_bach actually it's doable: (if(lt(5*n/(w+tw)\,NUMBER_OF_LOOPS)\,mod(5*n\,w+tw)-tw\,w)). See Desmos – Timothy Gu Feb 9 '15 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.