position text on bottom right corner

6

4

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"

Alex Levi

Posted 2015-07-11T17:50:40.607

Reputation: 61

Answers

15

bottom right

Bottom right

x=w-tw:y=h-th

Bottom right with 10 pixel padding

Bottom right with 10 pixel padding

x=w-tw-10:y=h-th-10

top right

Top right

x=w-tw

Top right with 10 pixel padding

x=w-tw-10:y=10

top left

Top left

x=0:y=0

This is also the default so you can alternatively just omit x and y.

Top left with 10 pixel padding

x=10:y=10

bottom left

Bottom left

y=h-th

Bottom left with 10 pixel padding

x=10:h-th-10

Centered

centered

x=(w-text_w)/2:y=(h-text_h)/2

Full example

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

Also see

llogan

Posted 2015-07-11T17:50:40.607

Reputation: 31 929

2can we dynamically change text before recording each frame? – user924 – 2018-07-15T20:19:06.163

@user924 The text position or the text content? – llogan – 2018-07-17T19:36:44.927

Text content. I want to record timestamp (yyyy-mm-dd hh-mm-ss) – user924 – 2018-07-18T06:12:55.197

@user924 See this answer.

– llogan – 2018-07-18T17:23:04.137

Thanks, @LordNeckbeard in person for helping me for most of my ffmpeg related queries. Have a great day! – Killer – 2018-07-24T06:55:36.430

Failed to inject frame into filter network: Invalid argument -filter_complex "pad=height=ih-40:color=#71cbf4,overlay=x=w-tw-10:y=h-th-10" – Jamie Hutber – 2019-06-18T22:58:39.883

@JamieHutber There are too many things wrong with your command to fix it in a comment. You should make a new question. Make sure to show your full command and also include the complete log from the command. – llogan – 2019-06-18T23:28:22.000

Thanks very much Logan for the very fast reply. I have managed to get it into the top right overlay=x=(main_w-overlay_w)-30:y=(main_h-overlay_h)/(main_h-overlay_h)+30 I will raise a quesiton now – Jamie Hutber – 2019-06-18T23:32:53.193