Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd October 2012, 03:55   #41  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
Bit pissed at the moment, but, not sure what you mean.
Not aware of using "%" in any RT_Stats plugs as any kind of special character.
What func in particular are you talking about?, give an exact example, just filenames and commands.
Your post is a bit non specific.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd October 2012 at 13:31.
StainlessS is offline   Reply With Quote
Old 2nd October 2012, 04:49   #42  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
@StainlessS

Sorry for the confusion - this time I tested things with just one file

The bmpList file -> 82539.List:
D:\ImageTest\%myfile.jpg

excerpt from DebugView:
[3436] RT_Debug: Found BMP files = 1
[3436] RT_Debug:
[3436] RT_Debug: Processing BMP File D:\ImageTest\%myfile.jpg

so the bmpList file is OK and RT_Debug shows the correct filename, but I get an error when opening my avs file is either VirtualDub, AVSPMod, MPlayerClassic

VirtualDub Error
ImageReader: error 'Could not open file' in DevIL library
reading file D:\ImageTest\myfile.jpg

the filename is %myfile.jpg - so the problem is with the % character

It isn't a problem with RT_Stats, but rather with ImageReader

Code:
loadplugin("GScript.dll")
loadplugin("RT_Stats.dll")
fps			= 1
end			= fps-1
GScript("""
picclip=0
result=RT_WriteFileList("D:\ImageTest\*.jpg","82539.List")
Assert((result!=0),"No BMP files found")
BMPLIST=RT_ReadTxtFromFile("82539.List")  
FILES=RT_TxtQueryLines(BMPLIST)
RT_Debug("Found BMP files = " + String(FILES))
RT_Debug(" ")
canvaswidth		= 640
canvasheight		= 480
For(i=0,FILES-1) {
FN=RT_TxtGetLine(BMPLIST,i)
RT_Debug("Processing BMP File",FN)
k=ImageSource(FN,end=end).ConvertToRGB32()
iHeight=k.height    iWidth=k.width
if (iHeight >= iWidth) {
	iHeight1    	= canvasheight
	iWidth1     	= (canvasheight * iWidth) / iHeight
	x           	= canvaswidth - iWidth1
	x1         	= x/2
	if (iWidth1 % 2 > 0) {
    	x1      		= (x/2) + 1
}
	k          	= k.bilinearresize(iWidth1,canvasheight).addborders(x1,0,x/2,0,$101010)
}
if (iWidth > iHeight) {
	iWidth1     	= canvaswidth
	iHeight1    	= (canvaswidth*iHeight)/iWidth
	y           	= canvasheight-iHeight1
	y1          	= y/2
	if (iHeight1 % 2 >0) {
	y1         	= (y/2) + 1
	}
	k           	= k.bilinearresize(iWidth1,iHeight1).addborders(0,y1,0,y/2,$101010)
	}
	if (iwidth1 > canvaswidth) {
	iwidth1     	= canvaswidth
	iheight1    	= (canvaswidth*iheight)/iwidth
 	y           	= canvasheight-iheight1
 	y1          	= y/2
	if (iheight1 % 2 >0) {
	y1      		= (y/2) + 1
	}
	k           	= k.bilinearresize(iWidth1,iHeight1).addborders(0,y1,0,y/2,$101010)
 	}
     if (iHeight1  > canvasheight) {
     iHeight1    	= canvasheight
     iWidth1     	= (canvasheight*iWidth)/iHeight
     x           	= canvaswidth-iWidth1
     x1          	= x/2
     if (iWidth1 % 2 >0) {
     x1      		= (x/2) + 1
     }
     k           	= k.bilinearresize(iWidth1,iHeight1).addborders(x1,0,x/2,0,$101010)
     }
RT_Debug("NewWidth =",String(k.Width),"NewHeight =",String(k.height))
picclip             = (IsClip(picclip)) ? picclip ++ k : k
RT_Debug("")
}
""")
PicClip
assumefps(fps)
wiseant is offline   Reply With Quote
Old 2nd October 2012, 12:57   #43  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
From ImageReader/ImageSource Docs

