TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
[SAI]031_killmebabyED
[打印本页]
作者:
saiyaku
时间:
2012-1-8 13:31:09
标题:
[SAI]031_killmebabyED
預覽:
http://pan.baidu.com/s/1hqqY9CC#dir/path=%2FSaiyakuFX_Preview
from tcaxPy import *
from util.tcAudio import *
def tcaxPy_Init():
# some common pre-defined global values
global fontSize # as name implies
global resX # horizontal resolution
global resY # vertical resolution
global marginX # horizontal margin
global marginY # vertical margin
global spacing # space between texts
global frameDur # milliseconds per frame
global lineNum # number of lines
global textNum # textNum[i], number of texts in ith line
global _BT # _BT[i], start time of a line
global _ET # _ET[i], end time of a line
global _KT # _KT[i][j], karaoke time of a syllable
global _SK # _SK[i][j], elapsed karaoke time before reaching a certain syllable
global _TXT # _TXT[i][j], as name implies
global _L # _L[i], total width of a line
global _W # _W[i][j], width of a text
global _H # _H[i][j], height of a text
global _A # _A[i][j], advance of a text, usually larger than width
global _AD # _AD[i][j], distance between the current text to the first text of the line
fontSize = GetVal(val_FontSize)
resX = GetVal(val_ResolutionX)
resY = GetVal(val_ResolutionY)
marginX = GetVal(val_OffsetX)
marginY = GetVal(val_OffsetY)
spacing = GetVal(val_Spacing)
frameDur = 1000 / GetVal(val_FXFPS)
lineNum = GetVal(val_nLines)
textNum = GetVal(val_nTexts)
_BT = GetVal(val_BegTime)
_ET = GetVal(val_EndTime)
_KT = GetVal(val_KarTime)
_SK = GetVal(val_KarTimeDiff)
_TXT = GetVal(val_Text)
_L = GetVal(val_TextLength)
_W = GetVal(val_TextWidth)
_H = GetVal(val_TextHeight)
_A = GetVal(val_TextAdvance)
_AD = GetVal(val_TextAdvanceDiff)
def randi():
if randint(0,1)==0:
return -1
else:
return 1
def med(fft):
X = 0
for i in range(100,200):
X += fft[i]
return X/100
def beat(F):
global BEAT
BEAT = []
BEAT.append(255)
for a in range(len(F)-1):
if int(abs(F[a+1] - F[a])*100000)> 240:
BEAT.append(3.5)
elif int(abs(F[a+1] - F[a])*100000)< 180 :
BEAT.append(1)
else:
BEAT.append(0.5+((255-abs(F[a+1] - F[a])*100000)/255)*5)
return BEAT
def tcaxPy_User():
file_name = GetVal(val_OutFile) + '.ass'
ass_header = GetVal(val_AssHeader)
ASS_FILE = CreateAssFile(file_name, ass_header)
tcAudioInit()
channel = tcAudioOpen('test.mp3')
freq = tcAudioGetFreq(channel) # usually 44100 Hz
duration = tcAudioGetDuration(channel)
num = int(duration * freq / 2048)
global F
F = []
for k in range(num):
fft = tcAudioGetFFT(channel, 2048)
F.append(med(fft))
B = beat(F)
CLR1 = color1("FFFFFF")+color3("000000") + alpha1(0)
CLR2 = color1("000000")+color3("000000") + alpha1(30)
for i in range(lineNum):
initPosX = (resX - _L[i]) / 2 + marginX # if marginX = 0, then it's just on the middle
initPosY = marginY
for j in range(textNum[i]):
ASS_BUF = []
if _TXT[i][j] == '' or _TXT[i][j] == ' ' or _TXT[i][j] == ' ':
continue
posX = initPosX + _AD[i][j] + _A[i][j] / 2
posY = initPosY + 19
ass_main(ASS_BUF, SubL(_BT[i]+j*5, _BT[i]+_SK[i][j]-10, 10),fad(100,0)+ an(5) + pos(posX, posY) + CLR1+bord(1)+shad(0.5) ,_TXT[i][j] )
ass_main(ASS_BUF, SubL(_BT[i]+_SK[i][j]-10, _ET[i]+j*5, 30),fad(0,100)+ an(5) + pos(posX, posY) +t(0,30,fsc(150,150)) +t(30,_KT[i][j]*10,fsc(100,100))+ CLR1+bord(1)+shad(0.5) ,_TXT[i][j] )
for m in range(num):
R=[(0,1),(0,-1),(1,0),(-1,0),(0,-1),(0,1),(-1,0),(1,0),(0,-1),(0,1),(randi(),randi()),(randi(),randi()),(0,1),(-1,0),(1,0),(-1,0),(1,0)]
start = m * 100 * 2048 / freq
end = (m + 1) * 100 * 2048 / freq
if start > _BT[i]+j*5 and end <_ET[i]+j*5:
ass_main(ASS_BUF, SubL(start-3, end, 20), fad(40,40)+ an(5) + pos(posX+B[m]*R[i][0], posY+B[m]*R[i][1])+blur(1.5) + CLR2, _TXT[i][j])
WriteAssFile(ASS_FILE, ASS_BUF) # write the buffer in memory to the file
Progress(i,j)
tcAudioFin()
FinAssFile(ASS_FILE)
复制代码
killmebabyED.zip
(2.35 MB, 下载次数: 3407)
2012-1-8 13:29:22 上传
下载次数: 3407
附件:
killmebabyED.zip
(2012-1-8 13:29:22, 2.35 MB) / 下载次数 3407
http://tcax.org/forum.php?mod=attachment&aid=MTg5fGI4ZjZjYThkfDE3MzI0MTM2NzZ8MHww
作者:
milkyjing
时间:
2012-1-8 15:52:59
补上预览,
http://www.tcax.org/forum.php?mod=viewthread&tid=44
文件名: [SAI]031_killmebabyED.mp4
p.s. 哪天完成了Beat Detection算法再升级吧...
作者:
593907
时间:
2012-1-9 09:30:33
感谢分享!
作者:
5231251
时间:
2012-1-14 00:26:53
2012-1-14 00:26:44 上传
下载附件
(66.19 KB)
图片附件:
031.jpg
(2012-1-14 00:26:44, 66.19 KB) / 下载次数 1827
http://tcax.org/forum.php?mod=attachment&aid=MTkxfDUzYmRjMmFkfDE3MzI0MTM2NzZ8MHww
作者:
lijingjie
时间:
2012-1-14 11:01:05
5231251 发表于 2012-1-14 00:26
你需要先安装tcAudio模块。TCAX1.0.0并未包含此模块。请到下面的帖子中下载。
TCAX音频处理模块tcAudio Beta版发布
作者:
hlc103
时间:
2012-2-12 20:56:38
本帖最后由 hlc103 于 2012-2-12 20:57 编辑
用视频可以看到.但是mp3不知如何看到效果.用哪种软件播放mp3啊
作者:
milkyjing
时间:
2012-2-12 23:57:28
hlc103 发表于 2012-2-12 20:56
用视频可以看到.但是mp3不知如何看到效果.用哪种软件播放mp3啊
不是使用avs来预览的么?
作者:
saiyaku
时间:
2012-2-13 17:09:40
我記得包裡丟了avs了
VSfilter 自己掛一下就好
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2