ffmpeg drawtext filter with zoom in effect

I am using draw text filter to display text on video.i need to add zoom in and zoom out filter on text. is there any command for zoom in and zoom out the text on video.

Upvotes: 0

Views: 2556

Answers (1)

llogan
llogan

Reputation: 133843

enter image description here

One method is to use ASS subtitles with the animated transform tag (\t):

{\an5\fscx0\fscy0\t(0,500,\fscx100\fscy100)}Text zoom
  • \an5 Center text
  • \fscx0 Set font x scale to 0%.
  • \fscy0 Set font y scale to 0%.
  • t(0,500,\fscx100\fscy100) In 500 milliseconds set \fscx and \fscy to 100%.

This is easy to do in Aegisub.

Then run your ffmpeg command using the subtitles filter.

ffmpeg -i input -filter_complex "subtitles=zoom.ass" output

Example ASS file where text will zoom in and then zoom out.

[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: None

[Aegisub Project Garbage]
Active Line: 1

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:03.00,Default,,0,0,0,,{\fscx0\fscy0\t(0,500,\fscx100\fscy100)}zoom text
Dialogue: 0,0:00:03.00,0:00:04.00,Default,,0,0,0,,{\fscx100\fscy100\t(0,500,\fscx0\fscy0)}zoom text

Upvotes: 3

Related Questions