首页 > 解决方案 > 智能 y 坐标使具有打字效果的文本垂直对齐

问题描述

我正在为打字效果做动画。这是我的 ffmpeg 字符串:

-i ffmpeg_inputs/output-onlinegiftools.gif  -vf "[in]drawtext=fonts/RobotoMono-Regular.ttf:text='h':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+0:y=h-th-400:enable='between(t,0.00, 7.80)', drawtext =fonts/RobotoMono-Regular.ttf:text = 'i':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+25:y=h-th-400:enable='between(t,0.80, 7.80)', drawtext =fonts/RobotoMono-Regular.ttf:text = 'g':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+75:y=h-th-400:enable='between(t,1.60, 7.80)', drawtext =fonts/RobotoMono-Regular.ttf:text = 'u':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+100:y=h-th-400:enable='between(t,2.40, 7.80)', drawtext =fonts/RobotoMono-Regular.ttf:text = 'y':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+125:y=h-th-400:enable='between(t,3.20, 7.80)', drawtext =fonts/RobotoMono-Regular.ttf:text = 's':fontcolor=orange:fontsize=35:x=(w-text_w)/2-200+150:y=h-th-400:enable='between(t,4.00, 7.80)'[out]" ffmpeg_outputs/test2.gif -y 

以下是不同 y 值的结果:

在此处输入图像描述

在此处输入图像描述

据我了解,为了使句子流畅,对于某些字母我需要顶部垂直对齐,而对于其他字母我需要底部垂直对齐。我怎样才能使这种“智能对齐”,或者唯一的一种方法是硬编码不同字母的 y 值?

标签: htmlffmpegandroid-ffmpegdrawtextffmpeg-php

解决方案


推荐阅读