Quote:
file: template for the image file(s), where frame number substitution can be specified using sprintf syntax. For example, the files written by ImageWriter's default parameters can be referenced with "c:\%06d.ebmp". As of v2.56 if the template points to a single file then that file is read once and subsequently returned for all requested frames.
So, file is a template, not a filename, it is swallowing your '%' char then stumbling when it cannot find the rest of
the expected sequence eg "06d" and has a last ditch attempt at opening the file without the '%' char that it has already skipped over, hence:

Quote:
ImageReader: error 'Could not open file' in DevIL library
reading file D:\ImageTest\myfile.jpg
EDIT: Think this escape might fix it (replace '%' by double '%%' before call to imagereader, untested but should work)
Code:
    FN=StrReplace(FN,"%","%%")

    Function StrReplace(string s,string find,string replace) # Repeated, string replacements
    # Original:- http://forum.doom9.org/showthread.php?t=147846&highlight=gscript           By Vampiredom, Gavino, IanB
    #{i=s.FindStr(find)return(i==0?s: s.LeftStr(i-1)+replace+s.MidStr(Strlen(find)+i).StrReplace(find,replace))}
    # Converted to use RT_Stats RT_StrAddStr() to avoid 2.58/2.6a3 string concatenation bug:-
    {i=s.FindStr(find) return(i==0?s:RT_StrAddStr(s.LeftStr(i-1),replace,s.MidStr(Strlen(find)+i).StrReplace(find,replace)))}
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd October 2012 at 13:52.
StainlessS is offline   Reply With Quote
Old 2nd October 2012, 17:12   #44  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
Quote:
Originally Posted by StainlessS View Post
Here tis, given a moniker of YBetwixt(), (EDIT: "betwixt", usage archaic, "in the interval", ie "between")
You are so fast, and really helpful! looking at the time of your post.
Hope you don't mind that I can only test tomorrow. I'll sure give you feedback soon.
martin53 is offline   Reply With Quote
Old 2nd October 2012, 18:01   #45  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
No sweat, take your time.

