animationffmpegdrawtextvideo-subtitles

FFmpeg multiple drawtext filters next to each other


I would like to draw text on a video with ffmpeg that

What options do I have here? I know that when it comes to make some words bold within a line, I would better go with the subtitle filter. But as far as I know, I cannot animate subtitles, right?

That is why I am wondering whether I could use multiple drawtext filters next to each other. But how can I pass on the information of the width of one drawtext to the next one in order for it to match the correct coordinates?


Solution

  • Use the subtitles filter with ASS subtitles. The subtitles can be moved using the \move override tag:

    enter image description here

    Example ASS file:

    [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]
    Last Style Storage: Default
    
    [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,48,&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:05.00,Default,,0,0,0,,{\move(0,-10,320,350,0,2000)}Moving {\b1}text{\b0}{\move}