0

How to watermark text on video sliding from right top to right bottom vertically?

This is my command:

ffmpeg -i /usr/home/test.mp4 -vf "drawbox=x=iw-42:y=0:w=42:h=ih:color=black@0.5:t=80,drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf:text='Hello World':fontcolor=white@1.0:fontsize=16: y=(mod(2*n\,h+th)-th):x=w-tw-10" -codec:v libx264 -codec:a copy -strict -2 /usr/home/out.mp4

please help me out

Chamath
  • 2,016
  • 2
  • 21
  • 30

1 Answers1

0

Well, this may not be the optimum method to do this. Still you can rotate video 90 degree counterclockwise, apply the text and rotate video 90 degree clockwise. These steps will result you the vertical text on the video.

  • Rotate video

You can use transpose or rotate to rotate the video clockwise and anticlockwise. Rotating videos with ffmpeg question has a good set of explanations regarding this.

  • Draw text

To add text to a video you can use drawtext filter. Document it self has a good explanation and set of examples which you can followup.

By using these two functions you can apply the text vertically. Following command will work for you.

ffmpeg -i input_video -filter_complex "
[0:v]transpose=2[anticlockwiserotated];
[anticlockwiserotated]drawtext=fontfile=font.ttf: text='Test Text':x=100: y=50: fontsize=36: fontcolor=white:[textapplied];
[textapplied]transpose=1" output_video

Here you need to use filter_complex which will apply the required filters and chain them accordingly. [0:v] refers to the first input source which is the video. Instead of font.ttf you have to use the absolute path to the font source.

Hope this helps!

Community
  • 1
  • 1
Chamath
  • 2,016
  • 2
  • 21
  • 30