07-23-2005, 09:39 AM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
As I bother to user MovieStacker just for that, this is a little avs script aimed to compare the result of two other scripts.
Simply put the code of the scripts in the function script1 and function script2.
The example below compare the original source (script1 empty) and the result of the greyscale() command.
Note: you can resize or do whatever you want in the scripts but be carefull that both scripts must produce clips with same parameters (size, fps, colorspace)
Code:
source=Mpeg2Source(...)
left=source.script1()
right=source.script2()
width=left.width()/2
height=left.height()
left=crop(left,0,0,width,height)
right=crop(right,width,0,width,height)
StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
|
Someday, 12:01 PM
|
|
Site Staff / Ad Manager
|
|
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
07-23-2005, 12:15 PM
|
Free Member
|
|
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nice!
And here also a nice compare function if you dont want to se a side by side but a "switching"-like comparison:
Code:
source=Mpeg2Source(...)
Interleave(script1(source).subtitle("Script1",10,20),script2(source).subtitle("Script2",10,20))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
Means: Do scroll to the Script1 frame you want to compare ... then step one frame forth. Now you see the Script2 version of the frame. Back n' Forth and Back'n forth gives you a nice comparing like in a "switching" way.
I do use this often when comparing encodings etc.
|
07-23-2005, 02:34 PM
|
Free Member
|
|
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Uau! this one should become a sticky guys
__________________
Rui
|
07-27-2005, 12:55 PM
|
Free Member
|
|
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks guys for both methods this is a really useful script great work.
__________________
Regards.
Michael.
|
09-13-2005, 08:37 AM
|
Free Member
|
|
Join Date: Apr 2004
Posts: 922
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
very good!
thanks guys!
|
10-23-2005, 05:21 AM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I know what is greyscale, but for what is it useful in those scripts?
|
10-23-2005, 05:28 AM
|
Free Member
|
|
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Prodater,
I think it was just an example...
Between this lines
Code:
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
you have to put the filters of scripts (1 and 2) you want to compare.
Inc and Dialhot compared no filter against greyscale() as an example.
|
10-23-2005, 08:06 AM
|
Free Member
|
|
Join Date: May 2004
Location: Rio de Janeiro - Brasil
Posts: 538
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Alternate
More instructions on own link.
Cya!
|
10-23-2005, 09:17 AM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by danpos
Alternate
More instructions on own link.
Cya!
|
Thanks.
|
11-21-2005, 04:55 PM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
A simple but usefull add:
Code:
source=Mpeg2Source(...)
left=source.script1()
right=source.script2()
width=left.width()/2
height=left.height()
left=crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)
StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
It adds a vertical blue (you can change the color) line separating both clips.
The script crop 2 pixels at right and left sides to compensate the addborder in the midle, but most times those sides are black overscan zones.
|
11-21-2005, 05:14 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
11-21-2005, 05:34 PM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Dialhot
|
|
11-26-2005, 08:43 PM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Two more mods:
Compare left half of both scripts:
Code:
source=Mpeg2Source(...)
left=source.script1()
right=source.script2()
width=left.width()/2
height=left.height()
left=crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,0,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)
StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
Compare right half of both scripts:
Code:
source=Mpeg2Source(...)
left=source.script1()
right=source.script2()
width=left.width()/2
height=left.height()
left=crop(left,width,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)
StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
Does any body know how to do it (select one of three options L/R, L/L or R/R) with conditional switches (if mode == LR, if mode == LL, if mode == RR) in only one avs script.
|
11-26-2005, 09:13 PM
|
Free Member
|
|
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I've been playing, but I can't see a way.
Avisynth ConditionalFilter does not allow for a variable to be set
(psuedocode: set Type=left, then test Type for "left").
Is there a way to make an avisynth runtime function give a predefined result that won't change throughout the life of the script?
We may have to wait for 3.0
"..Improved parser: the parser will include the widely requested flow control structs (if then else, for, while). It will add two new types : frame and function..."
__________________
|
Meeow!
|
11-27-2005, 01:03 AM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Fluffbutt
I've been playing, but I can't see a way.
|
I have it!!!
Code:
#############################################################################################
mode="LR" # "LR", "RR" or "LL"
#############################################################################################
source=Mpeg2source("")
left=source.script1()
right=source.script2()
width=left.width()/2
height=left.height()
left = (mode == "RR") ? crop(left,width,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0):crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right = (mode == "LL") ? crop(right,0,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0):crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)
StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))
function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----
#----- END OF CODE OF SCRIPT ONE-----
}
function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
|
11-30-2005, 05:10 AM
|
Free Member
|
|
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hahah, brilliant.. I tried to set a variable, but couldn't get it to react with the scripts.
I was trying a if..then...else type arrangement; yours is a masterpiece!
__________________
|
Meeow!
|
12-01-2005, 05:26 AM
|
Free Member
|
|
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Fluffbutt
Hahah, brilliant.. I tried to set a variable, but couldn't get it to react with the scripts.
I was trying a if..then...else type arrangement; yours is a masterpiece!
|
Thanks.
It is, indeed, an if..then.
left = (mode == "RR") ? can be read as "if mode = "RR" then left = ...."
statement after "?" is the conditional statement.
statement after ":" is the "else" statement.
|
12-03-2005, 04:12 AM
|
Free Member
|
|
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Prodater64
It is, indeed, an if..then.
left = (mode == "RR") ? can be read as "if mode = "RR" then left = ...."
statement after "?" is the conditional statement.
statement after ":" is the "else" statement.
|
Good grief! And programmers call that 'structure'? LOL! It seems wierd to me that = and == both mean 'equals' ("if mode = "RR" then left = ....").
Oh well.. Thanks again..
__________________
|
Meeow!
|
02-14-2009, 03:42 PM
|
Free Member
|
|
Join Date: Mar 2008
Location: Tierra del Fuego, Chile
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I do not know if someone will find it useful by now but I simply use:
Code:
DGDecode_Mpeg2Source(....)
a=last.
\ FFT3dfilter().
\ LanczosResize(x,y)
#
#################
#
dfttest()
LanczosResize(x,y)
stackhorizontal(a,last)
top is for left screen n bottom if for right, *top filters must end with dot "." unless is the last one, same goes for the word "last"
saluts
|
All times are GMT -5. The time now is 02:13 AM — vBulletin © Jelsoft Enterprises Ltd
|