16

I'm trying to create a video using ffmpeg but I can't get the text watermark on the bottom right corner. It appears on the middle of the video. How should I change the following command?

-vf drawtext="fontfile=C\\:/Windows/Fonts/Arial.ttf: \
text='Stack Overflow': fontcolor=white: fontsize=24: box=1: boxcolor=black: \
x=(w-text_w)/2: y=(h-text_h-line_h)/2"

1 Answer 1

43

Positions

  • Top left: x=0:y=0 (with 10 pixel padding x=10:y=10)
  • Top center: x=(w-text_w)/2:y=0 (with 10 px padding x=(w-text_w)/2:y=10)
  • Top right: x=w-tw:y=0 (with 10 px padding: x=w-tw-10:y=10)
  • Centered: x=(w-text_w)/2:y=(h-text_h)/2
  • Bottom left: x=0:y=h-th (with 10 px padding: x=10:y=h-th-10)
  • Bottom center: x=(w-text_w)/2:y=h-th (with 10 px padding: x=(w-text_w)/2:y=h-th-10)
  • Bottom right: x=w-tw:y=h-th (with 10 px padding: x=w-tw-10:y=h-th-10)

Full example (centered)

ffmpeg -i input.mp4 -vf "drawtext=text='Super User':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=24:fontcolor=white" -c:a copy output.mp4

See drawtext filter documentation for more info.

10
  • 2
    can we dynamically change text before recording each frame?
    – user924
    Jul 15, 2018 at 20:19
  • @user924 The text position or the text content?
    – llogan
    Jul 17, 2018 at 19:36
  • Text content. I want to record timestamp (yyyy-mm-dd hh-mm-ss)
    – user924
    Jul 18, 2018 at 6:12
  • @user924 See this answer.
    – llogan
    Jul 18, 2018 at 17:23
  • Thanks, @LordNeckbeard in person for helping me for most of my ffmpeg related queries. Have a great day! Jul 24, 2018 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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