ffmpeg moving text drawtext

佐手、 提交于 2019-11-28 02:17:53

Use

ffmpeg -i VideoInput.mp4 \
       -vf "drawtext=enable='between(t,12,14)':fontfile=myfont.otf:text='Test test': \
           x='x1+(x2-x1)*(t-t1)/(t2-t1)':y='y1+(y2-y1)*(t-t1)/(t2-t1)':fontsize=65" \
       -acodec copy outputVideo.mp4

where

x1 and y1 are initial co-ordinates; x2 and y2 are final co-ordinates; t1 and t2 are start and end times; in your given command, 12 and 14.

These above need to be replaced with their values in the command.


To give a 1 second stay at the end,

ffmpeg -i VideoInput.mp4 \
       -vf "drawtext=enable='between(t,12,15)':fontfile=myfont.otf:text='Test test': \
           x='if(lt(t-t2+1\,0)\,x1+(x2-x1)*(t-t1)/(t2-t1-1)\,x)': \
           y='if(lt(t-t2+1\,0)\,y1+(y2-y1)*(t-t1)/(t2-t1-1)\,y)':fontsize=65" \
       -acodec copy outputVideo.mp4

Here t2 includes the stay, so movement from 12 to 14 + 1 second hold. The t2 in enable is changed as well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!