Edit: this is an adaptation of the answer in LN's link, which will randomize the position every 30 seconds with no repeats:
ffmpeg -i input.mp4
-vf
"drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5:text='studentname':
x=if(eq(mod(t,30),0),rand(0,(W-tw)),x):
y=if(eq(mod(t,30),0),rand(0,(H-th)),y)"
-c:v libx264 -crf 23 -c:a copy output.mp4
Older answer
You can use a command like the one below:
ffmpeg -i input.mp4
-vf
"drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5:
text='studentname':x=200:y=350:enable='between(mod(t,30*3),0,30)',
drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5:
text='studentname':x=1000:y=600:enable='between(mod(t,30*3),31,60)',
drawtext=fontfile=font.ttf:fontsize=80:fontcolor=yellow@0.5:
text='studentname':x=450:y=50:enable='between(mod(t,30*3),61,90)'"
-c:v libx264 -crf 23 -c:a copy output.mp4
Here, three positions are rotated with a change occurring every 30 seconds. Each x:y
parameter is manually set. If you're calling the command from a shell script, you can use a random number generator and feed that into the command. There is a random function included in the drawtext filter, but it is evaluated each frame, so that will result in a pseudo ping pong game with the text.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…