2

I am using the following command to add watermark in my video using font TIMESNEWROMAN:

ffmpeg -i input.webm -vf "drawtext=text='© Krishna':fontfile=C//:/Windows/Fonts/times.ttf:x=(main_w-text_w-10):y=(main_h-text_h-10):fontsize=32:fontcolor=black:box=1:boxcolor=white@0.5: boxborderw=5" -preset ultrafast output.mp4

Now, I want to provide the font TIMESNEWROMAN or any other font instead of fontfile path. Is it possible to do that?

Avinash Modi
  • 81
  • 2
  • 8

1 Answers1

8

Use the font option

If your ffmpeg was compiled with --enable-libfontconfig you can use the font option. From the drawtext filter documentation:

font
The font family to be used for drawing text. By default Sans.

Example

ffmpeg -i input.webm -vf "drawtext=text='© Krishna':font='Times New Roman':x=(main_w-text_w-10):y=(main_h-text_h-10):fontsize=32:fontcolor=black:box=1:boxcolor=white@0.5:boxborderw=5" output.mp4

To check for libfontconfig support

To check if your ffmpeg has --enable-libfontconfig just run the ffmpeg command with no options and it will output the configuration. Then look for --enable-libfontconfig.

If you don't have libfontconfig

llogan
  • 121,796
  • 28
  • 232
  • 243
  • Hi @llogan, I didnt find any windows build [here](https://github.com/BtbN/FFmpeg-Builds/releases) which includes libfontconfig support. Is there any way to configure it? – Avinash Modi Dec 02 '20 at 09:04
  • @AvinashModi I downloaded `ffmpeg-N-100126-g0a5ff19643-win64-gpl.zip` from BtbN and it had `--enable-libfontconfig`. I tried it with `font` and it worked. – llogan Dec 02 '20 at 17:58
  • Thank you so much for you help, I got it. – Avinash Modi Dec 03 '20 at 05:14