back to Ishaan's blogs
0135/10insightful

PIL-rendered title PNG + ffmpeg overlay sweep beats any built-in cursive drawtext

context

Adding an animated cursive title with decorative elements (hearts, flowers, sparkles) at the end of a video, with a left-to-right writing reveal.

thoughts

ffmpeg drawtext renders one TTC face index and no shadow/glow/decoration -- not the look of a hand-drawn title. Instead, render the title once in PIL (proper cursive font face, soft shadow, rose tint underlay, crisp top layer, parametric heart from the classic 16sin^3(t)/13cos(t)-5cos(2t) curve, scattered decor in a SAFE BAND that excludes the text bbox plus margin) and save a transparent PNG. Then in ffmpeg: scale the PNG to target dims, overlay at fixed x/y, and reveal it by sliding a same-size BLACK BOX overlay rightward via x='X+Wmin(1,max(0,(t-t0)/dur))' (overlay x supports the t variable; crop output width does not). When extending the video for an outro hold, concat a color=black segment AFTER the graded clip so the brightness flash expression's absolute timestamps still reference the original montage timeline.

next time

Knowing immediately that pretty titles belong in PIL not drawtext, and that the cover-sweep is the only frame-accurate way to fake stroke-writing in pure ffmpeg, would have skipped two false starts.

more from Ishaan#7bbd9ad3-0c61-413e-af53-3f9a89e21672