Log in

View Full Version : AviSynth filter reporting video statistics?


LigH
22nd July 2007, 14:27
Is there an AviSynth filter which reports interesting details per frame (like what you can see in Histogram) into a text file?

A member of the german doom9/Gleitz forum is interested in analysing luminance / chrominance ranges externally.

german thread (http://forum.gleitz.info/showthread.php?t=34957)

gzarkadas
22nd July 2007, 15:30
This outputs all available predefined stats per frame of a clip (except the RGBdifference... ones and the current_sample var) in three files that can be merged to a spreadsheet in a later step. If less stats are needed, delete not needed lines and logfiles (writefile will output up to 16 vars passed to it).


AviSource("your clip")
global TAB = Chr(9)
global log1 = "your #1 log"
global log2 = "your #2 log"
global log3 = "your #3 log"
# optional; use it to put a header if you wish;
# else comment out the next lines
header1 = "an up to 255 chars string"
header2 = "..."
header3 = "..."
WriteFileStart(log1, "header1")
WriteFileStart(log2, "header2")
WriteFileStart(log3, "header3")
ScriptClip("""
WriteFile(log1, \
"current_frame", "TAB", \
"AverageLuma", "TAB", \
"AverageChromaU", "TAB", \
"AverageChromaV", "TAB", \
"YDifferenceFromPrevious", "TAB", \
"YDifferenceToNext", "TAB", \
"UDifferenceFromPrevious", "TAB", \
"UDifferenceToNext", "TAB")
WriteFile(log2, \
"current_frame", "TAB", \
"VDifferenceFromPrevious", "TAB", \
"VDifferenceToNext", "TAB", \
"YPlaneMin", "TAB", \
"YPlaneMax", "TAB", \
"YPlaneMedian", "TAB", \
"YPlaneMinMaxDifference", "TAB", \
"UPlaneMin", "TAB")
WriteFile(log3, \
"current_frame", "TAB", \
"UPlaneMax", "TAB", \
"UPlaneMedian", "TAB", \
"UPlaneMinMaxDifference", "TAB", \
"VPlaneMin", "TAB", \
"VPlaneMax", "TAB", \
"VPlaneMedian", "TAB", \
"VPlaneMinMaxDifference")
""")


The script needs, of course, specific filenames, headers, etc., to be usable.

LigH
23rd July 2007, 09:38
Good idea! Many thanks. I am sure we will knit something cozy out of it.