✏️ Compose Overlay Text
Lower-thirds, titles, and marquees — with position math that animates
- overlays
- overlays
MF_ComposeOverlayText puts text on top of a video inside MediaForge's Compose chain - titles, lower-thirds, episode markers, animated reveals. It's the drawtext node, but the design hides most of FFmpeg's sharp edges behind defaults that are actually good: the default position expression is "horizontally centered, 40px above the bottom edge," which is a ready-made lower-third.
The clever bit is that x_expr and y_expr are strings evaluated per-frame at encode time. That's what makes this node more than a text stamp. Position can be a function of t (timestamp), n (frame number), w/h (frame size), or text_w/text_h (the rendered text's own size - so centering stays correct when you change fontsize). A vertical bob, a fly-in, a marquee scroll - those are all just expressions. For the common cases there's an effect dropdown (slide_in_left|right|top|bottom, marquee_horizontal) that wraps the motion for you and treats your x_expr/y_expr as the resting anchor.
How it works
It appends a drawtext op to the MF_COMPOSE_OPS chain. Text is passed via textfile= internally, which is why apostrophes, %, and newlines don't blow up your filter graph. MF_ComposeVideo compiles the chain into the single-encode graph.
The inputs that matter
text- the words. Multiline is fine.x_expr/y_expr- position math. The defaults are(w-text_w)/2andh-text_h-40. Want top-left with padding?30/30. Center of screen?(w-text_w)/2/(h-text_h)/2.effect-noneuses your expressions verbatim;slide_in_*andmarquee_horizontaladd motion.effect_durationis the slide-in time (or seconds per marquee cycle).fontsize,fontcolor,borderw- size, color (FFmpeg name or#RRGGBBhex), outline.start_sec/end_sec- visibility window; both0= always visible.
Optional overlays chains upstream; output overlays feeds the next overlay or MF_ComposeVideo.
Install
Part of MediaForge:
cd ComfyUI/custom_nodes
git clone https://github.com/leon80148/comfyui_MediaForge.git
# restart ComfyUI
Or ComfyUI Manager → "MediaForge". Fonts come from the plugin's font/ folder; if it's empty, ComposeVideo falls back to a system font.
Common issues
The one real trap is expression syntax: an unclosed paren or a variable that doesn't exist fails at encode time, not when you type it. Start from the working defaults and make small edits. And remember text_w/text_h only exist once the filter runs - you can't preview them in a text box. If text overlaps UI you care about, the h-text_h-40 default accounts for the text's own height; changing fontsize keeps centering correct but may change the bottom offset visually. Emoji in text is a coin flip depending on font - use a font that has the glyphs, or it renders as tofu boxes.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Hello MediaForge | — |
| x_expr | STRING | (w-text_w)/2 | — |
| y_expr | STRING | h-text_h-40 | — |
| font | COMBO | (把 .ttf / .otf / .ttc 丟進 plugin/font/ 後重新整理) | 1 options: (把 .ttf / .otf / .ttc 丟進 plugin/font/ 後重新整理) |
| fontsize | INT | 368–300 | — |
| fontcolor | STRING | white | — |
| borderw | INT | 20–20 | — |
| bordercolor | STRING | black | — |
| effect | COMBO | none | 6 options: none, slide_in_left, slide_in_right, slide_in_top, slide_in_bottom, marquee_horizontal |
| effect_duration | FLOAT | 1.50.1–60 | — |
| start_sec | FLOAT | 0.00–36000 | — |
| end_sec | FLOAT | 0.00–36000 | — |
| overlaysopt | MF_COMPOSE_OPS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| overlays | MF_COMPOSE_OPS | — |