Mug Funky
22nd August 2013, 03:07
is there an undocumented (or documented, but not found by me) way to get the current frame's audio level? peak or rms or whichever...
i've written a horribly kludge that sort of works (it gives correct numbers for multiples of 6dB, but incorrect for multiples of 10, just due to the precision of the crap i'm doing to pull the number out).
function getlevel (clip c)
{
c.converttoyv12().converttomono()
audiodub(blankclip(last,width=256,height=1024),last).histogram(mode="audiolevels")
pointresize(64,last.height,90,0,2,0).vtoy()
global audio_peak=mt_lut(expr="x 127 > 0 255 ?").lanczosresize(8,256)
global audio_rms=mt_lut(expr="x 64 > 0 255 ?").lanczosresize(8,256)
scriptclip(c,""" subtitle(string( (audio_peak.averageluma-255)/255 * 96 )) """ )
}
background: i'm trying to write a function that lists possible chapter or layer break candidates in a text file. i have a black detection script that works already, but anywhere that has low motion and very low audio is a potential place as not all programmes dip to black between segments.
i've written a horribly kludge that sort of works (it gives correct numbers for multiples of 6dB, but incorrect for multiples of 10, just due to the precision of the crap i'm doing to pull the number out).
function getlevel (clip c)
{
c.converttoyv12().converttomono()
audiodub(blankclip(last,width=256,height=1024),last).histogram(mode="audiolevels")
pointresize(64,last.height,90,0,2,0).vtoy()
global audio_peak=mt_lut(expr="x 127 > 0 255 ?").lanczosresize(8,256)
global audio_rms=mt_lut(expr="x 64 > 0 255 ?").lanczosresize(8,256)
scriptclip(c,""" subtitle(string( (audio_peak.averageluma-255)/255 * 96 )) """ )
}
background: i'm trying to write a function that lists possible chapter or layer break candidates in a text file. i have a black detection script that works already, but anywhere that has low motion and very low audio is a potential place as not all programmes dip to black between segments.