試了一個
http://apr20.imghost.us/jwenma.jpg (範例圖)
用 (CPU)AMD XP2000+ 可以跑得很順
以下是 截錄於個人Avisynth Application Batch之部分功能
所以看起來會有點複雜,但有混音的功能,使用時只需填PIP函數各參數即可
=線上下文存成任意 .avs 即可
inukami_OP.avi 是母畫面
inukami_ED.avi 是子畫面
,請根據自己用的檔案修改
=========================
A=avisource("inukami_OP.avi", pixel_type="YUY2")
B=avisource("inukami_ED.avi", pixel_type="YUY2")
return PIP(A, B, -1, -1, 6, 10, "add")
#EX: PIP(PlayClip, sClip, X, Y, W_H, Sub_volume, mux_mode) #子母畫面
Function PIP (Clip MainP, Clip sClip, Int X, Int Y, Int W_H, Int Sub_volume, String mux_mode) {
## <設定>
# sClip [子畫面]
# W_H [子畫面大小] {EX:6 表示 "六分之一" 1/6=0.166}
# Sub_volume[子畫面靜音] {EX:0 表示 Yes / EX:不等於零:音量(正常範圍1~100)}
temp = 1/Float(W_H)
Sub_volume = (Sub_volume >= 100)? 1.1 : ((Sub_volume <= 0)?0: (1+(Sub_volume/1000.0)))
W = Int(MainP.width * temp)
H = Int(MainP.height * temp)
X = (X<0)? Int(MainP.width -W -(W*temp)) : X
Y = (Y<0)? Int(MainP.height -H -(H*temp)) : Y
IsMute = RevisionTo_Bool(Int(Sub_volume))
## <程序腳本>
sClip = sClip.LanczosResize(W, H).ConvertToYUY2.ChangeFPS(MainP.framerate)
MainP = !IsYUY2(MainP) ? MainP.ConvertToYUY2 : MainP
MainP = IsMute ? AudioChannelIsTwo(MainP, "1,2", sClip, "1,2", Sub_volume) : MainP
return Layer(MainP, sClip, mux_mode, 255, X, Y)
}
Function RevisionTo_Bool (Int Change_Bool) {
Return_Bool = (Change_Bool <= 0) ? False : True
return Return_Bool
}
#EX: AudioChannelIsTwo(PlayClip1, "1,2", PlayClip2, "1,2", 1.3),兩Clip聲道一左一右
Function AudioChannelIsTwo(Clip m, String mch, Clip s, String sch, Float L_R) {
s = s.ResampleAudio(m.Audiorate)
#mdB = Float(Ceil(L_R))
#sdB = Float(Frac(L_R)*10)
mdB = Float(Int(L_R))
sdB = Float(Frac(L_R)*10)
l_ch = Eval("GetChannel(m," +mch +")")
r_ch = Eval("GetChannel(s," +sch +")")
#MergeChannels 會變成 4聲道、Audio Resample不變
#PlayAudio = MergeChannels(l_ch, r_ch).ResampleAudio(44100).Amplify(mdB, sdB)
PlayAudio = MixAudio(l_ch, r_ch, mdB, sdB)
return AudioDub(m, PlayAudio) #.Subtitle(string(mdB))
}