ffmpeg text watermark bottom left
Asked Answered
G

2

9

I have found out how ffmpeg can add image watermark at the bottom left of a video

ffmpeg -i "C:\test.mp4" -i "C:\test\watermark.png" -filter_complex "overlay=10:main_h-overlay_h-10" "C:\test-watermark.mp4"

but I am looking for a way to add text (white, 12px text, with black shadow to make the text readable) instead of an image. Can somebody help me?

Gynecic answered 2/8, 2016 at 16:53 Comment(0)
S
28

Use the drawtext filter.

ffmpeg -i "C:\test.mp4"
 -vf "drawtext=text='Place text here':x=10:y=H-th-10:
               fontfile=/path/to/font.ttf:fontsize=12:fontcolor=white:
               shadowcolor=black:shadowx=5:shadowy=5"
"C:\test-watermark.mp4"
Sheena answered 2/8, 2016 at 18:41 Comment(3)
Thank you for your help! It is working like a charm.Kaitlin
@Sheena Can you let us know how to write 2 line text using this. Have used drawbox as wellHypocycloid
underpop.online.fr/f/ffmpeg/help/drawtext.htm.gz for docClaudianus
V
0

Loop through all and watermark each file

    foreach ($f in Get-ChildItem){
$file_name=$f.Name.replace($f.Extension,"")
$file_ext=$f.Extension
$watermark_text='KARACHI AI - MEETUP # 16 | AI in Agriculture and Real Estate' 
ffmpeg -i $file_name$file_ext -vf "drawtext=text="$watermark_text":x=10:y=H-th-10:fontsize=40:fontcolor=white" -preset ultrafast $file_name"_WM"$file_ext}
Vezza answered 6/3, 2023 at 21:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.