如何使用带有FFMPEG的drawtext增加文本的行高?

我正在使用当前代码来创建包含多行文本的视频。执行时,我收到的视频由于缺少空间而垂直合并。如何添加行高空间?

ffmpeg -i videoInput.mp4 \
       -vf drawtext="./font/Roboto/Roboto-Bold.ttf: \
           text='testing text \ntesting text \ntesting text':\
           fontcolor=yellow:\
           fontsize=36:\
           box=1:\
           boxcolor=black@0.5: \
           boxborderw=160:\
           x=(w-text_w)/2:\
           y=(h-text_h)/2"\
    -codec:a copy \
    videoOutput.mp4
评论
yvero
yvero

To increase the line-height add a line_spacing parameter to the command,(http://ffmpeg.org/ffmpeg-filters.html#drawtext-1) So it looks like:

ffmpeg -i videoInput.mp4 \
       -vf drawtext="./font/Roboto/Roboto-Bold.ttf: \
           text='testing text \ntesting text \ntesting text':\
         line_spacing=30:\
           fontcolor=yellow:\
           fontsize=36:\
           box=1:\
           boxcolor=black@0.5: \
           boxborderw=160:\
           x=(w-text_w)/2:\
           y=(h-text_h)/2"\
    -codec:a copy \
    videoOutput.mp4

要么

一些技巧是在所需的文本上附加一个双折线。它看起来像这样:

  text='testing text **\n\n**testing text **\n\n**testing text'
ffmpeg -i videoInput.mp4 \
       -vf drawtext="./font/Roboto/Roboto-Bold.ttf: \
           text='testing text \n\ntesting text \n\ntesting text':\
           fontcolor=yellow:\
           fontsize=36:\
           box=1:\
           boxcolor=black@0.5: \
           boxborderw=160:\
           x=(w-text_w)/2:\
           y=(h-text_h)/2"\
    -codec:a copy \
    videoOutput.mp4
点赞
评论