View Single Post
Old 4th May 2013, 04:33   #25  |  Link
Keiyakusha
契約者
 
Keiyakusha's Avatar
 
Join Date: Jun 2008
Posts: 1,576
ok, here is function for video AND audio combined. All standard resolutions as input should work.
Probably needs some tweaking though, to make it look more like that thing on YT.
I wanted waveform to be around 30% of the video fingerprint height. Not sure if it is right or I failed basic math, or maybe I did some other mistake.
Code:
function fingerprint(clip source, int "fph"){
w=width(source)
v=crop(source,8,8,-8,-8)
v=bicubicresize(v,640,360)
calc=FrameRate(v)*w/Framecount(v)
v=Changefps(v,calc,linear=false).Trim(0,-w)
v=converttorgb32(v).bicubicresize(4,4).blur(0.65).bilinearresize(2,2)
a=Crop(v,0,0,-1,-1)
b=Crop(v,1,0,0,-1)
c=Crop(v,0,1,-1,0)
d=Crop(v,1,1,0,0)
x=Overlay(a,b,mode="blend",opacity=0.5)
y=Overlay(c,d,mode="blend",opacity=0.5)
v=Overlay(x,y,mode="blend",opacity=0.5)
v=pointresize(v,1,fph)
v=WeaveColumns(v,w).Converttoyv12()
wf=AudioDub(BlankClip(source,pixel_type="YV24",width=1280,height=720),source)
wf=Converttomono(wf).Normalize()
wf=Histogram(wf,mode="audiolevels").Converttorgb32()
wf=Changefps(wf,calc,linear=false).Trim(0,-w)
wf=Crop(wf,100,0,-1179,-0188)
wf=Greyscale(wf).Levels(0,1.000,64,0,255,coring=false)
wf=WeaveColumns(wf,w)
e=Crop(wf,0,0,0,-height(wf)*3/4)
f=Crop(wf,0,height(wf)/4,0,-height(wf)/2)
g=Crop(wf,0,height(wf)/2,0,-height(wf)/4)
h=Crop(wf,0,height(wf)*3/4,0,0)
e=bicubicresize(e,width(e),height(e)/2)
f=bicubicresize(f,width(f),height(f)/6)
g=bicubicresize(g,width(g),height(g)/9)
h=bicubicresize(h,width(h),height(h)/12)
wf=Stackvertical(e,f,g,h)
wf=bicubicresize(wf,w,48)
wf=bicubicresize(wf,w,6).addborders(0,1,0,0)
wf=bicubicresize(wf,w,fph*30/100).addborders(0,fph-fph*30/100,0,0)
v=Overlay(v,wf,mode="Add",opacity=0.333)
bg=blankclip(width=w,height=fph)
v=StackVertical(source,v)
Function ovl(clip c1, clip c2, int xx, int yy) { Overlay(c1, c2 , xx , yy) }
v=Animate(v,0,source.framecount+1,"ovl", bg,0,source.height,   bg,source.width,source.height)
return v
}
fingerprint(fph=128)

Looks like this.

Last edited by Keiyakusha; 4th May 2013 at 04:43.
Keiyakusha is offline   Reply With Quote