Package ws.schild.jave.filters
Class DrawtextFilter
java.lang.Object
ws.schild.jave.filters.Filter
ws.schild.jave.filters.DrawtextFilter
- All Implemented Interfaces:
VideoFilter
Add text to a video. An implementation of the drawtext filter from the FFMPEG Documentation.
https://write.corbpie.com/how-to-do-a-text-watermark-in-ffmpeg/ -vf "drawtext=text='a watermark':x=10:y=H-th-10:fontfile=/pathto/font.ttf:fontsize=10:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=2"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUsed to draw a box around text using the background color.setLineSpacing(Integer lineSpacing) Methods inherited from class ws.schild.jave.filters.Filter
addInputLabel, addNamedArgument, addOrderedArgument, addOutputLabel, escapingPath, getExpression, setQuoteCharacter
-
Constructor Details
-
DrawtextFilter
- Parameters:
text- The text string to be drawn. The text must be a sequence of UTF-8 encoded characters. This parameter is mandatory if no file is specified with the parameter textfile.posX- X Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".posY- Y Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".
-
DrawtextFilter
public DrawtextFilter(String text, String posX, String posY, String fontName, Double fontSize, Color fontColor) throws IllegalArgumentException - Parameters:
text- The text string to be drawn. The text must be a sequence of UTF-8 encoded characters. This parameter is mandatory if no file is specified with the parameter textfile.posX- X Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".posY- Y Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".fontName- The font family to be used for drawing text. By default Sans.fontSize- The font size to be used for drawing text. The default value of fontsize is 16.fontColor- The color to be used for drawing fonts. The default value of fontcolor is "black".- Throws:
IllegalArgumentException
-
DrawtextFilter
public DrawtextFilter(String text, String posX, String posY, File fontFile, Double fontSize, Color fontColor) throws IllegalArgumentException - Parameters:
text- The text string to be drawn. The text must be a sequence of UTF-8 encoded characters. This parameter is mandatory if no file is specified with the parameter textfile.posX- X Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".posY- Y Position of watermark text. The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. The default value of x and y is "0".fontFile- The font file to be used for drawing text. The path must be included. This parameter is mandatory if the fontconfig support is disabled.fontSize- The font size to be used for drawing text. The default value of fontsize is 16.fontColor- The color to be used for drawing fonts. The default value of fontcolor is "black".- Throws:
IllegalArgumentException
-
-
Method Details
-
setShadow
- Parameters:
shadowColor- Color of shadowshadowX- X Position of shadow, relative to textshadowY- Y Position of shadow, relative to text- Returns:
- this instance
-
setBox
Used to draw a box around text using the background color.- Parameters:
borderWidth- Set the width of the border to be drawn around the box using boxcolor. The default value of boxborderw is 0.color- The color to be used for drawing box around text. The default value of boxcolor is "white".- Returns:
- this instance.
-
setBorder
- Parameters:
borderWidth- Set the width of the border to be drawn around the text using bordercolor. The default value of borderw is 0.color- Set the color to be used for drawing border around text. The default value of bordercolor is "black".- Returns:
- this instance
-
setLineSpacing
- Parameters:
lineSpacing- Set the line spacing in pixels of the border to be drawn around the box using box. The default value of line_spacing is 0.- Returns:
- this instance
-