The function was really quite easy to implement, about 10-15 mins at most.
I just hacked out a piece of RT_Stats code which is multi functional, ie is used by about 5 or 6
functions with the only difference being after the entire frame has been sampled into a 256 element count array,
fn specific stuff done on the array.
Only required about a dozen (if that) extra lines of code to implement the additional fn specific code.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 3rd October 2012, 10:11   #46  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
I tested it, works fine! (Unfortunately, does not help with my problem as expected, but that's a different story)

Though not being a native english speaker, I'd propose the name RT_YFractionInRange().

For the scaling, I'd like to add these considerations
Because the result is quite likely to be used as a factor or a denominator, a scaling to 1.0 avoids additional scaling at script level. E.g. AverageLuma/(1.0001-RT_YFractionInRange(lo=128,hi=129)) is simple and efficient.

Because for computed ranges as in GScript("for (i=0,255,1) {RT_YFractionInRange(lo=i,hi=i) ... }") it is simpler to script, when the hi limit is included rather than excluded. This of course does not apply if hi defaults to lo, so hi can be omitted in the script if the range has only the range of 1.

I had a problem with clip size because I needed to evaluate the U plane: UToY().YBetwixt(lo=128, hi=129) produced an error about an uneven width (although I was quite sure the original's width and height were multiples of 4). It would be easier to script, and more important avoid the intermediate clip, if also RT_UFractionInRange() and RT_VFractionInRange() existed.
And yes, I think the functions are worth to be included in RT_Stats.
martin53 is offline   Reply With Quote
Old 3rd October 2012, 14:40   #47  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
RT_YFractionInRange(), happy to accept although might a more succinct RT_YInRange() be OK ?

Would actually prefer to keep in range 0.0 - 255.0 as all others (except RT_LumaCorrelation(-1.0 - 1.0)), but your idea so OK, accepted.
(AverageLuma etc might also have been better if in range 0.0 - 1.0)

Lo and hi inclusive with hi defaulting to lo, Accepted. (unless you require otherwise, will default lo to 128).

I presume that the 'uneven width' error was produced in UToY, dont think can happen in the RT stuff, can you check.

As for the chroma equivalent routines, I will implement these when v2.6 is the norm, right now, luma is safe to use
whether 2.58 or 2.6 colorspaces.
[I dont use v2.6 plugins as they tend to break scripts and are perhaps a bit clunky because of kludges.
I may drop support for 2.58 altogether when v2.6 plugin support is concrete, as far as I'm, concerned, v2.6 is
considerably more stable and bug free than 2.58, we just have to wait for plug support to be equally stable.]

By the way, did you checkout the script in Developer Call() thread, it should be faster not using the RTE, also nice trick
forcing the initial ImageWrite during compile time. Your Exist() line also needs attention as noted there.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 3rd October 2012, 15:49   #48  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
Thanks for reply, please do as you proposed.
I'll check the Call() thread in near future. When you first indicated it, I thought I knew the most actual state, but what you write now, contains details I don't remember.

I am in the middle of making a motion compensated background for deshaking, so I want to finish that first. Just have to find again a post where padding with PointResize() was shown - can't get it working (for the initial frame of my background).

Last edited by martin53; 3rd October 2012 at 19:06. Reason: typo
martin53 is offline   Reply With Quote
Old 3rd October 2012, 17:52   #49  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
RT_Stats() New Version v1.05, Added RT_YInRange(). See 1st post.


@Martin53,

Tried this without any problems:

Code:
avisource("D:\avs\avi\1.avi").ConvertToYV12()

u=UToy() # get u outside of runtime environment
v=VToy() # get v outside of runtime environment

scriptclip("""
	zu=u.RT_YInRange(lo=128)
	zv=v.RT_YInRange(lo=128)
	subtitle(String(zu),align=7).subtitle(String(zv),align=9)
""",args="u,v") # Pass in u & v as args, needs Grunt()

return last
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 7th October 2012, 21:28   #50  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
You document RT_ReadTxtFromFile() as a non-clip function.

As I learned from your explanation on the Call() plugin: can I use this function to retrieve data during the frame processing phase?

My situation is this: I need motion estimation data between, say, the previous frame and the current one.

MDepan() writes this information to a text file - after the graph is built, I think. I assume, that MDepan() closes the file immediately, although I don't know yet.

How can I get this information into script variables, if my script is running in the realtime environment?
First I need grep or something to extract the line - solved.
Now I need RT_ReadTextFromFile or something else to give me access to these informations

The following clip filter in the graph shall transform the frame (yep, the quad plugin ), i.e. I need the motion numbers from the file to serve them to quad()!

I figured out this code. But I suspect what I need is impossible in one pass, except if MDepan() uses the part of the graph that already exists during graph build, and I can gain access to the file in that time slot.
Code:
c.MDepan(v, log=logfile, zoom=true, rot=true, range=1, thSCD1=960)
#assumption: motion informations are now in logfile.

Command = """cmd /c find /N " """+string(frame)+""" " """+logfile+">C:\Temp\MotionData.log"
#"""find /N " 123 " CIMG6437_.avi.deshaker>C:\Temp\MotionData.log"""  writes:
#
#---------- CIMG6437_.AVI.DESHAKER
#[124]    123   10.26    1.45  -0.049 0.99615
#
#(first is number of line, then line content from MDepan. This starts with frame number, then x motion, y motion, rotation angle, zoom factor.
#File ends with return char.

CallCmd(Command, "*", Hide=true, Debug=true)

motionData = "Select(i, "+StrReplace(StrReplace(RT_ReadTxtFromFile(C:\Temp\MotionData.log" ,Lines=1 , Start=-1),"  "," ")," ",",")+")"
# make single spaces and convert them into commas for Select()

#motionData to be used like: "i=2 xShift=Eval(motionData)"
EDIT: MDepan() also writes the motion data into the topmost line of the output clip. With RT_AverageLuma(w=1,h=1) it is already possible to do "pixel peeking", but I fear that the reconstruction of float values by this means is not reasonable. Still wanted to add that aspect to the description.

Last edited by martin53; 7th October 2012 at 21:36. Reason: alternative access to MDepan data directly via clip
martin53 is offline   Reply With Quote
Old 15th October 2012, 19:29   #51  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
@Martin53,
Sorry about not responding earlier, got a bit waylaid.
About to be sidetracked again (just decided to make a plugin to both auto crop and/or auto level) so decided
to answer briefly before going offline for perhaps a while.

Are you still dealing with the above problem, I've never used the Mdepan func with logfile (dont think).
Dont know whether log file creating on fly, with each frame or at destruction.
Either way, probably not available (or open file) and maybe requires 2 pass.
But perhaps, if you step through the MDepan frames using GScript, as a prescan stage (long timeout) and then
IF log file is complete, might be able to use RT_ReadTextFromFile to retrieve it, and throw away the original result clip.

Stepping through frames examples here:
http://forum.doom9.org/showthread.php?t=165694

RT_ReadTextFromFile reads possibly multiline [Chr(10) separated] string from a text file.
RT_FileQueryLines, gives number of lines in the multiline string (EDIT In file).
RT_TxtGetLine, extracts a single line from a multiline string.


Multiline string input and parse example:
http://forum.doom9.org/showthread.ph...23#post1588523

Quote:
EDIT: MDepan() also writes the motion data into the topmost line of the output clip. With RT_AverageLuma(w=1,h=1) it is already possible to do "pixel peeking
RT_AverageLuma(w=1,h=1) would return a value via this code:
Code:
    return (float)((double)acc / Pixels)
as
    return (float)((double)the_pixel_value / 1.0) # as Pixels (1) is coerced to double, division done, and then rounded to float.
Should return float representation of the int pixel value, although rounded conversion to int might be a good idea (probably NOT necessary).

EDIT: Rough guess, untested.
Code:
  VideoFileName 	="D:\AVS\AVI\1.d2v"
  c=MPEG2Source(VideoFileName)
  c
  MDepan(...)
  GScript("""    
     for (n=0,Framecount-1) {
          RT_AverageLuma(n,w=1,h=1)	# frame force read
     }    
  """)
  c # Hopefully destructor of temp last clip called here and log file available after here

Quote:
As I learned from your explanation on the Call() plugin:
Dont place too much faith in that, mostly based on guesswork.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th October 2012 at 16:30.
StainlessS is offline   Reply With Quote
Old 16th October 2012, 00:26   #52  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
@Martin53, the below extracts the MDepan data as required, I'll leave the rest to you.

Code:
c=MPEG2Source("D:\AVS\AVI\1.d2v").Trim(0,5)
c
LOGFILE     = "LogFile.Log"
LINEFILE    = "C:\Temp\MotionData.log"

COMMAND = """cmd /c find /N  " # " """ + LOGFILE + " >" + LINEFILE


v=MSuper().MAnalyse(isb = false)
gm=MDepan(v, log=LOGFILE, zoom=true, rot=true, range=1, thSCD1=960)

GScript("""                             # Force MDepan analysis
    for (n=0,Framecount-1) {
        gm.RT_AverageLuma(n,w=1,h=1)    # Force frame read of Global Motion clip, and MDepan testing.
    }    
""")
    
gm=0 # Destructor of temp Global Motion clip called here and log file available after here (created in Destructor)
c 
CallCmd(COMMAND,"0,0",Insert="#",digits=1,Hide=true,Debug=true) # Extract line of motion data from log file prior each frame to scriptclip.
ScriptClip("""
    MotionData=GetMotionData(LINEFILE)
    return last
""",After_Frame=true)   # NOTE, After_Frame

return last

Function GetMotionData(String fn) {
    LOGSTR=RT_ReadTxtFromFile(fn,Lines=1,Start=2)               # Skip blank line and "---------- LOGFILE.LOG" line.
    LOGSTR=StrReplace(LOGSTR,Chr(10),"")                        # Remove Newline ie Chr(10)
    RT_DEBUG("LOGSTR        ='"+LOGSTR+"'")
    LOGSTR=StrReplace(StrReplace(LOGSTR,"[",""),"]","")         # Remove Line markers
    RT_DEBUG("UNLINEMARKED  ='"+LOGSTR+"'")
    LOGSTR=StrReplaceDeep(LOGSTR,"  "," ")                      # Convert SPACE pairs to single SPACE
    RT_DEBUG("SPACECOMPACTED='"+LOGSTR+"'")
    LOGSTR=StrReplace(LOGSTR," ",",")                           # Convert SPACE to COMMA        
    RT_DEBUG("COMMACONVERTED='"+LOGSTR+"'")
    MotionData = "Select(i, " + LOGSTR +")"
    RT_DEBUG("MotionData    ='"+MotionData+"'")
    return MotionData
}

Function StrReplace(string s,string find,string replace) # Repeated, string replacements
# Original:- http://forum.doom9.org/showthread.php?p=1540504#post1540504           By Vampiredom, Gavino, IanB
#{i=s.FindStr(find)return(i==0?s: s.LeftStr(i-1)+replace+s.MidStr(Strlen(find)+i).StrReplace(find,replace))}
# Converted to use RT_Stats RT_StrAddStr() to avoid 2.58/2.6a3 string concatenation bug:-
{i=s.FindStr(find) return(i==0?s:RT_StrAddStr(s.LeftStr(i-1),replace,s.MidStr(Strlen(find)+i).StrReplace(find,replace)))}

Function StrReplaceDeep(string s,string find,string replace) # DEEP Repeated, string replacements
# When replacing eg pairs of SPACE characters by single SPACE, StrReplace can leave some pairs non replaced.
# Assumes that you want to rescan where replaced string could constitute part of a new find substring,
# Length of replace must be shorter than length of find, else will call StrReplace instead.
# Based On:- http://forum.doom9.org/showthread.php?p=1540504#post1540504           By Vampiredom, Gavino, IanB
# {i=s.FindStr(find)return i==0?s:s.LeftStr(i-1)+( strlen(replace)<strlen(find)? \
# StrReplaceDeep(replace+s.MidStr(Strlen(find)+i),find,replace) : replace+StrReplace(s.MidStr(Strlen(find)+i),find,replace))}
# Converted to use RT_Stats RT_StrAddStr() to avoid 2.58/2.6a3 string concatenation bug:-
{i=s.FindStr(find)return i==0?s:RT_StrAddStr(s.LeftStr(i-1),( strlen(replace)<strlen(find)? \
StrReplaceDeep(RT_StrAddStr(replace,s.MidStr(Strlen(find)+i)),find,replace) : \
RT_StrAddStr(replace,StrReplace(s.MidStr(Strlen(find)+i),find,replace))))}
Debug stuff
Code:
00000002  1.81485665  [2956] CallCmd: Constructor IN  
00000003  1.81489933  [2956] CallCmd: CallCmd: v1.00 - 08 Oct 2012 - by StainlessS  
00000004  1.81494594  [2956] CallCmd: Command for Frames = 'cmd /c find /N  " # " LogFile.Log >C:\Temp\MotionData.log'  
00000005  1.81499493  [2956] CallCmd: FRAMES: About to Parse Frames String  
00000006  1.81504369  [2956] CallCmd: FRAMES:  Line 1:1 0,5    $0,0 
00000007  1.81509042  [2956] CallCmd: Doing command on 6 Frames 
00000008  1.81513464  [2956] CallCmd: Constructor OUT 
00000009  2.16997981  [2956] CallCmd: GetFrame(0) on command 'cmd /c find /N  " 0 " LogFile.Log >C:\Temp\MotionData.log'  
00000010  2.37153673  [2956] CallCmd: SUCCESS Creating Process  
00000011  2.37663078  [2956] RT_Debug: LOGSTR        ='[1]      0    0.00    0.00   0.000 1.00000'  
00000012  2.38259101  [2956] RT_Debug: UNLINEMARKED  ='1      0    0.00    0.00   0.000 1.00000'  
00000013  2.41031384  [2956] RT_Debug: SPACECOMPACTED='1 0 0.00 0.00 0.000 1.00000' 
00000014  2.42110348  [2956] RT_Debug: COMMACONVERTED='1,0,0.00,0.00,0.000,1.00000' 
00000015  2.42123628  [2956] RT_Debug: MotionData    ='Select(i, 1,0,0.00,0.00,0.000,1.00000)'  
00000016  2.47051644  [2956] CallCmd: GetFrame(1) on command 'cmd /c find /N  " 1 " LogFile.Log >C:\Temp\MotionData.log'  
00000017  2.59828448  [2956] CallCmd: SUCCESS Creating Process  
00000018  2.60344887  [2956] RT_Debug: LOGSTR        ='[2]      1   -0.01    0.00   0.000 1.00000'  
00000019  2.60861468  [2956] RT_Debug: UNLINEMARKED  ='2      1   -0.01    0.00   0.000 1.00000'  
00000020  2.63412428  [2956] RT_Debug: SPACECOMPACTED='2 1 -0.01 0.00 0.000 1.00000'  
00000021  2.64520335  [2956] RT_Debug: COMMACONVERTED='2,1,-0.01,0.00,0.000,1.00000'  
00000022  2.64533710  [2956] RT_Debug: MotionData    ='Select(i, 2,1,-0.01,0.00,0.000,1.00000)' 
00000023  2.67647266  [2956] CallCmd: GetFrame(2) on command 'cmd /c find /N  " 2 " LogFile.Log >C:\Temp\MotionData.log'  
00000024  2.80067348  [2956] CallCmd: SUCCESS Creating Process  
00000025  2.80581069  [2956] RT_Debug: LOGSTR        ='[3]      2    0.01    0.00   0.000 1.00000'  
00000026  2.81096816  [2956] RT_Debug: UNLINEMARKED  ='3      2    0.01    0.00   0.000 1.00000'  
00000027  2.83819222  [2956] RT_Debug: SPACECOMPACTED='3 2 0.01 0.00 0.000 1.00000' 
00000028  2.84876084  [2956] RT_Debug: COMMACONVERTED='3,2,0.01,0.00,0.000,1.00000' 
00000029  2.84887767  [2956] RT_Debug: MotionData    ='Select(i, 3,2,0.01,0.00,0.000,1.00000)'  
00000030  2.84958386  [2956] CallCmd: GetFrame(3) on command 'cmd /c find /N  " 3 " LogFile.Log >C:\Temp\MotionData.log'  
00000031  2.97924876  [2956] CallCmd: SUCCESS Creating Process  
00000032  2.98432541  [2956] RT_Debug: LOGSTR        ='[4]      3   -0.01    0.28   0.033 1.00011'  
00000033  2.98958492  [2956] RT_Debug: UNLINEMARKED  ='4      3   -0.01    0.28   0.033 1.00011'  
00000034  3.01530290  [2956] RT_Debug: SPACECOMPACTED='4 3 -0.01 0.28 0.033 1.00011'  
00000035  3.02687788  [2956] RT_Debug: COMMACONVERTED='4,3,-0.01,0.28,0.033,1.00011'  
00000036  3.02699447  [2956] RT_Debug: MotionData    ='Select(i, 4,3,-0.01,0.28,0.033,1.00011)' 
00000037  3.02782226  [2956] CallCmd: GetFrame(4) on command 'cmd /c find /N  " 4 " LogFile.Log >C:\Temp\MotionData.log'  
00000038  3.15263963  [2956] CallCmd: SUCCESS Creating Process  
00000039  3.15752482  [2956] RT_Debug: LOGSTR        ='[5]      4   -0.10    0.43   0.004 0.99982'  
00000040  3.16313744  [2956] RT_Debug: UNLINEMARKED  ='5      4   -0.10    0.43   0.004 0.99982'  
00000041  3.18898296  [2956] RT_Debug: SPACECOMPACTED='5 4 -0.10 0.43 0.004 0.99982'  
00000042  3.19961834  [2956] RT_Debug: COMMACONVERTED='5,4,-0.10,0.43,0.004,0.99982'  
00000043  3.19973421  [2956] RT_Debug: MotionData    ='Select(i, 5,4,-0.10,0.43,0.004,0.99982)' 
00000044  3.20040274  [2956] CallCmd: GetFrame(5) on command 'cmd /c find /N  " 5 " LogFile.Log >C:\Temp\MotionData.log'  
00000045  3.35947132  [2956] CallCmd: SUCCESS Creating Process  
00000046  3.36437130  [2956] RT_Debug: LOGSTR        ='[6]      5    0.30    0.35  -0.009 0.99970'  
00000047  3.37089896  [2956] RT_Debug: UNLINEMARKED  ='6      5    0.30    0.35  -0.009 0.99970'  
00000048  3.40061140  [2956] RT_Debug: SPACECOMPACTED='6 5 0.30 0.35 -0.009 0.99970'  
00000049  3.41689062  [2956] RT_Debug: COMMACONVERTED='6,5,0.30,0.35,-0.009,0.99970'  
00000050  3.41767979  [2956] RT_Debug: MotionData    ='Select(i, 6,5,0.30,0.35,-0.009,0.99970)' 
00000051  6.74900341  [2956] CallCmd: Destructor IN 
00000052  6.75118876  [2956] CallCmd: Destructor OUT
EDITED: Moved contents of scriptclip text extraction/converting into a script function (precompiled).

EDIT: We could have loaded entire LogFile.Log into (EDIT: big) string and extracted single line at a time from it using
LINESTR=RT_TxtGetLine(LOGSTRING,current_frame) in ScriptClip, and avoid the CallCmd call to FIND the string.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th December 2012 at 02:15.
StainlessS is offline   Reply With Quote
Old 28th October 2012, 10:15   #53  |  Link
travolter
Registered User
 
Join Date: Apr 2009
Posts: 142
@StainlessS
Im replying you from this thread
http://forum.doom9.org/showthread.php?p=1597871#post1597871

QueryBorderCrop() freezed image, and QueryLumaMinMax() not..
When I use robolevels(QBC=false) it does not freeze image but there is a problem. The image only show 5 colors: pink/orange/green/blue/white (remember me CGA)

Im using your RT_Stats 20121003 and I use potplayer but also verified with mplayer. Using YV12 color space and overlay mixer as render.
No message appear when I write robolevels(QBC=false, Debug=true)

I only need to correct the levels.. maybe there is a workaround to solve the problem.
travolter is offline   Reply With Quote
Old 29th October 2012, 00:45   #54  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
travolter,
Get this (MS DebugView):
http://technet.microsoft.com/en-us/s.../bb896647.aspx

Allows you to see messages coming out of scripts and other programs/filters.

And try

Code:
QueryLumaMinMax(debug=true) # for levels info
and
Code:
QueryBorderCrop(debug=true)  # for test why fail
or
Code:
RoboLevels(QBC=false,debug=true)  # for test why fail
A short sample that gives problems might be a good idea. Thanks.

EDIT:, you could also add this line just before the Levels() line near the end of RoboLevels function:
Code:
(DEBUG)? RT_Debug("Levels("+String(ALMin)+",1.0,"+String(AlMax)+","+String(CSMin)+","+String(CSMax)+",Coring=False)"):NOP
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th October 2012 at 04:58.
StainlessS is offline   Reply With Quote
Old 16th November 2012, 18:39   #55  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
RT_TxtSort() error in docs, 'sort' should read 'mode'.
Code:
RT_TxtSort(String,int 'mode'=0)
Non-clip function. 
Function to sort a Chr(10) separated multiline string.
The String arg is the name of the string, and 'mode' can be in range 0 to 7.
 0 = Sort ascending, case insignificant
 1 = Sort ascending, case significant
 2 = Sort decending, case insignificant
 3 = Sort decending, case significant
 4 = Sort ascending, Filenames, digits sorted by value
 5 = Sort ascending, Filenames, old style as for Windows 2000
 6 = Sort decending, Filenames, digits sorted by value
 7 = Sort decending, Filenames, old style as for Windows 2000
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 16th November 2012 at 23:22.
StainlessS is offline   Reply With Quote
Old 24th November 2012, 14:13   #56  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
Quote:
Originally Posted by StainlessS View Post
@Martin53, the below extracts the MDepan data as required, I'll leave the rest to you.
StainlessS,
thank you very much indeed for the work you put into this script!
The task was part of my script FSubstitute - to get global pan/zoom/rotate information between two arbitrary frames of a clip.

I decided to also try a third option (besides of using MMask kind=5), because - according to what I found - the extraction script needs to be in a different RTE than MDepan, otherwise MDepan keeps the file handle locked and the file cannot be read from. In my case, MDepan must run in the RTE. Also, MDepan only delivers the values for two adjacent frames, so numerous extractions and further calculations would have been neccessary.

The third option is really cool: RT_LumaCorrelation between two frames typically has a maximum over varying x,y offset when the x,y is the global pan between these frames. I implemented a stepwise seek loop, and it is not even sooo slow. And what's best: with the same idea, but applied to the four quarters of the frame, you get data to calculate zoom and rotation. As if this were not enough, a real quadrilateral transformation that is possible with these data gives superior results than restriction to zoom & rotation. I.e. the third option excels the possibilities of MDepan, and it even opens the way for an idea of a deshaker based (almost) completely on AviSynth script level and existing plugins: That deshaker will maybe able to compensate tilt - something I don't know from any existing deshaker.

My apologies, if you feel disappointed that the extraction script is not used in my project. I hope you are compensated by the extraordinary value RT_LumaCorrelation has for my work.
martin53 is offline   Reply With Quote
Old 24th November 2012, 15:26   #57  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
Quote:
Originally Posted by martin53 View Post
My apologies, if you feel disappointed that the extraction script is not used in my project.
Not at all, it was an interesting exercise and resulted in the StrReplaceDeep mod which is a very useful alternative to StrReplace.
Good luck with your monster script.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 24th November 2012 at 19:55.
StainlessS is offline   Reply With Quote
Old 2nd December 2012, 17:52   #58  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
StainlessS,
thanks to your suggestions, mainly because of the destructor tricks I think, I was able to integrate MDepan into my 'monster script'. It produces good motion estimation and runs faster than the RT_LumaCorr approximation.
martin53 is offline   Reply With Quote
Old 4th December 2012, 18:46   #59  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
StainlessS,
could you extend RT_TxtWriteFile(String,String,bool "append") to be able to append to an existing file?

Last edited by martin53; 4th December 2012 at 18:47. Reason: typos
martin53 is offline   Reply With Quote
Old 4th December 2012, 18:57   #60  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,410
Yo, I hear you but not well able to tie a shoelace right now, will try again when a little less unable.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply

Tags
averageluma, correlation, lumadifference, runtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.