avisinth文本效果上下(想法下来?)

时间:2015-07-25 16:05:19

标签: avisynth

我写了一个脚本,将一些文字写入视频片段但效果尚不清楚它是如何工作的(但是有效)

        a=AVIFileSource("C:\downloads\FREE.avi")
#take file free.avi 
    ovText = "AviSynth Authors:"+chr(13)+
        \ "----------------------------"+chr(13)+

        \ ""
#variable ovText some text in
    c = 4000
# what shit is this c?
t_mask = messageclip(ovText, height=c).converttoyv12().coloryuv(levels="tv->pc").trim(0,1)
#and this? another variable

    t_blank = blankclip(t_mask, color=$ffffff)

    overlay(a, t_mask,x=199, mode="subtract")
    overlay(t_blank,x=200, mode="blend", mask=t_mask)

        frameevaluate("ol_x_offset = 400")
        frameevaluate("ol_y_offset = 256 - (current_frame)")

#this frameevaluate take current frame value and put it into overlays so y value became t value e position value. I have text that go up from frame 256   
    Crop(0,0,0,0,align=true)
    Spline36Resize(720,480)

现在我有一个视频,其中有一些文字会上升,现在我希望在结束一些想法时文字会下降?

1 个答案:

答案 0 :(得分:0)

在您的代码中c表示覆盖剪辑高度,它为文本中的大量行提供空间。然后,该剪辑在根据当前帧索引计算的垂直偏移处叠加在主视频剪辑上。

  

使用animatesubtitle这是一个更简单的方法:

ovText = "
AviSynth Authors:\n
----------------------------\n
"

AVIFileSource("C:\downloads\FREE.avi", pixel_type="YV12")

# scroll up
animate(0, 100, "showText",
\   ovText, width/2, height/2, 
\   ovText, width/2, -100)

# scroll down
animate(100, 200, "showText",
\   ovText, width/2, -100, 
\   ovText, width/2, height/2)

function showText(clip vid, string text, float x, float y) {
    vid.subtitle(text, x=x, y=y, size=20, text_color=$ffffff, align=5, lsp=1)
}