View Full Version : Dynamic (indexed) filtering
StainlessS
24th December 2014, 13:08
Good you got it working.
What did you decide to use, ordinary NickNames or Color as NickName ?
Also, will you know clip indexes, NickNames, colors, ahead of time,
I was thinking of maybe combining the last two script (making functions)
so only a single script may need executing.
It could be set up so that a particular color has always the same function.
Hotte
24th December 2014, 14:00
Hi StainlessS,
I wille be answering in a couple of days....family...christmas...hurry.
All the best for christmas.
Hotte
Hotte
27th December 2014, 09:54
StainlessS,
I will use clipclop in manner like:
$000000 = SOURCE # SOURCE
$F40000 = INTERFRAME # PLAIN RED
$0000FF = SHARPEN # PLAIN BLUE
$04FF00 = IF+SHARPEN # PLAIN GREEN
...
You see that I had to change some of the colours because after avi-export of the colors there where slight changes due to the codec and some of your target colors I was not able to match.
In NLE I apply on a second track the colors above to the areas of the final cut clip that need Interframe-conversion (25>50p) or sharpeing or even both or something else. Then two avi's are being exported, the original readily cut source and the index colour clip to create the command file for clipclop.
Yes, it would absolutely make sense to have a one-step conversion since i do not use the command file (only clipclop does).
At the moment I am doing some testing with complex functions, that I am using in post processing: Interframe and MDegrain. Since these use temporal technology I am curious if everything fits nicely together after it went through clipclop. I will report later.
StainlessS
27th December 2014, 11:22
OK, I'll have a think about that, but a bit busy at the moment doing something else.
But, cannot use eg "$04FF00 = IF+SHARPEN # PLAIN GREEN", the '+' is not nice, can use '_' instead.
Names must start with Alphabetic or '_', can have digits too after first letter.
Hotte
27th December 2014, 11:57
Thanks, I will consider this.
Hotte
27th December 2014, 12:09
One more question: Am I totally free to select color values or are there any dependencies within clipclop ?
StainlessS
27th December 2014, 13:02
Anything you like, just best if SOURCE = $000000.
EDIT: "Rx" where x is zero or more digits, is a reserved Nickname and cannot be re-defined.
Hotte
27th December 2014, 22:28
StainlessS, I am doing very well with my tests apart from one thing, and I have to admit it's really tricky:
I exported a 50p clip as AVI which was originally 25p. To match the 50p Edius automatically adds blended frames every 2nd (= odd) frame. This makes a 50p but with ghosting.
What I regularly do in post is to take out the odd frames and replace them with interpolated interframes which look much sharper. It is simple and works perfectly:
...
SelectEven()
InterFrame(Tuning="weak", OverrideAlgo=21, NewNum=50, NewDen=1, Cores=6)
...
After this procedure, frame count is exactly the same as before and ghosting is gone.
ClipClop seems to have difficulties with this (I could imagine it gets into trouble with the frame count). It throws the following error:
ClipClop: ERROR, CMD Line 2 *TRUNCATABLE-CHECK INTENT* Frame End, Out Of SHORT R1 $IF24 5,53 # $F8FF0A GELB Interframe 24>50p
(D:\Temp\Videotest\Create Final15429c.avs, line 49)
What does this message basically mean ?
Is this something I cannot do with clipclop ? (would be understandable but so sad).
StainlessS
27th December 2014, 23:46
IF24 5,53 # $F8FF0A
Is your command, The $ precedes your command string.
The Error means that last frame 53 is not in range of last frame of source clip, and we do not know what to do with it.
ClipClop replaces frames in source clip with same frame number from an alternate clip.
"TRUNCATABLE-CHECK INTENT", Means that you could set "NoErr=True" on command line to ClipClop and it would
just ignore the 'Out Of Source Clip Range frames".
EDIT:
Changed my mind, it means that frame 53 does not exist in your replacement R1 clip.
"Frame End, Out Of SHORT R1" means that R1 is too Short.
I got mixed up a little there, there are several 'truncatable' messages issued, depending upon
what mistake is made.
Check your frame counts, or set NoErr=True to ignore the mistake.
EDIT: Looking at source, it also means that 'SHORT R1 clip' is shorter than the source clip,
so what I originally said is also true, so you have two problems, R1 shorter than source, and frame 53 does not exist in R1 clip either.
The "CHECK INTENT" part just means that you may have made a mistake because R1 is not same length as source clip, it is just letting you know that there may be a problem, after reviewing your
setting you might just decide to set NoErr=True, which means, 'YES I INTENDED TO DO THAT",
or "JUST IGNORE THAT MISTAKE".
EDIT: You cannot tell me that your "SelectEven etc" generates the same number of frames
for both a 53 frame clip and a 54 frame clip, result frame counts cannot be same as original
in both cases, and the Command.txt file is generated based on original source clip length.
Again, Just set NoErr=True (Might want to set it permanent if you are going to habitually reduce the frame count of the replacement clips. The plugin deliberately tells you of possible problems,
if you dont want to know about them, set NoErr, real errors will not be avoided, only those deemed
of little importance, like this one [the non existent frame will not be used as replacment]).
You can also set 'dv=2' or higher, to view Ignorable Errors that were converted to Warnings by the
'NoErr=True' arg (View in DebugView).
Hotte
28th December 2014, 06:35
This is very good news.
Of course it could be that the last frame is odd and was deleted by selectEven and might not have been replaced by interframe (I am not sure, I have to check this).
If this is the case clipclop shows most accurate error handling. Yes, NoErr=True could be an alternative. I will try....
Let me tell you that when I`ve got these issues under my feet, using clipclop as steering tool for postprocessing my NLE edits is next to revolutionary!:
All the steps I need to do with avisynth are being prepared in NLE using little coloured tif-files (the tifs even contain explanatory text!) overlaying the timeline. And everything is done in only one go afterwards. This is very time- and quality-saving, because I can avoid having intermediate AVIs here and there (though the codec´s compression is so good that quality does not visibly suffer even if you compress the same thing 3x over ).
Thank you for you extensive answer. On to more research...I´ll come back.
Hotte
28th December 2014, 07:47
I checked this and my assumption was correct: The last frame number in source was odd, so removed by SelectEven. Interframe - which follows next - simply does not know that the clip continues for one more frame, so one frame is discarded and Clipclop was right to yield a problem here.
This is a very special problem anyway: The 25p source clip had been cut at a bad position, meaning after an "artificial" frame that only existed because Edius blended it here to match the 50p. In other words the cutting point was at 25,5... :confused:
I tried NoErr=True in Clipclop and the behavior was that it seemed to have replaced the missing frame just simply with the source frame (which is the blended "25,5"). It did not shorten the clip by one frame.
StainlessS - is this the expected behaviour ?
This is the very best solution I could think of!
StainlessS
28th December 2014, 16:01
Yes, Any frame not replaced will be as original source. As frame 53 of R1 does not exist, so frame 53 of source remains as original.
EDIT: The R1 replacement range 5,53 is truncated (by NoErr=true) to R1 5,52. (Frame 53 not touched).
By the way, I will change behaviour of script to test bottom right pixel to retrieve RGB color, so that if using a full frame
size control clip (rather than 32x32), then you can embed text/reminder/notes on the control frame and they will not interfere
with the pixel used to test for RGB color. We currently test pixel @ 0x0 which was reason that the debug/metrics clip had problems
finding the color, it was testing a pixel that contained metrics text rather than intended frame color.
So you will be able to put text on frame in NLE so long as it does not interfere with bottom right pixel.
EDIT: If using full frame rather than 32x32, the UT_Video compressed frame should be still very small and easily compressed
as mostly a single color (mostly single color if rendering notes text on control clip, otherwise completely single color).
EDIT: From your 2nd last post:
though the codec´s compression is so good that quality does not visibly suffer even if you compress the same thing 3x over
UT_Video is Lossless, even after 100 compressions, should be Exactly the same.
Hotte
28th December 2014, 17:08
Very good solution for odd framerates within Clipclop.
Good idea to read bottom right. If you read top left at the moment, it does not interfere with the text since I center the text in way that it never gets close to the edges.
My setup is almost done and first tests are very promising.
I cannot export UT_Video from Edius (only in VDub). I use Edius-Canopus intermediate codec. It also has a lossless mode, but the HD-AVIs are getting really, really huge then. I prefer to use the Canopus-HQ-Mode which converts everything to individual frames and compresses them in a way that generation loss is really not relevant. Filesize is ok then.
Unfortunately I cannot differentiate the control-track in the same project to have a different size as the source clip. But does not really matter. It is the last step within the chain and I don´t care if framerates drop somewhat.
StainlessS
28th December 2014, 20:06
Post #1 of 2
OK, here mods.
Only slightly modified Control.avi creator script (For Dummy TEST purposes). EDIT: Needs clip of at least 2001 frames.
# MakeControlClipAVI.avs, Make Dummy control clip for testing, Save to Control.AVI
ORG=Avisource("D:\avs\test.avi").ConvertToRGB32().KillAudio # Take Blankclip attributes from this
SHOW=True # Simulate USER TEXT/NOTES on frame
BLACK = $000000
BLUE = $0000FF
GREEN = $00FF00
CYAN = $00FFFF
RED = $FF0000
MAGENTA = $FF00FF
YELLOW = $FFFF00
WHITE = $FFFFFF
ORANGE = $FFA500
DARKGRAY = $A9A9A9
SILVER = $C0C0C0
PLUM = $DDA0DD
POWDERBLUE = $B0E0E6
V0 = ORG.BlankClip(Color=BLACK)
V1 = ORG.BlankClip(Color=BLUE)
V2 = ORG.BlankClip(Color=GREEN)
V3 = ORG.BlankClip(Color=CYAN)
V4 = ORG.BlankClip(Color=RED)
V5 = ORG.BlankClip(Color=MAGENTA)
V6 = ORG.BlankClip(Color=YELLOW)
V7 = ORG.BlankClip(Color=WHITE)
V8 = ORG.BlankClip(Color=ORANGE)
V9 = ORG.BlankClip(Color=DARKGRAY)
V10 = ORG.BlankClip(Color=SILVER)
V11 = ORG.BlankClip(Color=PLUM)
V12 = ORG.BlankClip(Color=POWDERBLUE)
NickNames =""" # Psuedonyms for clip index
SOURCE = 0 # Original Clip BLACK
L0 = 1 # Light Luma BLUE
L1 = 2 # Med Luma GREEN
L2 = 3 # High Luma CYAN
C0 = 4 # Light Chroma RED
C1 = 5 # Med Chroma MAGENTA
C2 = 6 # High Chroma YELLOW
LC0 = 7 # Light Luma + Chroma WHITE
LC1 = 8 # Med Luma + Chroma ORANGE
LC2 = 9 # High Luma + Chroma DARKGRAY
FH = 10 # Flip-H SILVER
FV = 11 # Flip-V PLUM
INV = 12 # Invert POWDERBLUE
"""
SCMD=""" # Clip editing commands in string, can also use commands in file
C0 0,99 # Light Chroma frames @ 0 -> 99 RED
L0 100,-200 # Light Luma frames @ 100, 200 frames ie frames 100->299 BLUE
INV 300,399 # Invert 300->399 POWDERBLUE
L0 400,499 # Light Luma frames 400->499 BLUE
FH 500,599 # Flip-H 500->599 SILVER
LC2 600,699 # High Luma + Chroma DARKGRAY
C1 800 # Med Chroma, Single frame MAGENTA
1 900,999 # Light Luma, We used the clip number instead of a NickName BLUE
FV 1000,1099 # Flip-V PLUM
LC1 2000,0 # Med Luma + Chroma, 2000 -> lastframe ORANGE
"""
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW)
ClipClopControlFunctions.avs, Import script containing functions
# ClipClopControlFunctions.avs
Function CreateCommandFile(clip c, String DB, String CMD, Bool "DeleteDB") {
/*
Scan Control clip c, Using DB DBase and create CMD ClipClop Command file. Delete DB if required.
*/
c
myName="CreateCommandFile: "
DeleteDB=Default(DeleteDB,True)
GSCript("""
RT_FileDelete(CMD) # Delete existing Command file
RECORDS = RT_DBaseRecords(DB)
HEXFIELD = 0 # Int field
NICKFIELD = 1 # String field
COMMFIELD = 2 # String field
FC = FrameCount
CurrCol = -1
CurrNick = ""
CurrComm = ""
SFrm = 0
For(n=0,FC) {
# Sample single pixel RGB32 Color as Int (clr Alpha), Single Pixel @ Bottom RHS of frame
Dat = (n==FC) ? -1 : RT_BitAND(RT_RGB32AsInt(n=n,x=width-1,y=height-1),$FFFFFF)
if(n == FC || Dat != CurrCol) {
Frames = n - SFrm
if(Frames > 0) { # If not 1st Frame (0)
if(Frames == 1) { # Write NickName and Single Frame Number
RT_DebugF("%-16s %6d # $%06X %s",CurrNick,SFrm,CurrCol,CurrComm,name=myName)
RT_WriteFile(CMD,"%-16s %6d # $%06X %s",CurrNick,SFrm,CurrCol,CurrComm,Append=True)
} Else { # Write NickName and Range
RT_DebugF("%-16s %6d,%-6d # $%06X %s",CurrNick,SFrm,n-1,CurrCol,CurrComm,name=myName)
RT_WriteFile(CMD,"%-16s %6d,%-6d # $%06X %s",CurrNick,SFrm,n-1,CurrCol,CurrComm,Append=True)
}
}
if(n < FC) { # Else, ALL DONE .. writing LAST range only
CurrCol = Dat
SRec = DB_FindVar(DB,HEXFIELD,CurrCol)
Assert(SRec != -1,RT_String("Cannot Find RGB Hex Color($%06X) in DBase @ Frame %d",CurrCol,n))
CurrNick = RT_DBaseGetField(DB,SRec,NICKFIELD) # Get Associated NickName
CurrComm = RT_DBaseGetField(DB,SRec,COMMFIELD) # Get Associated Comment
SFrm = n # REM new start frame
}
}
}
RT_DebugF("ClipClop Command File created '%s'",CMD,name=myName)
if(DeleteDB) {
RT_DebugF("Deleting DBase '%s'",DB,name=myName)
RT_FileDelete(DB)
}
""")
Return 0
}
###
Function MakeColorNickDBase(String DB,String "MAP_FN",String "MAP") {
/*
DB = Name Of Dbase to Create and fill with Color/NickName data.
MUST Supply either MAP_FN The Map FileName (used in preference) OR MAP as String.
Parse MAP FileName/String and create Sort Ascending (by Hex Color) DBase for efficiently Scanning Control.AVI
*/
myName="MakeColorNickDBase: "
GSCript("""
if((Defined(MAP_FN) && Exist(MAP_FN))) {
RT_DebugF("Reading MAP from File '%s'",MAP_FN,name=myName)
MAP = RT_ReadTxtFromFile(MAP_FN)
} Else {
RT_DebugF("Using MAP String",name=myName)
MAP=Default(MAP,"")
}
Assert(MAP!="",RT_String("%sEither MAP_FN(Filename) or MAP(String) must be supplied",myName))
Fnd_S=RT_String("\t\n \n") # Replace TAB and double SPACE with Single SPACE
Rep_S=RT_String(" \n \n") # Double SPACE, Reduce STACK Usage on RT_StrReplaceDeep on long strings
MAP=RT_StrReplaceMulti(MAP,Fnd_S,Rep_S)
MAP=RT_StrReplaceDeep(MAP," "," ") # SPACE compact (multi to single SPACE)
M=RT_TxtSort(MAP,Mode=0) # Sort Ascending, case insig (by Hex Color Code)
NLINES = RT_TxtQueryLines(M) # Lines of text in M
RT_DBaseAlloc(DB,0,"iss") # Create zero record DB (Int,String,String)
For(i=0,NLINES-1) {
STR = RT_TxtGetLine(M,i) # Without trailing n/l
S = STR
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S)==RT_Ord("$")) {
S = MidStr(S,2) # Swalla the Dolla
c = UCase(MidStr(S,1,1))
IsHexDig = ((c>="0" && c<="9") || (c>="A" && c<="F"))
Assert(IsHexDig,RT_String("%sString(%d) Hex Color Code Missing @'%s'\n'%s'",myName,i,S,STR))
HexColor = RT_NumberValue(S,16)
While(StrLen(S)>=1 && IsHexDig) { # Swalla Hex
S = MidStr(S,2)
c = UCase(MidStr(S,1,1))
IsHexDig = ((c>="0" && c<="9") || (c>="A" && c<="F"))
}
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S)==RT_Ord("=")) {
S = MidStr(S,2) # Swalla optional '='
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
}
c = UCasE(MidStr(S,1,1))
Assert((c>="A" && c<="Z") || c=="_",RT_String("%sString(%d) NickName Missing @'%s'\n'%s'",myName,i,S,STR))
NickLen=1
SLen = StrLen(S)
For(j=2,Slen) {
c = UCase(MidStr(S,j,1))
if((c>="0" && c<="9") || (c>="A" && c<="Z") || c=="_") {
NickLen = NickLen + 1
} else {
j = SLen # Break
}
}
NickName = MidStr(S,1,NickLen)
S = MidStr(S,NickLen+1)
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
Comment = ""
if(RT_Ord(S)==RT_Ord("#")) {
S = MidStr(S,2) # Swalla Hash
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
if(StrLen(S)>0) { # End Trim White
S=RevStr(S)
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
S=RevStr(S)
Comment=S
S=""
}
}
RT_DebugF("%3d ] $%06X : %-10s : %s",i,HexColor,NickName,Comment,name=myName) # Output to DebugView
RT_DBaseAppend(DB,HexColor,NickName,Comment) # Append record to DBase
}
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S) == RT_Ord("#")) { S="" } # Swallow, Only Comment Remaining
Assert(S=="",RT_String("%sString(%d) Non Parse @'%s'\n'%s'",myName,i,S,STR))
}
RT_DebugF("Nick DBase Created as %s",DB,name=myName)
""")
Return RT_DBaseRecords(DB) # Return Something
}
Function DB_FindVar(String DB, Int Field, Var) {
# DB_FindVar Returns record number containing Var in Field field, using Binary Search
# Var type can be Int, Float or String(Case Insig).
# DBase MUST be sorted ascending by Field.
# Field is the DB field that contains Var to find.
# Return record number or -1 = NOT FOUND.
result = -1 # Init NOT FOUND
GSCript("""
low = 0
high = RT_DBaseRecords(DB) - 1
while(low <= high) {
mid = (low + high) / 2
if(RT_DBaseGetField(DB,mid,Field) < Var) {
low = mid + 1
} Else If (RT_DBaseGetField(DB,mid,Field) > Var) {
high = mid - 1
} Else {
low = high + 1 # Force exit
Result = mid
}
}
""")
return result
}
CreateCommandByMapString.avs Using string
# CreateCommandByMapString.avs
Import("ClipClopControlFunctions.avs")
CONTROL_CLIP = "Control.AVI" # Name of Control.avi
CMD = "Command.Txt" # ClipClop Command file (Output of this script)
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
MAP = """ # RGB Hex Color Code, NickName, Color As Comment ('$000000 = SOURCE # BLACK' means original clip)
$000000 = SOURCE # BLACK
$0000FF = L0 # BLUE
$00FF00 = L1 # GREEN
$00FFFF = L2 # CYAN
$FF0000 = C0 # RED
$FF00FF = C1 # MAGENTA
$FFFF00 = C2 # YELLOW
$FFFFFF = LC0 # WHITE
$FFA500 = LC1 # ORANGE
$A9A9A9 = LC2 # DARKGRAY
$C0C0C0 = FH # SILVER
$DDA0DD = FV # PLUM
$B0E0E6 = INV # POWDERBLUE
"""
Avisource(CONTROL_CLIP).ConvertToRGB32 # Just incase RGB24
MakeColorNickDBase(DB,MAP_FN="",MAP=MAP) # Fill DB with Color->NickName data (sorted by HexColor)
CreateCommandFile(DB,CMD)
return MessageClip(RT_String("All Done, Created %s",CMD))
# Can Comment out above line and append ClipClop script after here, Command.txt will exist afer this line
CreateCommandByMapFile.avs, using file
# CreateCommandByMapFile.avs
Import("ClipClopControlFunctions.avs")
CONTROL_CLIP = "Control.AVI" # Name of Control.avi
CMD = "Command.Txt" # ClipClop Command file (Output of this script)
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
MAP_FN = "MapFile.txt" # MAP input from File
Avisource(CONTROL_CLIP).ConvertToRGB32 # Just incase RGB24
MakeColorNickDBase(DB,MAP_FN="MapFile.txt") # Fill DB with Color->NickName data (sorted by HexColor)
CreateCommandFile(DB,CMD)
# Where MAP_FN file contains eg THIS, but without preceding # comment characters
# $000000 = SOURCE # BLACK
# $0000FF = L0 # BLUE
# $00FF00 = L1 # GREEN
# $00FFFF = L2 # CYAN
# $FF0000 = C0 # RED
# $FF00FF = C1 # MAGENTA
# $FFFF00 = C2 # YELLOW
# $FFFFFF = LC0 # WHITE
# $FFA500 = LC1 # ORANGE
# $A9A9A9 = LC2 # DARKGRAY
# $C0C0C0 = FH # SILVER
# $DDA0DD = FV # PLUM
# $B0E0E6 = INV # POWDERBLUE
return MessageClip(RT_String("All Done, Created %s",CMD))
# Can Comment out above line and append ClipClop script after here, Command.txt will exist afer this line
And use separate ClipClop script (already given) or append it to the above last two scripts.
StainlessS
28th December 2014, 20:08
Post 2 of 2
And the last script given again as separate: (Showing ClipClop replacements as metrics)
ClipClop replacements done via Command.txt created from Control.AVI clip which would be created in NLE.
Avisource("D:\avs\test.avi")
SHOW=True
CMD="Command.Txt"
V0 = Last # SOURCE
V1 = FFT3DFilter(Plane=0,Sigma=1.6) # Light luma
V2 = FFT3DFilter(Plane=0,Sigma=2.0) # Med luma
V3 = FFT3DFilter(Plane=0,Sigma=4.0) # High luma
V4 = FFT3DFilter(Plane=3,Sigma=1.6) # Light Chroma
V5 = FFT3DFilter(Plane=3,Sigma=2.0) # Med Chroma
V6 = FFT3DFilter(Plane=3,Sigma=4.0) # High Chroma
V7 = FFT3DFilter(Plane=4,Sigma=1.6) # Light Luma+Chroma
V8 = FFT3DFilter(Plane=4,Sigma=2.0) # Med Luma+Chroma
V9 = FFT3DFilter(Plane=4,Sigma=4.0) # High Luma+Chroma
V10= FlipHorizontal() # Flip-H
V11= FlipVertical() # Flip-V
V12= Invert() # Invert
###
### HERE, You Assign NickNames to Clip Index. (You could if you wanted use color names, eg ORANGE as NickNames).
### RGB ColorCodes entered in Comments just as reminder
###
NickNames =""" # Psuedonyms for clip index
SOURCE = 0 # Original Clip BLACK
L0 = 1 # Light Luma BLUE
L1 = 2 # Med Luma GREEN
L2 = 3 # High Luma CYAN
C0 = 4 # Light Chroma RED
C1 = 5 # Med Chroma MAGENTA
C2 = 6 # High Chroma YELLOW
LC0 = 7 # Light Luma + Chroma WHITE
LC1 = 8 # Med Luma + Chroma ORANGE
LC2 = 9 # High Luma + Chroma DARKGRAY
FH = 10 # Flip-H SILVER
FV = 11 # Flip-V PLUM
INV = 12 # Invert POWDERBLUE
"""
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,cmd=CMD,nickname=NickNames,show=SHOW,dv=4)
EDIT: ClipClop Command.txt created from Dummy Test control clip will look like this
C0 0,99 # $FF0000 RED
L0 100,299 # $0000FF BLUE
INV 300,399 # $B0E0E6 POWDERBLUE
L0 400,499 # $0000FF BLUE
FH 500,599 # $C0C0C0 SILVER
LC2 600,699 # $A9A9A9 DARKGRAY
SOURCE 700,799 # $000000 BLACK
C1 800 # $FF00FF MAGENTA
SOURCE 801,899 # $000000 BLACK
L0 900,999 # $0000FF BLUE
FV 1000,1099 # $DDA0DD PLUM
SOURCE 1100,1999 # $000000 BLACK
LC1 2000,13860 # $FFA500 ORANGE
StainlessS
29th December 2014, 04:47
Post #1 of 2.
Well now, I've made a fully automated version of scripts.
CreateDynamicFiltering.avs
# CreateDynamicFiltering.avs
Function CreateDynamicFiltering(clip c,String "Map_Fn",String "Map", String "Nick", String "Cmd",String "Clop") {
/*
Scan Control clip c using MAP (FileName or String) and create NickName And/Or CMD Command file And/Or Clop Eval files.
MUST Supply either MAP_FN (FileName used in preference if both supplied) OR MAP as String.
Creates:-
Nick : NickName File
Cmd : Command File
Clop : ClipClop Eval file
Created files can be read into String using eg RT_ReadTxtFromFile(Nick)
Also Returns the ClipClop Eval()uation as a string as well as writing it to Clop file.
*/
c
myName="CreateDynamicFiltering: "
EV = ""
GSCript("""
if((Defined(MAP_FN) && Exist(MAP_FN))) {
RT_DebugF("Reading MAP from File '%s'",MAP_FN,name=myName)
MAP = RT_ReadTxtFromFile(MAP_FN)
} Else {
RT_DebugF("Using MAP String",name=myName)
MAP=Default(MAP,"")
}
Assert(MAP!="",RT_String("%sEither MAP_FN(Filename) or MAP(String) must be supplied",myName))
Nick=Default(Nick,"")
CMD=Default(CMD,"")
CLOP=Default(CLOP,"")
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
Fnd_S=RT_String("\t\n \n") # Replace TAB and double SPACE with Single SPACE
Rep_S=RT_String(" \n \n") # Double SPACE, Reduce STACK Usage for RT_StrReplaceDeep on long strings
MAP=RT_StrReplaceMulti(MAP,Fnd_S,Rep_S)
MAP=RT_StrReplaceDeep(MAP," "," ") # SPACE compact (multi to single SPACE)
NLINES = RT_TxtQueryLines(MAP) # Lines of text in MAP
MAP2=""
Colix=0
for(i=0,NLINES-1) {
S = RT_TxtGetLine(MAP,i) # Without trailing n/l
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S)!=RT_Ord("#") && RT_Ord(S)!=0) {
S = S + RT_String("%03d",Colix) # Append Color index prior to sort by HexColor
MAP2=RT_TxtAddStr(MAP2,S)
Colix=Colix+1
}
}
RT_DebugF("Creating DBase sorted ascending by HexColor '%s'",DB,name=myName)
RT_DBaseAlloc(DB,0,"issi") # Create zero record DB (Int,String,String,int)
M=RT_TxtSort(MAP2,Mode=0) # Sort Ascending, case insig (by Hex Color Code)
NLINES = RT_TxtQueryLines(M) # Lines of text in M
For(i=0,NLINES-1) {
STR = RT_TxtGetLine(M,i) # Without trailing n/l
Ln = StrLen(STR)
Colix = RT_NumberValue(STR,Pos=Ln-2) # Get original index before sort
STR = LeftStr(STR,Ln-3) # Strip off Colix
S = STR
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S)==RT_Ord("$")) {
S = MidStr(S,2) # Swalla the Dolla
c = UCase(MidStr(S,1,1))
IsHexDig = ((c>="0" && c<="9") || (c>="A" && c<="F"))
Assert(IsHexDig,RT_String("%sString(%d) Hex Color Code Missing @'%s'\n'%s'",myName,Colix,S,STR))
HexColor = RT_NumberValue(S,16)
While(StrLen(S)>=1 && IsHexDig) { # Swalla Hex
S = MidStr(S,2)
c = UCase(MidStr(S,1,1))
IsHexDig = ((c>="0" && c<="9") || (c>="A" && c<="F"))
}
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S)==RT_Ord("=")) {
S = MidStr(S,2) # Swalla optional '='
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
}
c = UCasE(MidStr(S,1,1))
Assert((c>="A" && c<="Z") || c=="_",RT_String("%sString(%d) NickName Missing @'%s'\n'%s'",myName,Colix,S,STR))
NickLen=1
SLen = StrLen(S)
For(j=2,Slen) {
c = UCase(MidStr(S,j,1))
if((c>="0" && c<="9") || (c>="A" && c<="Z") || c=="_") {
NickLen = NickLen + 1
} else {
j = SLen # Break
}
}
NickName = MidStr(S,1,NickLen)
S = MidStr(S,NickLen+1)
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
Comment = ""
if(RT_Ord(S)==RT_Ord("#")) {
S = MidStr(S,2) # Swalla Hash
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
if(StrLen(S)>0) { # End Trim White
S=RevStr(S)
While(RT_Ord(S)==32) {S=MidStr(S,2)} # Eat White
S=RevStr(S)
Comment=S
S=""
}
}
RT_DebugF("%3d ](%3d) $%06X : %-10s : %s",i,Colix,HexColor,NickName,Comment,name=myName)
Assert(!(HexColor==0 && Colix != 0),
\ RT_String("%sSOURCE Clip $000000 Can Only be defined first in MAP",myName))
RT_DBaseAppend(DB,HexColor,NickName,Comment,Colix) # Append record to DBase
}
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(RT_Ord(S) == RT_Ord("#")) { S="" } # Swallow, Only Comment Remaining
Assert(S=="",RT_String("%s %d String(%d) Non Parse @'%s'\n'%s'",myName,i,Colix,S,STR))
}
RECORDS = RT_DBaseRecords(DB)
HEXFIELD = 0 # Int field
NICKFIELD = 1 # String field
COMMFIELD = 2 # String field
COLIXFIELD = 3 # Int field
FC = FrameCount
OFFSET = (RT_DBaseGetField(DB,0,HEXFIELD)==0) ? 0 : 1 # Number from 1 if source NOT defined
if(Nick != "") {
RT_DebugF("Creating Nick File '%s' in original MAP order",Nick,name=myName)
RT_FileDelete(Nick)
}
if(OFFSET==1) {
EV="SOURCE" # SOURCE name not given in MAP USE name 'SOURCE'
} Else {
EV=RT_DBaseGetField(DB,0,NICKFIELD) # Use name given in MAP for source clip
}
for(i=0,RECORDS-1) {
Colix = -1
for(j=0,RECORDS-1) {
if(RT_DBaseGetField(DB,j,COLIXFIELD)==i) {
Colix = j
j = RECORDS # Break
}
}
Assert(j>=0, RT_String("%sColix %d NOT FOUND",myName,i))
Nick_S=RT_DBaseGetField(DB,Colix,NICKFIELD)
Comm_S=RT_DBaseGetField(DB,Colix,COMMFIELD)
S=RT_String("%-20s = %-6d # %s",Nick_S,i+Offset,Comm_S)
RT_DebugF("%s",S,name=myName)
(Nick!="") ? RT_WriteFile(Nick,"%s",S,Append=True) : NOP
if(OFFSET==1 || i != 0) {
EV=RT_String("%s,%s",EV,Nick_S)
}
}
EV=RT_String("ClipClop(%s,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)",EV)
RT_DebugF("EV = '%s'",EV,name=myName)
if(CLOP!="") {
RT_DebugF("Creating Clop File '%s'",CLOP,name=myName)
RT_WriteFile(CLOP,"%s",EV)
}
if(CMD != "") {
Rx = -1
CurrCol = -1
CurrNick = ""
CurrComm = ""
SFrm = 0
SRec = -1
RT_DebugF("Creating ClipClop Command File '%s'",CMD,name=myName)
RT_FileDelete(CMD) # Delete existing Command file
For(n=0,FC) {
# Sample single pixel RGB32 Color as Int (clr Alpha), Single Pixel @ Bottom RHS of frame
Dat = (n==FC) ? -1 : RT_BitAND(RT_RGB32AsInt(n=n,x=width-1,y=height-1),$FFFFFF)
if(n == FC || Dat != CurrCol) {
if(SRec>=0) { # Color found in DB ?
Frames = n - SFrm
if(Frames == 1) { # Write NickName and Single Frame Number
RT_DebugF("%-16s %6d # R%-3d $%06X %s",CurrNick,SFrm,Rx,CurrCol,CurrComm,name=myName)
RT_WriteFile(CMD,"%-16s %6d # R%-3d $%06X %s",CurrNick,SFrm,Rx,CurrCol,CurrComm,Append=True)
} Else { # Write NickName and Range
RngEnd=(n==FC) ? 0 : n-1 # AVOID ClipClop TRUNCATE Warning on Last frame, convert last frame to 0
RT_DebugF("%-16s %6d,%-6d # R%-3d $%06X %s",CurrNick,SFrm,RngEnd,Rx,CurrCol,CurrComm,name=myName)
RT_WriteFile(CMD,"%-16s %6d,%-6d # R%-3d $%06X %s",CurrNick,SFrm,RngEnd,Rx,CurrCol,CurrComm,Append=True)
}
}
if(n < FC) { # Else, ALL DONE .. writing LAST range only
CurrCol = Dat
SRec = DB_FindVar(DB,HEXFIELD,CurrCol)
Assert(SRec>=0 || CurrCol==0,RT_String("Cannot Find RGB Hex Color($%06X) in DBase @ Frame %d",CurrCol,n))
if(SRec>=0) {
CurrNick = RT_DBaseGetField(DB,SRec,NICKFIELD) # Get Associated NickName
CurrComm = RT_DBaseGetField(DB,SRec,COMMFIELD) # Get Associated Comment
Rx = RT_DBaseGetField(DB,SRec,COLIXFIELD) + OFFSET # Get Associated Rx clipNo
}
SFrm = n # REM new start frame
}
}
}
}
RT_DebugF("Deleting DBase '%s'",DB,name=myName)
RT_FileDelete(DB)
""")
RT_DebugF("Return EV String = '%s'",EV,name=myName)
Return EV
}
Function DB_FindVar(String DB, Int Field, Var) {
# DB_FindVar Returns record number containing Var in Field field, using Binary Search
# Var type can be Int, Float or String(Case Insig).
# DBase MUST be sorted ascending by Field.
# Field is the DB field that contains Var to find.
# Return record number or -1 = NOT FOUND.
result = -1 # Init NOT FOUND
GSCript("""
low = 0
high = RT_DBaseRecords(DB) - 1
while(low <= high) {
mid = (low + high) / 2
if(RT_DBaseGetField(DB,mid,Field) < Var) {
low = mid + 1
} Else If (RT_DBaseGetField(DB,mid,Field) > Var) {
high = mid - 1
} Else {
low = high + 1 # Force exit
Result = mid
}
}
""")
return result
}
EDITED: Convert Final Range End frame to 0 in command file, Avoid TRUNCATE Error from ClipClop if non existent last frame.
Unfortunately will still produce a Short Rx clip Error on any short clip.
Cant think of a way around that, Will have to set NoErr=True if any Rx clip is shorter than source.
EDIT: Fixed problem, did not like empty line in MAP file/string, Returned Clop instead of EV.
StainlessS
29th December 2014, 04:54
Post #2 of 2.
FullyAutomated.avs (If using example Dummy Control.AVI, then need TEST.AVI of at least 2001 frames).
# FullyAutomated.avs
Import("CreateDynamicFiltering.avs")
SOURCE_CLIP = "D:\AVS\TEST.AVI" # Clip we will edit
CONTROL_CLIP = "Control.AVI" # Name of Control.avi
CMD = "Command.Txt" # Output ClipClop Command file.
NICK = "NickNames.txt" # Output NickNames created as text file.
CLOP = "Eval.txt" # Output ClipClop() Fn call string, can use eg:- Eval(RT_ReadTxtFromFile(CLOP))
# MAP As String
MAP = """ # RGB Hex Color Code, NickName, Color As Comment ('$000000 = SOURCE # BLACK' means original clip)
$000000 = SOURCE # BLACK SOURCE MUST be FIRST in List (IF Defined in MAP) and is ALWAYS $000000 (Name can be anything)
$0000FF = L0 # BLUE
$00FF00 = L1 # GREEN
$00FFFF = L2 # CYAN
$FF0000 = C0 # RED
$FF00FF = C1 # MAGENTA
$FFFF00 = C2 # YELLOW
$FFFFFF = LC0 # WHITE
$FFA500 = LC1 # ORANGE
$A9A9A9 = LC2 # DARKGRAY
$C0C0C0 = FH # SILVER
$DDA0DD = FV # PLUM
$B0E0E6 = INV # POWDERBLUE
"""
MAP_FN = "MapFile.txt" # MAP input from File, Will be used in preference if both defined
# Where MAP_FN file contains eg THIS, but without preceding # comment characters on below lines
# $000000 = SOURCE # BLACK # If SOURCE ($000000) NOT defined in MAP, then will use name "SOURCE" in ClipClop Fn Call Eval.
# $0000FF = L0 # BLUE
# $00FF00 = L1 # GREEN
# $00FFFF = L2 # CYAN
# $FF0000 = C0 # RED
# $FF00FF = C1 # MAGENTA
# $FFFF00 = C2 # YELLOW
# $FFFFFF = LC0 # WHITE
# $FFA500 = LC1 # ORANGE
# $A9A9A9 = LC2 # DARKGRAY
# $C0C0C0 = FH # SILVER
# $DDA0DD = FV # PLUM
# $B0E0E6 = INV # POWDERBLUE
Avisource(CONTROL_CLIP).ConvertToRGB32 # Just incase RGB24
CreateDynamicFiltering(Last,Map_Fn=MAP_FN,Map=MAP,Nick=NICK,Cmd=CMD,Clop=CLOP)
#return MessageClip(RT_String("All Done"))
# Can Comment out above line and append ClipClop script after here, CMD/NICK/CLOP will exist after this line
# FULLY AUTOMATED
NICKNAMES = RT_ReadTxtFromFile(NICK)
CLOP_EVAL = RT_ReadTxtFromFile(CLOP)
SHOW=True NOERR=True DV=2 # ALL Args to CLOP_EVAL line. DV=2 shows Errors Converted to Warnings by NoErr=True (DebugView)
AviSource(SOURCE_CLIP) # Clip To Edit
# Filters, Same names as given in MAP
SOURCE = Last # SOURCE
L0 = FFT3DFilter(Plane=0,Sigma=1.6) # Light luma
L1 = FFT3DFilter(Plane=0,Sigma=2.0) # Med luma
L2 = FFT3DFilter(Plane=0,Sigma=4.0) # High luma
C0 = FFT3DFilter(Plane=3,Sigma=1.6) # Light Chroma
C1 = FFT3DFilter(Plane=3,Sigma=2.0) # Med Chroma
C2 = FFT3DFilter(Plane=3,Sigma=4.0) # High Chroma
LC0 = FFT3DFilter(Plane=4,Sigma=1.6) # Light Luma+Chroma
LC1 = FFT3DFilter(Plane=4,Sigma=2.0) # Med Luma+Chroma
LC2 = FFT3DFilter(Plane=4,Sigma=4.0) # High Luma+Chroma
FH = FlipHorizontal() # Flip-H
FV = FlipVertical() # Flip-V
INV = Invert() # Invert
Return Eval(CLOP_EVAL)
DebugView Output
00000002 0.20278674 CreateDynamicFiltering: Reading MAP from File 'MapFile.txt'
00000003 0.22251040 CreateDynamicFiltering: Creating DBase sorted ascending by HexColor '~20141229_034937_234.DB'
00000004 0.23438078 CreateDynamicFiltering: 0 ]( 0) $000000 : SOURCE : BLACK
00000005 0.24516383 CreateDynamicFiltering: 1 ]( 1) $0000FF : L0 : BLUE
00000006 0.25615713 CreateDynamicFiltering: 2 ]( 2) $00FF00 : L1 : GREEN
00000007 0.26697424 CreateDynamicFiltering: 3 ]( 3) $00FFFF : L2 : CYAN
00000008 0.27817574 CreateDynamicFiltering: 4 ]( 9) $A9A9A9 : LC2 : DARKGRAY
00000009 0.28926462 CreateDynamicFiltering: 5 ]( 12) $B0E0E6 : INV : POWDERBLUE
00000010 0.30016878 CreateDynamicFiltering: 6 ]( 10) $C0C0C0 : FH : SILVER
00000011 0.31095141 CreateDynamicFiltering: 7 ]( 11) $DDA0DD : FV : PLUM
00000012 0.32173738 CreateDynamicFiltering: 8 ]( 4) $FF0000 : C0 : RED
00000013 0.33265403 CreateDynamicFiltering: 9 ]( 5) $FF00FF : C1 : MAGENTA
00000014 0.34376201 CreateDynamicFiltering: 10 ]( 8) $FFA500 : LC1 : ORANGE
00000015 0.35456070 CreateDynamicFiltering: 11 ]( 6) $FFFF00 : C2 : YELLOW
00000016 0.36592817 CreateDynamicFiltering: 12 ]( 7) $FFFFFF : LC0 : WHITE
00000017 0.36759183 CreateDynamicFiltering: Creating Nick File 'NickNames.txt' in original MAP order
00000018 0.36864978 CreateDynamicFiltering: SOURCE = 0 # BLACK
00000019 0.37004855 CreateDynamicFiltering: L0 = 1 # BLUE
00000020 0.37148258 CreateDynamicFiltering: L1 = 2 # GREEN
00000021 0.37301189 CreateDynamicFiltering: L2 = 3 # CYAN
00000022 0.37512287 CreateDynamicFiltering: C0 = 4 # RED
00000023 0.37731051 CreateDynamicFiltering: C1 = 5 # MAGENTA
00000024 0.37969103 CreateDynamicFiltering: C2 = 6 # YELLOW
00000025 0.38217422 CreateDynamicFiltering: LC0 = 7 # WHITE
00000026 0.38454363 CreateDynamicFiltering: LC1 = 8 # ORANGE
00000027 0.38617417 CreateDynamicFiltering: LC2 = 9 # DARKGRAY
00000028 0.38801461 CreateDynamicFiltering: FH = 10 # SILVER
00000029 0.38996705 CreateDynamicFiltering: FV = 11 # PLUM
00000030 0.39180571 CreateDynamicFiltering: INV = 12 # POWDERBLUE
00000031 0.39244157 CreateDynamicFiltering: EV = 'ClipClop(SOURCE,L0,L1,L2,C0,C1,C2,LC0,LC1,LC2,FH,FV,INV,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)'
00000032 0.39254886 CreateDynamicFiltering: Creating Clop File 'Eval.txt'
00000033 0.39292222 CreateDynamicFiltering: Creating ClipClop Command File 'Command.Txt'
00000034 0.84333616 CreateDynamicFiltering: C0 0,99 # R4 $FF0000 RED
00000035 1.71050107 CreateDynamicFiltering: L0 100,299 # R1 $0000FF BLUE
00000036 2.17401648 CreateDynamicFiltering: INV 300,399 # R12 $B0E0E6 POWDERBLUE
00000037 2.60471487 CreateDynamicFiltering: L0 400,499 # R1 $0000FF BLUE
00000038 2.99368501 CreateDynamicFiltering: FH 500,599 # R10 $C0C0C0 SILVER
00000039 3.38014126 CreateDynamicFiltering: LC2 600,699 # R9 $A9A9A9 DARKGRAY
00000040 3.77110720 CreateDynamicFiltering: SOURCE 700,799 # R0 $000000 BLACK
00000041 3.77731323 CreateDynamicFiltering: C1 800 # R5 $FF00FF MAGENTA
00000042 4.16515779 CreateDynamicFiltering: SOURCE 801,899 # R0 $000000 BLACK
00000043 4.59448576 CreateDynamicFiltering: L0 900,999 # R1 $0000FF BLUE
00000044 5.05833197 CreateDynamicFiltering: FV 1000,1099 # R11 $DDA0DD PLUM
00000045 8.58264160 CreateDynamicFiltering: SOURCE 1100,1999 # R0 $000000 BLACK
00000046 63.95636749 CreateDynamicFiltering: LC1 2000,0 # R8 $FFA500 ORANGE : EDIT: Last Frame to 0
00000047 63.95710373 CreateDynamicFiltering: Deleting DBase '~20141229_034937_234.DB'
00000048 63.95765305 CreateDynamicFiltering: Return EV String = 'ClipClop(SOURCE,L0,L1,L2,C0,C1,C2,LC0,LC1,LC2,FH,FV,INV,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)'
You could keep the same map file and filters (adding to them where necessary), ClipClop copes with up to 255 replacement Rx clips
so there are probably a few spare. So long as MAP and Filters keep same names then pretty much fully automatic.
If you dont use all filters named in MAP, it dont really matter much and would save editing time after time.
If you dont use SOURCE in MAP file (ie $000000, could actually be named anything) then SOURCE ranges will not appear
in the ClipClop command file (not necessary anyway), BUT, you must use name "SOURCE" for source clip if the name
does NOT appear in the MAP file (1st item as $000000).
You could eg use "$000000 = Last # BLACK" to use Last as first arg to ClipCLop or choose some other name for the source.
EDIT: Changed to NoErr=True.
EDIT: You could also add eg "Flip Horizontal" or whatever to comments in MAP to also show in Both NickNames and Command File,
and print out MAP file as reference.
StainlessS
29th December 2014, 11:11
Demo_2, Use updated CreateDynamicFiltering.avs from post #66.
MakeControlClipAVI_2.avs Makes for a more interesting DEMO, more interesting than different settings to FFT3DFilter. Save result as Control_2.avi, RGB
# MakeControlClipAVI_2.avs, Make Dummy control clip for testing, Save to Control_2.AVI
# Take Blankclip attributes from this, At Least 2000 frames, and at least MOD 4 both Width and Height
ORG=Avisource("D:\avs\test.avi").ConvertToRGB32().KillAudio
ORG=ORG.Trim(0,-2000) # To give Explicit attributes to BlankClip
SHOW=True # Simulate USER TEXT/NOTES on frame
BLACK = $000000
BLUE = $0000FF
GREEN = $00FF00
CYAN = $00FFFF
RED = $FF0000
MAGENTA = $FF00FF
YELLOW = $FFFF00
WHITE = $FFFFFF
ORANGE = $FFA500
DARKGRAY = $A9A9A9
SILVER = $C0C0C0
PLUM = $DDA0DD
POWDERBLUE = $B0E0E6
V0 = ORG.BlankClip(Color=BLACK)
V1 = ORG.BlankClip(Color=BLUE)
V2 = ORG.BlankClip(Color=GREEN)
V3 = ORG.BlankClip(Color=CYAN)
V4 = ORG.BlankClip(Color=RED)
V5 = ORG.BlankClip(Color=MAGENTA)
V6 = ORG.BlankClip(Color=YELLOW)
V7 = ORG.BlankClip(Color=WHITE)
V8 = ORG.BlankClip(Color=ORANGE)
V9 = ORG.BlankClip(Color=DARKGRAY)
V10 = ORG.BlankClip(Color=SILVER)
V11 = ORG.BlankClip(Color=PLUM)
V12 = ORG.BlankClip(Color=POWDERBLUE)
NickNames =""" # Psuedonyms for clip index
SOURCE = 0 # SOURCE BLACK
FLIP_HORIZ = 1 # FLIP_HORIZ BLUE
FLIP_VERT = 2 # FLIP_VERT GREEN
NEGATIVE = 3 # NEGATIVE CYAN
TOP_FLIP_H = 4 # OP_FLIP_H RED
BOT_FLIP_H = 5 # BOT_FLIP_H MAGENTA
LFT_FLIP_V = 6 # LFT_FLIP_V YELLOW
RGT_FLIP_V = 7 # RGT_FLIP_V WHITE
INSIDE_OUT = 8 # INSIDE_OUT ORANGE
OUTSIDE_IN = 9 # OUTSIDE_IN DARKGRAY
TWIST_1 = 10 # TWIST_1 SILVER
TWIST_2 = 11 # TWIST_2 PLUM
TWIST_3 = 12 # TWIST_3 POWDERBLUE
"""
SCMD=""" # Clip editing commands in string, can also use commands in file
FLIP_HORIZ 50, 99 # FLIP_HORIZ BLUE
FLIP_VERT 150,199 # FLIP_VERT GREEN
NEGATIVE 250,299 # NEGATIVE CYAN
TOP_FLIP_H 350,399 # OP_FLIP_H RED
BOT_FLIP_H 450,499 # BOT_FLIP_H MAGENTA
LFT_FLIP_V 550,599 # LFT_FLIP_V YELLOW
RGT_FLIP_V 650,699 # RGT_FLIP_V WHITE
INSIDE_OUT 750,799 # INSIDE_OUT ORANGE
OUTSIDE_IN 850,899 # OUTSIDE_IN DARKGRAY
TWIST_1 950,999 # TWIST_1 SILVER
TWIST_2 1050,1099 # TWIST_2 PLUM
TWIST_3 1150,1199 # TWIST_3 POWDERBLUE
NEGATIVE 1250,1299 # NEGATIVE CYAN
LFT_FLIP_V 1350,1399 # LFT_FLIP_V YELLOW
INSIDE_OUT 1450,1499 # INSIDE_OUT ORANGE
OUTSIDE_IN 1550,1599 # OUTSIDE_IN DARKGRAY
TWIST_2 1650,1699 # TWIST_2 PLUM
FLIP_HORIZ 1750,1799 # FLIP_HORIZ BLUE
BOT_FLIP_H 1850,1899 # BOT_FLIP_H MAGENTA
RGT_FLIP_V 1900,1910 # RGT_FLIP_V WHITE
FLIP_HORIZ 1911,1919 # FLIP_HORIZ BLUE
FLIP_VERT 1920,1929 # FLIP_VERT GREEN
NEGATIVE 1930,1939 # NEGATIVE CYAN
TOP_FLIP_H 1940,1949 # OP_FLIP_H RED
BOT_FLIP_H 1950,1959 # BOT_FLIP_H MAGENTA
LFT_FLIP_V 1960,1969 # LFT_FLIP_V YELLOW
RGT_FLIP_V 1970,1979 # RGT_FLIP_V WHITE
INSIDE_OUT 1980,1989 # INSIDE_OUT ORANGE
NEGATIVE 1990,1999 # NEGATIVE CYAN
"""
Return ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW)
FullyAutomated_2.avs
# FullyAutomated_2.avs
Import("CreateDynamicFiltering.avs")
SOURCE_CLIP = "D:\AVS\TEST.AVI" # Clip we will edit
CONTROL_CLIP = "Control_2.AVI" # Name of Control_2.avi
CMD = "Command.Txt" # Output ClipClop Command file.
NICK = "NickNames.txt" # Output NickNames created as text file.
CLOP = "Eval.txt" # Output ClipClop() Fn call string, can use eg:- Eval(RT_ReadTxtFromFile(CLOP))
MAP_FN = "" # Use MAP String
MAP = """
$000000 = SOURCE # BLACK ...... The Source Clip
$0000FF = FLIP_HORIZ # BLUE ....... Flip Clip Horizontal
$00FF00 = FLIP_VERT # GREEN ...... Flip Clip Vertical
$00FFFF = NEGATIVE # CYAN ....... Photo Negative
$FF0000 = TOP_FLIP_H # RED ........ Flip Top Half Horizontally
$FF00FF = BOT_FLIP_H # MAGENTA .... Flip Bot Half Horizontally
$FFFF00 = LFT_FLIP_V # YELLOW ..... Flip Left Half Vertically
$FFFFFF = RGT_FLIP_V # WHITE ...... Flip Right Half Vertically
$FFA500 = INSIDE_OUT # ORANGE ..... Flip Inside Out
$A9A9A9 = OUTSIDE_IN # DARKGRAY ... Flip Outside In
$C0C0C0 = TWIST_1 # SILVER ..... Twist One
$DDA0DD = TWIST_2 # PLUM ....... Twist Two - Twiddle-de-dum
$B0E0E6 = TWIST_3 # POWDERBLUE . Twist Three - Twiddle-de-dee
"""
Avisource(CONTROL_CLIP).ConvertToRGB32 # Just incase RGB24
CreateDynamicFiltering(Last,Map_Fn=MAP_FN,Map=MAP,Nick=NICK,Cmd=CMD,Clop=CLOP)
# FULLY AUTOMATED
NICKNAMES = RT_ReadTxtFromFile(NICK)
CLOP_EVAL = RT_ReadTxtFromFile(CLOP)
SHOW=True NOERR=True DV=2 # ALL Args to CLOP_EVAL line. DV=2 shows Errors Converted to Warnings by NoErr=True (DebugView)
FC = FrameCount # Length of Control_2.avi
AviSource(SOURCE_CLIP) # Clip To Edit
Trim(0,-FC) # Trim to same length as Control_2.avi
W=Width H=Height TOP=Crop(0,0,-0,H/2) BOT=Crop(0,H/2,-0,-0) LFT=Crop(0,0,W/2,-0) RGT=Crop(W/2,0,-0,-0)
TL=Crop(TOP,0,0,W/2,-0) TR=Crop(TOP,W/2,0,-0,-0) BL=Crop(BOT,0,0,W/2,-0) BR=Crop(BOT,W/2,0,-0,-0)
# Filters, Same names as given in MAP
SOURCE = Last # BLACK
FLIP_HORIZ = FlipHorizontal # BLUE
FLIP_VERT = FlipVertical # GREEN
NEGATIVE = Invert # CYAN
TOP_FLIP_H = StackVertical(TOP.FlipHorizontal,BOT) # RED
BOT_FLIP_H = StackVertical(TOP,BOT.FlipHorizontal) # MAGENTA
LFT_FLIP_V = StackHorizontal(LFT.FlipVertical,RGT) # YELLOW
RGT_FLIP_V = StackHorizontal(LFT,RGT.FlipVertical) # WHITE
INSIDE_OUT = StackHorizontal(LFT.FlipHorizontal,RGT.FlipHorizontal) # ORANGE
OUTSIDE_IN = StackVertical(TOP.FlipVertical,BOT.FlipVertical) # DARKGRAY
TWIST_1 = StackVertical(StackHorizontal(TL.FlipHorizontal,TR),StackHorizontal(BL,BR.FlipHorizontal)) # SILVER
TWIST_2 = StackVertical(StackHorizontal(TR.FlipHorizontal,TL),StackHorizontal(BR.FlipHorizontal,BL)) # PLUM
TWIST_3 = StackVertical(TOP.FlipVertical,BOT.FlipHorizontal) # POWDERBLUE
Return Eval(CLOP_EVAL)
StainlessS
29th December 2014, 11:16
And DebugView Log
00000002 0.19205773 CreateDynamicFiltering: Using MAP String
00000003 0.21202493 CreateDynamicFiltering: Creating DBase sorted ascending by HexColor '~20141229_100033_781.DB'
00000004 0.22382456 CreateDynamicFiltering: 0 ]( 0) $000000 : SOURCE : BLACK ...... The Source Clip
00000005 0.23732845 CreateDynamicFiltering: 1 ]( 1) $0000FF : FLIP_HORIZ : BLUE ....... Flip Clip Horizontal
00000006 0.25042251 CreateDynamicFiltering: 2 ]( 2) $00FF00 : FLIP_VERT : GREEN ...... Flip Clip Vertical
00000007 0.26322070 CreateDynamicFiltering: 3 ]( 3) $00FFFF : NEGATIVE : CYAN ....... Photo Negative
00000008 0.27672395 CreateDynamicFiltering: 4 ]( 9) $A9A9A9 : OUTSIDE_IN : DARKGRAY ... Flip Outside In
00000009 0.28917295 CreateDynamicFiltering: 5 ]( 12) $B0E0E6 : TWIST_3 : POWDERBLUE . Twist Three - Twiddle-de-dee
00000010 0.30160838 CreateDynamicFiltering: 6 ]( 10) $C0C0C0 : TWIST_1 : SILVER ..... Twist One
00000011 0.31413016 CreateDynamicFiltering: 7 ]( 11) $DDA0DD : TWIST_2 : PLUM ....... Twist Two - Twiddle-de-dum
00000012 0.32784876 CreateDynamicFiltering: 8 ]( 4) $FF0000 : TOP_FLIP_H : RED ........ Flip Top Half Horizontally
00000013 0.34128883 CreateDynamicFiltering: 9 ]( 5) $FF00FF : BOT_FLIP_H : MAGENTA .... Flip Bot Half Horizontally
00000014 0.35477117 CreateDynamicFiltering: 10 ]( 8) $FFA500 : INSIDE_OUT : ORANGE ..... Flip Inside Out
00000015 0.36849031 CreateDynamicFiltering: 11 ]( 6) $FFFF00 : LFT_FLIP_V : YELLOW ..... Flip Left Half Vertically
00000016 0.38205004 CreateDynamicFiltering: 12 ]( 7) $FFFFFF : RGT_FLIP_V : WHITE ...... Flip Right Half Vertically
00000017 0.38367817 CreateDynamicFiltering: Creating Nick File 'NickNames.txt' in original MAP order
00000018 0.38474014 CreateDynamicFiltering: SOURCE = 0 # BLACK ...... The Source Clip
00000019 0.38614258 CreateDynamicFiltering: FLIP_HORIZ = 1 # BLUE ....... Flip Clip Horizontal
00000020 0.38757873 CreateDynamicFiltering: FLIP_VERT = 2 # GREEN ...... Flip Clip Vertical
00000021 0.38910508 CreateDynamicFiltering: NEGATIVE = 3 # CYAN ....... Photo Negative
00000022 0.39120102 CreateDynamicFiltering: TOP_FLIP_H = 4 # RED ........ Flip Top Half Horizontally
00000023 0.39341486 CreateDynamicFiltering: BOT_FLIP_H = 5 # MAGENTA .... Flip Bot Half Horizontally
00000024 0.39582002 CreateDynamicFiltering: LFT_FLIP_V = 6 # YELLOW ..... Flip Left Half Vertically
00000025 0.39830449 CreateDynamicFiltering: RGT_FLIP_V = 7 # WHITE ...... Flip Right Half Vertically
00000026 0.40058807 CreateDynamicFiltering: INSIDE_OUT = 8 # ORANGE ..... Flip Inside Out
00000027 0.40226093 CreateDynamicFiltering: OUTSIDE_IN = 9 # DARKGRAY ... Flip Outside In
00000028 0.40410590 CreateDynamicFiltering: TWIST_1 = 10 # SILVER ..... Twist One
00000029 0.40608183 CreateDynamicFiltering: TWIST_2 = 11 # PLUM ....... Twist Two - Twiddle-de-dum
00000030 0.40790662 CreateDynamicFiltering: TWIST_3 = 12 # POWDERBLUE . Twist Three - Twiddle-de-dee
00000031 0.40859395 CreateDynamicFiltering: EV = 'ClipClop(SOURCE,FLIP_HORIZ,FLIP_VERT,NEGATIVE,TOP_FLIP_H,BOT_FLIP_H,
LFT_FLIP_V,RGT_FLIP_V,INSIDE_OUT,OUTSIDE_IN,TWIST_1,TWIST_2,TWIST_3,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)'
00000032 0.40870163 CreateDynamicFiltering: Creating Clop File 'Eval.txt'
00000033 0.40909293 CreateDynamicFiltering: Creating ClipClop Command File 'Command.Txt'
00000034 0.61077183 CreateDynamicFiltering: SOURCE 0,49 # R0 $000000 BLACK ...... The Source Clip
00000035 0.82366997 CreateDynamicFiltering: FLIP_HORIZ 50,99 # R1 $0000FF BLUE ....... Flip Clip Horizontal
00000036 1.02896714 CreateDynamicFiltering: SOURCE 100,149 # R0 $000000 BLACK ...... The Source Clip
00000037 1.29458177 CreateDynamicFiltering: FLIP_VERT 150,199 # R2 $00FF00 GREEN ...... Flip Clip Vertical
00000038 1.49403942 CreateDynamicFiltering: SOURCE 200,249 # R0 $000000 BLACK ...... The Source Clip
00000039 1.70791316 CreateDynamicFiltering: NEGATIVE 250,299 # R3 $00FFFF CYAN ....... Photo Negative
00000040 1.90301514 CreateDynamicFiltering: SOURCE 300,349 # R0 $000000 BLACK ...... The Source Clip
00000041 2.12429881 CreateDynamicFiltering: TOP_FLIP_H 350,399 # R4 $FF0000 RED ........ Flip Top Half Horizontally
00000042 2.32055068 CreateDynamicFiltering: SOURCE 400,449 # R0 $000000 BLACK ...... The Source Clip
00000043 2.55672026 CreateDynamicFiltering: BOT_FLIP_H 450,499 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
00000044 2.75106955 CreateDynamicFiltering: SOURCE 500,549 # R0 $000000 BLACK ...... The Source Clip
00000045 2.96424341 CreateDynamicFiltering: LFT_FLIP_V 550,599 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
00000046 3.16437221 CreateDynamicFiltering: SOURCE 600,649 # R0 $000000 BLACK ...... The Source Clip
00000047 3.36836219 CreateDynamicFiltering: RGT_FLIP_V 650,699 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
00000048 3.56777978 CreateDynamicFiltering: SOURCE 700,749 # R0 $000000 BLACK ...... The Source Clip
00000049 3.79759407 CreateDynamicFiltering: INSIDE_OUT 750,799 # R8 $FFA500 ORANGE ..... Flip Inside Out
00000050 3.99366331 CreateDynamicFiltering: SOURCE 800,849 # R0 $000000 BLACK ...... The Source Clip
00000051 4.18874121 CreateDynamicFiltering: OUTSIDE_IN 850,899 # R9 $A9A9A9 DARKGRAY ... Flip Outside In
00000052 4.38312626 CreateDynamicFiltering: SOURCE 900,949 # R0 $000000 BLACK ...... The Source Clip
00000053 4.57942247 CreateDynamicFiltering: TWIST_1 950,999 # R10 $C0C0C0 SILVER ..... Twist One
00000054 4.77466249 CreateDynamicFiltering: SOURCE 1000,1049 # R0 $000000 BLACK ...... The Source Clip
00000055 5.00851536 CreateDynamicFiltering: TWIST_2 1050,1099 # R11 $DDA0DD PLUM ....... Twist Two - Twiddle-de-dum
00000056 5.21740913 CreateDynamicFiltering: SOURCE 1100,1149 # R0 $000000 BLACK ...... The Source Clip
00000057 5.45531130 CreateDynamicFiltering: TWIST_3 1150,1199 # R12 $B0E0E6 POWDERBLUE . Twist Three - Twiddle-de-dee
00000058 5.65429068 CreateDynamicFiltering: SOURCE 1200,1249 # R0 $000000 BLACK ...... The Source Clip
00000059 5.86816120 CreateDynamicFiltering: NEGATIVE 1250,1299 # R3 $00FFFF CYAN ....... Photo Negative
00000060 6.07028580 CreateDynamicFiltering: SOURCE 1300,1349 # R0 $000000 BLACK ...... The Source Clip
00000061 6.28816700 CreateDynamicFiltering: LFT_FLIP_V 1350,1399 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
00000062 6.49028587 CreateDynamicFiltering: SOURCE 1400,1449 # R0 $000000 BLACK ...... The Source Clip
00000063 6.72671080 CreateDynamicFiltering: INSIDE_OUT 1450,1499 # R8 $FFA500 ORANGE ..... Flip Inside Out
00000064 6.92327070 CreateDynamicFiltering: SOURCE 1500,1549 # R0 $000000 BLACK ...... The Source Clip
00000065 7.12100935 CreateDynamicFiltering: OUTSIDE_IN 1550,1599 # R9 $A9A9A9 DARKGRAY ... Flip Outside In
00000066 7.31760788 CreateDynamicFiltering: SOURCE 1600,1649 # R0 $000000 BLACK ...... The Source Clip
00000067 7.55307007 CreateDynamicFiltering: TWIST_2 1650,1699 # R11 $DDA0DD PLUM ....... Twist Two - Twiddle-de-dum
00000068 7.74782181 CreateDynamicFiltering: SOURCE 1700,1749 # R0 $000000 BLACK ...... The Source Clip
00000069 7.95937300 CreateDynamicFiltering: FLIP_HORIZ 1750,1799 # R1 $0000FF BLUE ....... Flip Clip Horizontal
00000070 8.16053391 CreateDynamicFiltering: SOURCE 1800,1849 # R0 $000000 BLACK ...... The Source Clip
00000071 8.39559174 CreateDynamicFiltering: BOT_FLIP_H 1850,1899 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
00000072 8.44144154 CreateDynamicFiltering: RGT_FLIP_V 1900,1910 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
00000073 8.48491192 CreateDynamicFiltering: FLIP_HORIZ 1911,1919 # R1 $0000FF BLUE ....... Flip Clip Horizontal
00000074 8.53645515 CreateDynamicFiltering: FLIP_VERT 1920,1929 # R2 $00FF00 GREEN ...... Flip Clip Vertical
00000075 8.58113575 CreateDynamicFiltering: NEGATIVE 1930,1939 # R3 $00FFFF CYAN ....... Photo Negative
00000076 8.62534714 CreateDynamicFiltering: TOP_FLIP_H 1940,1949 # R4 $FF0000 RED ........ Flip Top Half Horizontally
00000077 8.67389107 CreateDynamicFiltering: BOT_FLIP_H 1950,1959 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
00000078 8.71722698 CreateDynamicFiltering: LFT_FLIP_V 1960,1969 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
00000079 8.75890350 CreateDynamicFiltering: RGT_FLIP_V 1970,1979 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
00000080 8.80840874 CreateDynamicFiltering: INSIDE_OUT 1980,1989 # R8 $FFA500 ORANGE ..... Flip Inside Out
00000081 8.84838963 CreateDynamicFiltering: NEGATIVE 1990,0 # R3 $00FFFF CYAN ....... Photo Negative
00000082 8.84903336 CreateDynamicFiltering: Deleting DBase '~20141229_100033_781.DB'
00000083 8.84959221 CreateDynamicFiltering: Return EV String = 'ClipClop(SOURCE,FLIP_HORIZ,FLIP_VERT,NEGATIVE,TOP_FLIP_H,
BOT_FLIP_H,LFT_FLIP_V,RGT_FLIP_V,INSIDE_OUT,OUTSIDE_IN,TWIST_1,TWIST_2,TWIST_3,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)'
Long lines wrapped around.
Hotte
29th December 2014, 14:29
Oops, I am a bit confused by this intensive posting (I know all the postings are for all the world, and - really - more people should learn about what they can achieve with clipclop when working with an NLE).
Is this just a summary or does this mean you wrote a one-pass solution (no need to extra build the command file and then to build the final) ?
My 2-pass script is almost finished (my final clipclop-script already includes all the functions I apply to my clips). It was quite some work. I am not working with test clips anymore but with real cut videos. Do you recommend to change anything to my script to benefit from the above ?
StainlessS
29th December 2014, 18:16
When I get started I dont like to stop till done.
The last script (+ post #66) does the lot in a single pass, if required.
It allows you to accumulate a library of regularly used filters, and to not have to re-write scripts for every job, only the Control.avi is required
to be modified, and perhaps the file names of source and control.avi.
As you need another filter, just add to current library in map, and create the filter chain for it, eg "NEGATIVE = Invert() # CYAN".
Of course the Demo creation clip in previous post is not necessary, it just creates a test Control clip for me (or anyone else interested).
And apart from a few little bits in 2nd script, (eg the trim to match control_2.avi length), it is pretty much all that is needed.
You could save the MAP to file rather than have it in script, and also create your filter library in an AVS which could be imported,
remaining script would just be a few lines giving names, calling creator function and then calling the eval, simplicity itself.
If you already have your map, then easy to change, use whatever names you already are using, same for filters, cannot be that difficult (EDIT: Filter names need change to same as MAP), the comments are still optional, you dont have to have them.
If you do not use all filters in a particular job, it dont really matter, might take a few milliseconds longer to call the filter constructors
before first frame is served, but who cares, lot less work. When you get to eg 100+ clips, it may start getting sluggish, it does that
in DoctorFrames script in ClipClop zip where all 255 Replacement clips are used for Interpolation of up to a range of 22 frames,
where you start getting out of memory errors (Solved by reducing SetMemoryMax). Probably some time before you need worry about
that, and if you do, just comment out the MAP entries and filters that you are not using on that job.
The FullyAutomated thing only needs a MAP, control clip and filters, but only significant change in any job would be the control
clip, map and filters could remain largely the same as other jobs.
Give the demo a whirl, just need a 2000 frame clip, can create Control_2.avi in about two minutes.
EDIT: The MAP is unchanged from previous (I think), only the filter clip names have been changed from eg V10 to NEGATIVE,
to match those used in MAP. (V10 is shorter than eg NEGATIVE, that is why I used that style to save work, but if it can be
automated, then name length is not an issue).
EDIT: Below Auto created from Control_2.avi and MAP.
Nicknames.txt
SOURCE = 0 # BLACK ...... The Source Clip
FLIP_HORIZ = 1 # BLUE ....... Flip Clip Horizontal
FLIP_VERT = 2 # GREEN ...... Flip Clip Vertical
NEGATIVE = 3 # CYAN ....... Photo Negative
TOP_FLIP_H = 4 # RED ........ Flip Top Half Horizontally
BOT_FLIP_H = 5 # MAGENTA .... Flip Bot Half Horizontally
LFT_FLIP_V = 6 # YELLOW ..... Flip Left Half Vertically
RGT_FLIP_V = 7 # WHITE ...... Flip Right Half Vertically
INSIDE_OUT = 8 # ORANGE ..... Flip Inside Out
OUTSIDE_IN = 9 # DARKGRAY ... Flip Outside In
TWIST_1 = 10 # SILVER ..... Twist One
TWIST_2 = 11 # PLUM ....... Twist Two - Twiddle-de-dum
TWIST_3 = 12 # POWDERBLUE . Twist Three - Twiddle-de-dee
Command.txt
SOURCE 0,49 # R0 $000000 BLACK ...... The Source Clip
FLIP_HORIZ 50,99 # R1 $0000FF BLUE ....... Flip Clip Horizontal
SOURCE 100,149 # R0 $000000 BLACK ...... The Source Clip
FLIP_VERT 150,199 # R2 $00FF00 GREEN ...... Flip Clip Vertical
SOURCE 200,249 # R0 $000000 BLACK ...... The Source Clip
NEGATIVE 250,299 # R3 $00FFFF CYAN ....... Photo Negative
SOURCE 300,349 # R0 $000000 BLACK ...... The Source Clip
TOP_FLIP_H 350,399 # R4 $FF0000 RED ........ Flip Top Half Horizontally
SOURCE 400,449 # R0 $000000 BLACK ...... The Source Clip
BOT_FLIP_H 450,499 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
SOURCE 500,549 # R0 $000000 BLACK ...... The Source Clip
LFT_FLIP_V 550,599 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
SOURCE 600,649 # R0 $000000 BLACK ...... The Source Clip
RGT_FLIP_V 650,699 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
SOURCE 700,749 # R0 $000000 BLACK ...... The Source Clip
INSIDE_OUT 750,799 # R8 $FFA500 ORANGE ..... Flip Inside Out
SOURCE 800,849 # R0 $000000 BLACK ...... The Source Clip
OUTSIDE_IN 850,899 # R9 $A9A9A9 DARKGRAY ... Flip Outside In
SOURCE 900,949 # R0 $000000 BLACK ...... The Source Clip
TWIST_1 950,999 # R10 $C0C0C0 SILVER ..... Twist One
SOURCE 1000,1049 # R0 $000000 BLACK ...... The Source Clip
TWIST_2 1050,1099 # R11 $DDA0DD PLUM ....... Twist Two - Twiddle-de-dum
SOURCE 1100,1149 # R0 $000000 BLACK ...... The Source Clip
TWIST_3 1150,1199 # R12 $B0E0E6 POWDERBLUE . Twist Three - Twiddle-de-dee
SOURCE 1200,1249 # R0 $000000 BLACK ...... The Source Clip
NEGATIVE 1250,1299 # R3 $00FFFF CYAN ....... Photo Negative
SOURCE 1300,1349 # R0 $000000 BLACK ...... The Source Clip
LFT_FLIP_V 1350,1399 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
SOURCE 1400,1449 # R0 $000000 BLACK ...... The Source Clip
INSIDE_OUT 1450,1499 # R8 $FFA500 ORANGE ..... Flip Inside Out
SOURCE 1500,1549 # R0 $000000 BLACK ...... The Source Clip
OUTSIDE_IN 1550,1599 # R9 $A9A9A9 DARKGRAY ... Flip Outside In
SOURCE 1600,1649 # R0 $000000 BLACK ...... The Source Clip
TWIST_2 1650,1699 # R11 $DDA0DD PLUM ....... Twist Two - Twiddle-de-dum
SOURCE 1700,1749 # R0 $000000 BLACK ...... The Source Clip
FLIP_HORIZ 1750,1799 # R1 $0000FF BLUE ....... Flip Clip Horizontal
SOURCE 1800,1849 # R0 $000000 BLACK ...... The Source Clip
BOT_FLIP_H 1850,1899 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
RGT_FLIP_V 1900,1910 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
FLIP_HORIZ 1911,1919 # R1 $0000FF BLUE ....... Flip Clip Horizontal
FLIP_VERT 1920,1929 # R2 $00FF00 GREEN ...... Flip Clip Vertical
NEGATIVE 1930,1939 # R3 $00FFFF CYAN ....... Photo Negative
TOP_FLIP_H 1940,1949 # R4 $FF0000 RED ........ Flip Top Half Horizontally
BOT_FLIP_H 1950,1959 # R5 $FF00FF MAGENTA .... Flip Bot Half Horizontally
LFT_FLIP_V 1960,1969 # R6 $FFFF00 YELLOW ..... Flip Left Half Vertically
RGT_FLIP_V 1970,1979 # R7 $FFFFFF WHITE ...... Flip Right Half Vertically
INSIDE_OUT 1980,1989 # R8 $FFA500 ORANGE ..... Flip Inside Out
NEGATIVE 1990,0 # R3 $00FFFF CYAN ....... Photo Negative
Eval.txt (With line extension character inserted for long line)
ClipClop(SOURCE,FLIP_HORIZ,FLIP_VERT,NEGATIVE,TOP_FLIP_H,BOT_FLIP_H,LFT_FLIP_V,RGT_FLIP_V,INSIDE_OUT,OUTSIDE_IN,TWIST_1,
\ TWIST_2,TWIST_3,NickName=NICKNAMES,Cmd=CMD,Show=SHOW,NoErr=NoERR,dv=DV)
EDIT: If you want, I could change (or take a Bool arg in creator script) to generate the ClipClop() clip names in (Eval.txt) as either 'Long' Filter clip names eg 'NEGATIVE' as used in MAP, or short eg 'V3', less typing for you to create filters, but you would probably want to add comment like
eg "# V3 = NEGATIVE" or something like that, its up to you, what you want ?
Hotte
29th December 2014, 21:16
Sounds very good. I will try that later.
At the moment I am heavily struggling with MT-Modes. MDegrain3 noise reduction used to run fast & fine with SetMTMode(2,8) and so did Interframe.
With ClipClop the same thing does not work anymore like this. Instead I am getting strange messages like:
access violation at 0x0000207E in C:\Program Files (x86)\AviSynth\plugins\mvtools2.dll,
attempting to read from 0x00000347
(D:\Temp\Videotest\Indextifs\Create Final.avs, line 348)
(D:\Temp\Videotest\Indextifs\Create Final.avs, line 205)
(D:\Temp\Videotest\Indextifs\Create Final.avs, line 33)
The lines are nonsense apart from 348 which is
clp = MDegrain3(clp,super,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=400)
Running the same thing with SetMTMode(5,8) brings absolutely no message and runs fine, but soooo slow.
Using clipclop changes the behaviour of MT and I have not found a way yet to bring MDegrain3, Interframe and clipclop into one script with acceptable processing speed.
Not to be misunderstood, I do not expect you to look into my code (Newbie etc), but could you say a few words of how to handle SetMTMode's when using clipclop ?
If you would like to have a look onto how I work with clipclop find some lines (extract) here. The error occured whilst loading this script and clipclop would have to go through $847E50 OLIV to perform MDegrain3.
SetMemoryMax(768)
SetMTMode(2,8)
# ------------ PLUGINS LADEN
#
PluginPath = "C:\Diverses\AvisynthPlugins\Interframe\"
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\dither.dll")
Import("C:\Program Files (x86)\AviSynth\plugins\dither.avsi")
Avisource("D:\Temp\Videotest\Indextifs\Testmix2.avi")
ConvertToYV12()
CMD="D:\Temp\Videotest\Indextifs\Command2.Txt"
V0 = Last # $000000 SOURCE
V1 = MDG2() # $C7C3A0 OLIV HELL MDegrain2
V2 = MDG3() # $847E50 OLIV MITTEL MDegrain3
V3 = SH1_DHSS_MDG3() # $CDDCF0 BLAU S.HELL Sharpen1 + DeHalo antialias + MDegrain3
V4 = SH2_DHSS_MDG3() # $90B5DF BLAU HELL Sharpen2 + DeHalo antialias + MDegrain3
V5 = SH3_DHSS_MDG3() # $0B3AF7 BLAU MITTEL Sharpen3 + DeHalo antialias + MDegrain3
V6 = SH4_DHSS_MDG3() # $052199 BLAU DUNKEL Sharpen4 + DeHalo antialias + MDegrain3
V7 = IF24() # $FEFFB3 GELB Interframe 24>50p
V8 = IF24_MDG3() # $F8FF0A GELB Interframe 24>50p + MDegrain3
V9 = IF25() # $FADE66 ORANGE HELL Interframe 25>50p
V10 = IF25_MDG3() # $F4C508 ORANGE Interframe 25>50p + MDegrain3
V11 = IF30() # $F47482 ROT HELL Interframe 30>50p
V12 = IF30_MDG3() # $E20002 ROT Interframe 30>50p + MDegrain3
V13 = IF24_SH1_DHSS_MDG3() # $FACFC0 TERRA S.HELL IF24>50p + sharpen1 + dehalo anti-alias + MDegrain3
V14 = IF24_SH2_DHSS_MDG3() # $F09876 TERRA HELL IF24>50p + sharpen2 + dehalo anti-alias + MDegrain3
V15 = IF24_SH3_DHSS_MDG3() # $DB420D TERRA MITTEL IF24>50p + sharpen3 + dehalo anti-alias + MDegrain3
V16 = IF24_SH4_DHSS_MDG3() # $A7320A TERRA DUNKEL IF24>50p + sharpen4 + dehalo anti-alias + MDegrain3
V17 = IF25_SH1_DHSS_MDG3() # $D9BFEC FLIEDER S.HELL IF25>50p + sharpen1 + dehalo anti-alias + MDegrain3
V18 = IF25_SH2_DHSS_MDG3() # $BF93DD FLIEDER HELL IF25>50p + sharpen2 + dehalo anti-alias + MDegrain3
V19 = IF25_SH3_DHSS_MDG3() # $9544C6 FLIEDER MITTEL IF25>50p + sharpen3 + dehalo anti-alias + MDegrain3
V20 = IF25_SH4_DHSS_MDG3() # $5E1D87 FLIEDER DUNKEL IF25>50p + sharpen4 + dehalo anti-alias + MDegrain3
V21 = IF30_SH1_DHSS_MDG3() # $FBC9FF PINK S.HELL IF30>50p + sharpen1 + dehalo anti-alias + MDegrain3
V22 = IF30_SH2_DHSS_MDG3() # $F56CFA PINK HELL IF30>50p + sharpen2 + dehalo anti-alias + MDegrain3
V23 = IF30_SH3_DHSS_MDG3() # $EB00F6 PINK MITTEL IF30>50p + sharpen3 + dehalo anti-alias + MDegrain3
V24 = IF30_SH4_DHSS_MDG3() # $A200A9 PINK DUNKEL IF30>50p + sharpen4 + dehalo anti-alias + MDegrain3
###
### HERE, You Assign NickNames to Clip Index. (You could if you wanted use color names, eg ORANGE as NickNames).
### RGB ColorCodes entered in Comments just as reminder
### NickNames MUST match those used in previous script
NickNames =""" # Psuedonyms for clip index
SOURCE = 0 # $000000 SOURCE
MDG2 = 1 # $C7C3A0 OLIV HELL MDegrain2
MDG3 = 2 # $847E50 OLIV MITTEL MDegrain3
SH1_DHSS_MDG3 = 3 # $CDDCF0 BLAU S.HELL Sharpen minimal + DeHalo antialias + MDegrain3
SH2_DHSS_MDG3 = 4 # $90B5DF BLAU HELL Sharpen light + DeHalo antialias + MDegrain3
SH3_DHSS_MDG3 = 5 # $0B3AF7 BLAU MITTEL Sharpen normal + DeHalo antialias + MDegrain3
SH4_DHSS_MDG3 = 6 # $052199 BLAU DUNKEL Sharpen strong + DeHalo antialias + MDegrain3
IF24 = 7 # $FEFFB3 GELB Interframe 24>50p
IF24_MDG3 = 8 # $F8FF0A GELB Interframe 24>50p + MDegrain3
IF25 = 9 # $FADE66 ORANGE HELL Interframe 25>50p
IF25_MDG3 = 10 # $F4C508 ORANGE Interframe 25>50p + MDegrain3
IF30 = 11 # $F47482 ROT HELL Interframe 30>50p
IF30_MDG3 = 12 # $E20002 ROT Interframe 30>50p + MDegrain3
IF24_SH1_DHSS_MDG3 = 13 # $FACFC0 TERRA S.HELL IF24>50p + sharpen1 + dehalo anti-alias + MDegrain3
IF24_SH2_DHSS_MDG3 = 14 # $F09876 TERRA HELL IF24>50p + sharpen2 + dehalo anti-alias + MDegrain3
IF24_SH3_DHSS_MDG3 = 15 # $DB420D TERRA MITTEL IF24>50p + sharpen3 + dehalo anti-alias + MDegrain3
IF24_SH4_DHSS_MDG3 = 16 # $A7320A TERRA DUNKEL IF24>50p + sharpen4 + dehalo anti-alias + MDegrain3
IF25_SH1_DHSS_MDG3 = 17 # $D9BFEC FLIEDER S.HELL IF25>50p + sharpen1 + dehalo anti-alias + MDegrain3
IF25_SH2_DHSS_MDG3 = 18 # $BF93DD FLIEDER HELL IF25>50p + sharpen2 + dehalo anti-alias + MDegrain3
IF25_SH3_DHSS_MDG3 = 19 # $9544C6 FLIEDER MITTEL IF25>50p + sharpen3 + dehalo anti-alias + MDegrain3
IF25_SH4_DHSS_MDG3 = 20 # $5E1D87 FLIEDER DUNKEL IF25>50p + sharpen4 + dehalo anti-alias + MDegrain3
IF30_SH1_DHSS_MDG3 = 21 # $FBC9FF PINK S.HELL IF30>50p + sharpen1 + dehalo anti-alias + MDegrain3
IF30_SH2_DHSS_MDG3 = 22 # $F56CFA PINK HELL IF30>50p + sharpen2 + dehalo anti-alias + MDegrain3
IF30_SH3_DHSS_MDG3 = 23 # $EB00F6 PINK MITTEL IF30>50p + sharpen3 + dehalo anti-alias + MDegrain3
IF30_SH4_DHSS_MDG3 = 24 # $A200A9 PINK DUNKEL IF30>50p + sharpen4 + dehalo anti-alias + MDegrain3
"""
SHOW=False
NOERR=True
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20,V21,V22,V23,V24,cmd=CMD,nickname=NickNames,show=SHOW,NoErr=NOERR)
....
function MDG3(clip clp)
{
clp = mdg3(clp)
return(clp)
}
....
function mdg3(clip clp)
{
super = MSuper(clp, pel=2, sharp=1)
bv3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8)
bv2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8)
bv1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8)
fv1 = MAnalyse(super, isb = false, delta = 1, blksize=16, overlap=8)
fv2 = MAnalyse(super, isb = false, delta = 2, blksize=16, overlap=8)
fv3 = MAnalyse(super, isb = false, delta = 3, blksize=16, overlap=8)
clp = MDegrain3(clp,super,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=400)
return(clp)
}
StainlessS
29th December 2014, 21:51
Sorry cant help on MT, never even tried it. EDIT: ClipClop should behave not much different to a whole bunch of trim and splice filters.
What exactly is this supposed to do, and which mdg3 gets called, is it recursively calling itself or the other function of SAME NAME,
kinda curious to what is happening there ?
function MDG3(clip clp)
{
clp = mdg3(clp)
return(clp)
}
....
function mdg3(clip clp)
Have you just implemented that yourself, if so then looks like an OUT OF STACK ERROR, due to repeatedly calling itself in a never ending loop.
EDIT: mdg3 and MDG3 are identical names, casing is irrelevant. I think above snippet would be calling itself, although I'm not sure.
Comment out the FULL MDG3 function (Uppercase), do you still crash ?
EDIT: By the way, can insert into your recursive function that calls itself this:-
RT_DebugF("MDG3 Calling MDG3")
And see what it shows in DebugView, you will probably see lots and lots of messages, until it crashes.
Hotte
29th December 2014, 22:11
:( my goodness, what a stupid type mismatch. Of course that could not work. Thank you.
I will report later about my experience with MT and all the rest.
StainlessS
29th December 2014, 22:30
By the way, it would be MUCH more efficient to do the eg MDeGrain2/MDeGrain3 stuff at main level script rather than script functions, and
avoid repeatedly making similar clips, from eg MSuper amd MAnalyse etc. Much harder to do than using nice tidy pre-made script functions,
which are WAY SLOWER and more heavy on system resources. You are likely making many identical clips in many different scripts functions.
That is pretty much the same problem faced in the DoctorFrames script in ClipClop zip, where we try to re-use identical clips over and over again.
eg only a few MSupers for many result clips.
EDIT: Looking again at your script, you will likely find big problems due to copious use of eg MDegrain and the MvTools stuff,
you may run into same problems mentioned elsewhere for frame interpolation where you will get out of memory errors that
can sometime be cured by setting lower SetMemoryMax. I found in DoctorFrames using all 22 interpolation ranges that I had to SetMemoryMax(256), otherwise ran out of memory. (I've only got 4GB XP32), other people with eg 8GB were having exactly the
same problems. Strangely, I tried on a Pentium 4 with only 750MB of ram on the same script and it ran without error (albeit slowly).
I have suspected for some time that there is some kind of problem in either Windows or Avisynth concerning allocation of
Virtual Memory. (You can get out of memory errors when the pagefile is full but where you still seem to have quite a bit of un-allocated
RAM free, increasing pagefile size does not seem to help much, still claims to be out of memory at about the same size).
Hotte
30th December 2014, 00:16
Well, first of all the double use of mdg3 / MDG3 had - strange but real - no effect (after I renamed mdg3 to fmdg3).
Concerning SetMTMode() after intensive testing I found out, that clipclop needs a different approach if using SetMTMode() for temporal multithreading:
1. It seems to me that a SetMTMode()-command within a function that is being called by clipclop has absolutely no effect
2. Therefore the SetMTMode() before the clipclop-call is the one that applies for all the functions that are being called by clipclop
3. that means, if I am using a filter which is only compatible with slow SetMTMode(5), everything has to go to that SetMTMode(5) and the SetMTMode(5)-command has to be placed just before the clipclop call
4. I did not manage to go through more than two threads. If I went beyond I got either crashes or MDegrain3 produced ghosting or I got strange errormessages with script-line Numbers that did not exist....
5. In a constellation where I used Interframe and MDegrain3 at the same time the best I could squeeze out was SetMode(4,2) without flaws (see code-structure below). It is much slower than SetMTMode(2,8) that works well standalone, but not bad either, because it doubles processing speed
6. I had difficulties using Interframe and not having any SetMTMode() (Error-Messages).
SetMTMode(3) before the load-plugins is recommended.
SetMemoryMax(512)
SetMTMode(3,2)
# ------------ PLUGINS LADEN
#
PluginPath = "C:\Diverses\AvisynthPlugins\Interframe\"
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\dither.dll")
Import("C:\Program Files (x86)\AviSynth\plugins\dither.avsi")
Avisource("D:\Temp\Videotest\Indextifs\Testmix2.avi")
ConvertToYV12()
CMD="D:\Temp\Videotest\Indextifs\Command2.Txt"
V0 = Last # $000000 SOURCE
V1 = MDG2() # $C7C3A0 OLIV HELL MDegrain2
V2 = MDG3() # $847E50 OLIV MITTEL MDegrain3
....
###
### HERE, You Assign NickNames to Clip Index. (You could if you wanted use color names, eg ORANGE as NickNames).
### RGB ColorCodes entered in Comments just as reminder
### NickNames MUST match those used in previous script
NickNames =""" # Psuedonyms for clip index
SOURCE = 0 # $000000 SOURCE
MDG2 = 1 # $C7C3A0 OLIV HELL MDegrain2
MDG3 = 2 # $847E50 OLIV MITTEL MDegrain3
....
"""
SHOW=False
NOERR=True
SetMTMode(4)
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20,V21,V22,V23,V24,cmd=CMD,nickname=NickNames,show=SHOW,NoErr=NOERR)
Hotte
30th December 2014, 00:24
StainlessS, I haven´t quite understood in detail you remarks about MDegrain3. Do you mean I should call MDegrain3 before I go into clipclop ?
Well, using MDegrain3 should be part of the whole postprocessing-color-index concept: I only switch it on with an index color, when I want it.I do not want to return to any preprocessing-MDegrain3-stuff. And for this convenience I am ready to pay with processing speed.
Or maybe I misunderstood you ?
StainlessS
30th December 2014, 01:15
V1 = MDG2() # $C7C3A0 OLIV HELL MDegrain2
V2 = MDG3() # $847E50 OLIV MITTEL MDegrain3
Both MDegrain2 and MDegrain3 call MSuper on same clip and both consume resources. It could be achieved by using a single MSuper clip
if the innards of both scripts were taken out of the script function and into the main level script, then both could share the same instance of MSuper clip.
function mdg3(clip clp)
{
super = MSuper(clp, pel=2, sharp=1)
bv3 = MAnalyse(super, isb = true, delta = 3, blksize=16, overlap=8)
bv2 = MAnalyse(super, isb = true, delta = 2, blksize=16, overlap=8)
bv1 = MAnalyse(super, isb = true, delta = 1, blksize=16, overlap=8)
fv1 = MAnalyse(super, isb = false, delta = 1, blksize=16, overlap=8)
fv2 = MAnalyse(super, isb = false, delta = 2, blksize=16, overlap=8)
fv3 = MAnalyse(super, isb = false, delta = 3, blksize=16, overlap=8)
clp = MDegrain3(clp,super,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=400)
return(clp)
Take a look at that, then take a look at MDegrain2, they will look very similar, with clips that could be shared between both functions.
Here, snippet from DoctorFrames, clip I and clip sup used many times (and many more not shown).
Equivalent to 6 different interpolation functions, all multiply re-using same clip and sharing the same resources.
CP = c.DeleteFrame(c.Framecount()-1).DuplicateFrame(0)
CN = c.DuplicateFrame(c.Framecount()-1).DeleteFrame(0)
###
I = CP
sup = I.MSuper(pel=pel, sharp=sharp, rfilter=rfilter)
###
BAD = 1
I01_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I01_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I01_01 = I.MFlowInter(sup,I01_bv,I01_fv, time=100.0 * 1 / (BAD+1) , ml=ml)
BAD = 2
I02_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I02_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I02_01 = I.MFlowInter(sup,I02_bv,I02_fv, time=100.0 * 1 / (BAD+1), ml=ml)
I02_02 = I.MFlowInter(sup,I02_bv,I02_fv, time=100.0 * 2 / (BAD+1), ml=ml)
BAD = 3
I03_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I03_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I03_01 = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 1 / (BAD+1), ml=ml)
I03_02 = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 2 / (BAD+1), ml=ml)
I03_03 = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 3 / (BAD+1), ml=ml)
BAD = 4
I04_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I04_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I04_01 = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 1 / (BAD+1), ml=ml)
I04_02 = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 2 / (BAD+1), ml=ml)
I04_03 = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 3 / (BAD+1), ml=ml)
I04_04 = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 4 / (BAD+1), ml=ml)
BAD = 5
I05_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I05_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I05_01 = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 1 / (BAD+1), ml=ml)
I05_02 = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 2 / (BAD+1), ml=ml)
I05_03 = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 3 / (BAD+1), ml=ml)
I05_04 = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 4 / (BAD+1), ml=ml)
I05_05 = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 5 / (BAD+1), ml=ml)
BAD = 6
I06_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I06_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I06_01 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 1 / (BAD+1), ml=ml)
I06_02 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 2 / (BAD+1), ml=ml)
I06_03 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 3 / (BAD+1), ml=ml)
I06_04 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 4 / (BAD+1), ml=ml)
I06_05 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 5 / (BAD+1), ml=ml)
I06_06 = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 6 / (BAD+1), ml=ml)
DoctorFrames supports up to 22 frame interpolation (uses about 256 clips in ClipClop, and that includes shared clips),
above shows only 1 to 6 frame interpolation clips.
Even using above tactics, DoctorFrames still runs low on resources if trying to use all 22 interpolations.
Hotte
30th December 2014, 01:28
V1 = MDG2() # $C7C3A0 OLIV HELL MDegrain2
V2 = MDG3() # $847E50 OLIV MITTEL MDegrain3
Both MDegrain2 and MDegrain3 call MSuper on same clip and both consume resources. It could be achieved by using a single MSuper clip
Are you sure ? MDG2 will only be used for regions of the clip that had been marked with Color $C7C3A0, MDG3 only for those regions that had been marked with Color $847E50 in NLE ?!
StainlessS
30th December 2014, 01:35
Those two instances share the same Last input clip.
What I am suggesting would not be easy to implement.
You would need to match functions that share same input, a bit of a Can Of Worms.
Are you sure ? MDG2 will only be used for regions of the clip that had been marked with Color $C7C3A0, MDG3 only for those regions that had been marked with Color $847E50 in NLE ?!
Those clips are created for the full range of input clip, the fact that you are only interested in using some parts of the result
is not really relevant.
EDIT:
Function MCDegrain(clip c, int "frames")
{ # By Didee, http://forum.doom9.org/showthread.php?p=1508289#post1508289
frames = default(frames, 2)
bs = (c.width>960) ? 16 : 8
super = c.MSuper(pel=2, sharp=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)
(frames<=0) ? c :\
(frames==1) ? c.MDegrain1(super, backward_vec1,forward_vec1,thSAD=400) :\
(frames==2) ? c.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) :\
c.MDegrain3(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=400)
return(last)
}
Here, all three MDegrain1,2,3 share some common clips, as implemented in script, it returns a single clip based upon whatever the input clip is, if used multiple times with same input clip and even same frames arg, it creates unique instances, all duplicates of each other with
duplication of resources used.
If something like this implemented in main level script:
# where c = input clip
super = c.MSuper(pel=2, sharp=1)
bs = 16 # Ignoring clip width and just selecting bs=16
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)
C_MDEGRAIN_1 = c.MDegrain1(super, backward_vec1,forward_vec1,thSAD=400)
C_MDEGRAIN_2 = c.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
C_MDEGRAIN_1 = c.MDegrain3(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=400)
super # Available for any filter wanting super of c
backward_vec1 # Available for any filter wanting backward_vec1 of c
backward_vec2 # Available for any filter wanting backward_vec2 of c
backward_vec3 # Available for any filter wanting backward_vec3 of c
forward_vec1 # Available for any filter wanting forward_vec1 of c
forward_vec2 # Available for any filter wanting forward_vec2 of c
forward_vec3 # Available for any filter wanting forward_vec3 of c
C_MDEGRAIN_1 # Available for any filter wanting MDEGRAIN1 of c
C_MDEGRAIN_2 # Available for any filter wanting MDEGRAIN2 of c
C_MDEGRAIN_3 # Available for any filter wanting MDEGRAIN3 of c
Then would make available to other filters the clips shown in blue
EDIT: And the Sharp version, can integrate with above and have lots of options available on clip c
Function MCDegrainSharp(clip c, int "frames", float "bblur", float "csharp", bool "bsrch")
{ # Based on MCDegrain By Didee, http://forum.doom9.org/showthread.php?t=161594
# Also based on DiDee observations in this thread: http://forum.doom9.org/showthread.php?t=161580
# "Denoise with MDegrainX, do slight sharpening where motionmatch is good, do slight blurring where motionmatch is bad"
# In areas where MAnalyse cannot find good matches, the blur() will be dominant.
# In areas where good matches are found, the sharpen()'ed pixels will overweight the blur()'ed pixels
# when the pixel averaging is performed.
frames = default(frames, 2)
bblur = default(bblur, 0.6)
csharp = default(csharp, 0.6)
bsrch = default(bsrch, true)
bs = (c.width>960) ? 16 : 8
c2 = c.blur(bblur)
super = bsrch ? c2.MSuper(pel=2, sharp=1) : c.MSuper(pel=2, sharp=1)
super_rend = c.sharpen(csharp).MSuper(pel=2, sharp=1,levels=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)
(frames<=0) ? c :\
(frames==1) ? c2.MDegrain1(super_rend, backward_vec1,forward_vec1,thSAD=400) :\
(frames==2) ? c2.MDegrain2(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) :\
c2.MDegrain3(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=400)
return(last)
}
Hotte
30th December 2014, 01:57
I think we better stop at this point. I am trying to make clipclop work for my vision to have an automated postprocessing. But continuing with my tests I am starting to see the limits, and I do not know if I will be getting a working solution. Interframe in post is a very hard task and I am not sure, if it will work correctly. This is not a problem of clipclop but a problem of my vision.
Still I am trying to find something that just simply works without thinking too much of performance issues. ...Let`s see.
Hotte
30th December 2014, 02:40
One big issue is, that SelectEven() before Interframe has to be applied, when the cutting point (= start of frameregion in commandfile) is even, and SelectOdd() if the cutting point is odd. I do not know how to solve this apart from manually in NLE.
Contrary to my former post any form of Mulithreading is not recommended, since ghosting issues in MDegrain3 do not go away. If SetMTMode is needed for Interframe, then SetMode(5,1) seems to work for all. This is making everything pretty slow, but convenience counts more, since post can run the night through. Who cares ?
StainlessS
30th December 2014, 02:49
One big issue is, that SelectEven() before Interframe has to be applied, when the cutting point (= start of frameregion in commandfile) is even, and SelectOdd() if the cutting point is odd. I do not know how to solve this apart from manually in NLE.
Can you expand on exactly what you mean there, give a few example numbers. I'm going to bed in a moment, real tired. Read reply in the morn.
Hotte
30th December 2014, 03:21
You are a nice guy, StainlessS, really. The issue is simple: A 25p clip is being imported into an Edius 50p project. When I export this 50p Project to hand it on to clipclop it looks like:
frame 0 of 25p (good frame)
frame 0+1 blended (bad frame)
frame 1 of 25p (good )
frame 1+2 blended (bad)
frame 2 of 25p (good )
etc.
What I did is to SelectEven() to get rid of the bad frames and immediately after I did Interframe to interpolate back to 50p. That worked perfectly until the first odd starting point of a clipclop-clip appeared in commandfile (e.g. 827) which led to interpolate all the bad frames.:( The cutting point can be even or odd - whatever. I tried SelectEvery(clip,2) but that did not work correctly...Maybe the solution is simple: It is always frame 1,3,5 which is bad and 0,2,4 which is good relative to the starting point - no matter where clipclop put it.
Hotte
30th December 2014, 12:15
StainlessS I will be offline for 2 or 3 days. Whish you a wonderful new years eve.
StainlessS
30th December 2014, 12:16
Hotte, can you please post or PM me your script, if too big then can create account on MediaFire, not such a problem, dont take long and quite handy to
have, they do not delete your files after some arbitrary time period.
Or maybe one of the file hosts that do not require registration, maybe see SendSpace, think that you can post without account there but not sure,
SendSpace deletes your files if not downloaded for a time period (30 days I think).
EDIT: And you too sir. Happy New Year :)
EDIT: Yep, got the message.
Hotte
30th December 2014, 13:54
(You should have received a private message).
Back again, listening. Hope you happily arrived in 2015...
MrPete
1st January 2015, 15:07
Such an interesting process!
Stainless, I'm thinking the same idea could be used in a different way to simplify other processes.
In general, your pre-scan tool can recognize various color-based markers and write a control file that then can be used to drive processing.
One of my thoughts: semi-automated processing of captured clips, based on recognition of a few seconds of (black/dark, or white/light, or ???) in between clips. I'm capturing film so this would just be leader frames...
In my case I have a LOT of film to process (20k+ feet of my own family, plus doing more to help out a few friends ;) )... I could even see use of various leader-colors to mark up the physical film. (Never tried it yet, but it would be interesting to see if magic marker on white leader could become a "control method"!
On the NLE side, I personally use my NLE *after* AVIsynth... but I can similarly see how people could insert short color clips to mark transition points in AVIsynth processing.
The key change for all of these variations: the markers are "in band" rather than "out of band" (for those with a telephony background)... presumably one would want the generated processing script to leave out the control segments.
I'll see if I can physically make a sample of leader+junk film and see what kind of source file can be made. This could get interesting!
(VERY practical example: if magic marker can be recognized, I could easily mark a few inches of leader for each film to indicate the kind of film... thus indicating the grain/noise/sharpness characteristics ;) )
Hmmm... now that I've written the above... perhaps I'm being dumb: has anyone written an AVIsynth function/filter that can recognize low/med/high levels of grain in a clip?
StainlessS
2nd January 2015, 18:19
You need to come up with some method to unmistakably identify marker frames, without that it is not feasible, magic marker dont do it.
In addition, you would have the problem of removing the marker frames from results.
The method proposed by PoinsonDeathRay is best solution I can think of (well, he could think of).
EDIT: Wondering if PDR gave the solution implemented in this thread a bash.
Hotte
28th January 2015, 20:23
Some interim info.
Meanwhile I have turned away from indexing my NLE-Video with colors.
I found a much more flexible approach to work with clipclop: In Edius NLE I can leave a comment with every cut clip portion. What I do is to put short key-instructions like "MDG2" (for MDegrain2) or "IF2550" (for Interframe 25>50) or "FSH4" (fine-sharpen type 4) to tell clipclop how it should post-process this clip portion.
At the end of the editing process an Autohotkey-Script scans the whole timeline, collects all the comments and builds the commandfile for clipclop. Autohotkey is a very powerful macro generator tool designed to automate applications of any kind. This way I can easily solve all the issues with odd and even interframe-replacements and much more. Contrary to the color-index approach I do not have to keep color index and clips aligned when moving and cutting objects. I just put the comment once and forget about the rest - thats a dream!
Even more: Autohotkey will write the whole clipclop script (by changing a basic template). So I do not have to predefine nicknames and functions for filter combinations that are not used in the end, because autohotkey will only create nicknames and functions for those combinations found in the actual timeline. This gives me almost unlimited choices (I will never have projects with more than 255 clips or at least none with more than 255 different filter combinations).
At the moment I am involved in the Autohotkey-Script.
And it seems that I found a working approach for MT-modes with clipclop too. Processing speed really goes up.
If anyone is interested I will eventually come back to report more about it. Thanks for all the help so far.
StainlessS
28th January 2015, 21:04
If anyone is interested I will eventually come back to report more about it. Thanks for all the help so far.
Yes do, I'm sure there will be those that are interested (I dont use NLE so not for me).
I have AutoHotKey (probably a couple of years old now) but prefer to use the original AutoIt (they were once a single project, developers fell out over something).
I use AutoIt in MeGUI AutoEncode and DGIndex Batchers (search, or see Mediafire in my sig).
Glad you are now a happy chappy :)
Hotte
9th February 2015, 14:41
Hi,
well here is a 'how to' do automated postprocessing with EDIUS NLE and clipclop.
Basic approach:
1. Use clip properties in EDIUS to put names for avisynth filters that you would like to have applied to this clip after NLE. I use patterns like ~MDG2 (Mdegrain2) or ~DH (DeHalo_alpha).
2. Write a autohotkey-script which scans the EDIUS-timeline clip by clip and set markers for each clip´s start and end position. Identify their filter-patterns
3. Export the markers using built-in function in EDIUS (done by autohotkey). Use timecode with ms to be able to fix 50p frames at their correct position
4. Autohotkey builds the command-file for clipclop. And even more: It builds the whole avs-script. It detects filter-combinations used more than once and thus optimizes nicknames and functions.
5. Export the timeline using Canopus-Codec to get an avi
6. Run the avs-script to have automated filtering for each clip.
I know it is somewhat complicated and you need to have a very good understanding of how macro generator autohotkey works. This is just for illustration, what you can do.
I added the autohotkey-script here as inspiration - but I will NOT provide any support - because this will lead us off-topic.
It works nicely for me.
Autohotkey-Script. Just inspiration - NO SUPPORT HERE:
#ifWinActive EDIUS ahk_class CtsGuiClass.Frame
RButton:: f_edi_jump()
f_edi_jump() ; Rechts-Doppelklick prüfen
{ KeyWait, RButton, T0.12 ; Warte 120 ms auf das Loslassen des 1. Rechtsklick
if errorlevel ; 1. Rechtsklick wurde zu lang gehalten
Send {RButton}
else ; 1. Rechtsklick wurde rechtzeitig losgelassen
{ KeyWait, RButton, D T0.15 ; Warte 150 ms auf das Drücken eines 2. Rechtsklick
if errorlevel ; 2. Rechtsklick zu spät
Send {RButton}
else
f_edi_jump_on()
}
Return
}
f_edi_jump_on()
{ dn := ""
comlines :=
t2 :=
;WinSet,AlwaysOnTop,On,EDIUS ahk_class CtsGuiClass.Frame
;WinRestore,EDIUS ahk_class CtsGuiClass.Frame
;WinSet,Enable,,EDIUS ahk_class CtsGuiClass.Frame
FileDelete,D:\Temp\ed_command.txt ; Alte command-Datei aus Temp entfernen
FileDelete,D:\Temp\ed_bericht.txt ; Alte Berichts-Datei aus Temp entfernen
FileDelete,D:\Temp\ed_export.avs ; Alte Berichts-Datei aus Temp entfernen
Click
Send !u
WinWait,Dauer,,1
if ErrorLevel
Return ; Tritt ein, wenn User auf Lücke oder Overlay-Bereich
Send {Esc}
Send ^0 ; Zeitskala Timeline auf Vollabbild
Send !+v ; Alle Marker löschen
IfWinNotExist,ahk_class CtsGuiClass.Frame,Informationen ; Informationen Palette nicht vorhanden ?
Send ^!i ; Aktiveren (umschalten). TASTE MUSS IN EDIUS GGF. BELEGT WERDEN
ControlGet,t,List,,SysListView321,ahk_class CtsGuiClass.Frame
if Instr(t,"Verstärkung") ; User clickt Audiospur. Provoziert Überspringen von Standalone-Videos.
{ Send !{Up} ; Setze Fokus eins höher, um auf Videospur darüber zu kommen
Sleep 100
ControlGet,t,List,,SysListView321,ahk_class CtsGuiClass.Frame ; Lese Clipinfos erneut aus
if not Instr(t,"Seitenverhältnis") ; Nicht auf einem Video/Foto ? (z.B. weil nur Audiospur vorhanden)
{ msgbox,Bitte auf Videoclip (nicht Audio) klicken und wiederholen
Return ; Abbrechen. Wir brauchen unbedingt den Click auf einem Video/Foto.
}
}
;WinSet,Enable,,ahk_class CtsGuiClass.Frame,Informationen
; --- An den Anfang der Timline gehen
Send {End}
Sleep 200
ControlGetText,tcEnde,Edit9,EDIUS ahk_class Canopus.Edius.1 ; Hole Ende-Timecode der Timeline aus dem Player
Send {Home} ; Timeline-Cursor an Bildanfang
loop,1000 ; Schleife, um Bildauswahl auf 1. Clip zu setzen
{ Send !{Left} ; Einen Clip weiter zurück auswählen
loop,10 ; Bis zu 10x Clip-Info lesen, ob was Neues kommt
{ ControlGet,t,List,,SysListView321,ahk_class CtsGuiClass.Frame ; Hole Datei-Infos aus Informationen-Reiter
} until (t != t2)
if (t = t2) ; Immer noch nichts Neues ?
break ; dann sind wir am linken Anschlag => verlasse Schleife
t2 := t
}
; --- Edius-Timeline von Anfang bis Ende scannen
clp_count := 0
t2 :=
nick_arr := ";"
dn_arr :=
cmd_versions :=
cmd_nicknames :=
cmd_clipclop := "ClipClop(cmd=CMD,nickname=NickNames,show=SHOW,NoErr=NOERR)"
cmd_post :=
cmd_code :=
cmd_count := 0
loop,500
{ ; --- Datei-Informationen einlesen
loop,50
{ ControlGet,t1,List,,SysListView321,ahk_class CtsGuiClass.Frame ; Hole Datei-Infos aus Informationen-Reiter
Sleep 10
} until (t1 != t2)
;if Instr(t1,"N3_00390.avi")
; msgbox here we are
if Instr(t1,"Übergang") ; Überblendungen (gibts nie am TL-Anfang oder -Ende) überspringen
{ Sleep 100
Goto nextClip ;
}
if (t1 = t2) ; Immer noch nichts Neues ?
break ; dann sind wir am linken Anschlag => verlasse Schleife
t2 := t1
; --- In/Out-Marke für ausgewählten Clip erzeugen
Send z
Sleep 20 ; Ausgewählten Clip In/Out setzen
Send ^!v ; SONDERTASTE Ctrl+Alt+v = In/Out-Marke setzen. Setze Marke für Bereich In/Out des Clips
Sleep 20
; --- Clip-Eigenschaften einlesen und auswerten
clp_count := clp_count + 1
Send !{Enter} ; Clip-Eigenschaften öffnen
f_winWaitExit("Clip-Eigenschaften",,,,,v_exit=true) ; Warte bis 2s auf Fenster, ansonsten exit
if (clp_count = 1)
WinMinimize,Clip-Eigenschaften
WinGetText,t,Clip-Eigenschaften ; Hole Dateieigenschafts-Texte. Eigenschaften bleiben geöffnet
; keine Meldung, wenns nicht klappt und raus
i1 := Instr(t,chr(10),false,Instr(t,"Pfad")) + 1 ; Suche Beginn Pfadangabe (jede Zeile wird mit chr(13)+chr(10) abgeschlossen)
i2 := Instr(t,chr(13),false,i1) - 1 ; Suche Ende Pfandangabe
StringMid,dn,t,i1,(i2-i1) + 1 ; Hole vollen Dateipfad mit Dateiname und Extension
i1 := Instr(dn,".",false,0) ; Suche für Extension Punkt von hinten, StartingPos=0
StringMid,dext,dn,i1 + 1 ; dext = Clipname-Extension
i1 := Instr(t,chr(10),false,Instr(t,"&Name")) + 1 ; Suche Beginn Clipname (jede Zeile wird mit chr(13)+chr(10) abgeschlossen)
i2 := Instr(t,chr(13),false,i1) - 1 ; Suche Ende Clipname
StringMid,dn,t,i1,(i2-i1) + 1 ; dn = Clipname ohne Extension
dn_arr := dn_arr . dn . "." . dext . ";"
i1 := Instr(t,chr(10),false,Instr(t,"Bil&drate")) + 1 ; Suche Beginn Bildratenangabe
StringMid,fr,t,i1,2 ; fr ist die Bildrate in frames/s
i1 := Instr(t,chr(10),false,Instr(t,"&Kommentar")) + 1 ; kom enthält Text im Kommentarfeld
i2 := Instr(t,chr(13),false,i1) - 1
StringMid,kom,t,i1,(i2-i1) + 1
StringUpper,kom,kom
nick :=
if (fr != "50") and not Instr(kom,"~IF-") and not Instr(kom,"~IF0") ; Framerate nicht 50 (sollte 25 sein) und Interframe nicht unterdrückt
{ if Instr(kom, "~IFS") ; Interframe mit scharfem Algorithmus gewählt (Landschaft)
nick := "IF2550S" ; odd/even wird später angefügt, wenn Startframe bekannt ist
else ; andernfalls immer Interframe mit normalem Algoritmus (Szene)
nick := "IF2550N"
}
if Instr(kom,"~SH") ; Feinschärfung: Fester Aufbau z.B. "~SHS030W01X2" = 2-fach s30w01
nick := nick . "_" . SubStr(kom,Instr(kom,"~SH") + 1,11)
if Instr(kom,"~DHSS") ; Dehalo-Alpha mit oder ohne Supersampling
nick := nick . "_DHSS"
else if Instr(kom,"~DH")
nick := nick . "_DH"
if Instr(kom,"~MDG3") ; MDegrain 3,2 oder 1 (temporale Rauschunterdrückung)
nick := nick . "_MDG3"
else if Instr(kom,"~MDG2")
nick := nick . "_MDG2"
else if Instr(kom,"~MDG1")
nick := nick . "_MDG1"
if SubStr(nick,1,1) = "_" ; evtl. überflüssiges Underscore am Anfang entfernen
nick := SubStr(nick,2)
if StrLen(nick) = 0
nick := "SOURCE"
nick_arr := nick_arr . nick . ";" ; Nickname-(Funktionen-) Array zusammenbauen. Mit Semikolon trennen.
WinActivate,EDIUS ahk_class CtsGuiClass.Frame ; Wieder Timeline aktivieren
nextClip:
Send !{Right}
}
nick_arr := Substr(nick_arr,2) ; Erstes Semikolon wird nicht mehr gebraucht - entfernen
WinRestore,Clip-Eigenschaften
Send {Esc} ; Clip-Eigenschaften schließen
WinSet,AlwaysOnTop,Off,EDIUS ahk_class CtsGuiClass.Frame
WinSet,Enable,,EDIUS ahk_class CtsGuiClass.Frame
; --- Abspeichern der clip-Markerdatei
Send ^!e
f_winWaitExit("Speichern unter",,,,,v_exit=true)
WinMove,Speichern unter,,(A_ScreenWidth/2)-(563/2),(A_ScreenHeight/2)-(437/2),563,437
ControlClick,Button6,Speichern unter,,,2
Sleep 100
FileDelete,D:\Temp\ed_marker.csv
ControlClick,Edit1,Speichern unter,,,1
Send D:\Temp\ed_marker
Send !s
Sleep 1000
; --- Auslesen der Markerdatei und Bau des command-files für clipclop
idn := 1
inick := 1
bericht :=
Loop, read,D:\Temp\ed_marker.csv ; Zeile für Zeile der Markerdatei lesen
{ LineNumber = %A_Index%
if LineNumber <= 5 ; Überspringen Headertext
continue
Loop, parse, A_LoopReadLine, CSV ; CSV-Elemente jeder Zeile lesen
{ if (A_Index = 1) or (A_Index = 4) ; erstes und letztes Element brauchen wir nicht
continue
else if (A_Index = 2) ; START-Zeitpunkt
{ frStart := frmNr(A_LoopField) ; Berechne Start-FrameNr aus dem Start-Timecode...
tcStart := A_LoopField
i1 := Instr(nick_arr,";",false,inick) ; Hole parallelen Filterbefehl (Nickname): Suche nächstes Semikolon
StringMid,nick,nick_arr,inick,(i1 - inick) ; nick = paralleler (passender) Filter
if ((frStart / 2) = floor(frStart / 2)) ; Wenn Start-FrameNr ist gerade
nick := RegExReplace(nick,"IF2550","IF25u50") ; markiere ggf. vorh. Interframe-Anweisung als Gerade
else
nick := RegExReplace(nick,"IF2550","IF25u50") ; markiere ungerade
if not Instr(cmd_nicknames,A_Tab . nick . " =")
{ cmd_nicknames := cmd_nicknames . A_Tab . nick . " = " . cmd_count . "`r`n"
cmd_versions := cmd_versions . "V" . cmd_count . " = " . nick . "()" . "`r`n"
cmd_clipclop := RegExReplace(cmd_clipclop, "cmd=","V" . cmd_count . ",cmd=")
cmd_code := f_ediClipClopCodeCreate(cmd_code, nick)
cmd_count := cmd_count + 1
}
comlines := comlines . nick . " " ; Setze Nickname an den Anfang der Commandfile-Textzeile
inick := i1 + 1 ; Nickname-Zeiger auf nächsten Nicknamen setzen
if (frStart < frEnde) ; ÜBERBLENDUNG. Voriger Clip endet später als Clipanfang (tritt auf bei Überblendung)
{ frEndeNeu := floor(frEnde - (frEnde - frStart) / 2) ; Berechne Mitte der Überblendung der beiden Clips
comlines := RegExReplace(comlines,frEnde,frEndeNeu) ; Korrigiere Ende des vorigen Clips (StringReplace findet nichts)
comlines := comlines . (frEndeNeu + 1) . "," ; Veränderte Start-FrameNr hinter den Filterbefehl setzen
} else if (frStart > (frEnde + 1)) ; LÜCKE
{ bericht := bericht . "Lücke bei " . tcstart . chr(13) . chr(10)
comlines := comlines . frStart . "," ; Start-FrameNr hinter den Filterbefehl setzen
} else ; NORMALER ANSCHLUSS
comlines := comlines . frStart . "," ; Start-FrameNr hinter den Filterbefehl setzen
} else if (A_Index = 3) ; DAUER des Clips
{ frEnde := frStart + frmNr(A_LoopField) - 1 ; Berechne Ende-FrameNr aus Start-FrameNr + Clipdauer...
; Interframe: Bei gerader Frameanzahl ('full - blended' oder 'full- full') wird bei der SelectOdd/Even-Technik der letzter Frame
; unterschlagen und durch Bild 1 des Nachfolgeclips jedoch mit der Restfilterung des Interframeclips ersetzt. Bild 1 des Nachfolgeclips
; wird dabei verdoppelt, so dass es immerhin keine Sync-Probleme gibt. Daher feststellen, ob Frameanzahl gerade ist, dann nach der
; ClipClop-Verarbeitung den letzten Frame löschen und den vorletzten verdoppeln. (Für Überblendungen noch nicht gelöst):
if Instr(nick,"IF25") and ((frEnde - frStart + 1) / 2 = floor((frEnde - frStart + 1) / 2))
cmd_post := cmd_post . "DeleteFrame(" . frEnde . ")`r`nDuplicateFrame(" . (frEnde - 1) . ")`r`n"
comlines := comlines . frEnde ; ...und setze sie hinter die Start-FrameNr
i1 := Instr(dn_arr,";",false,idn) ; Hole parallelen Clipnamen: Suche nächstes Semikolon
StringMid,dnam,dn_arr,idn,(i1 - idn) ; dnam = paralleler (passender) Clipname
comlines := comlines . " # " . dnam . " [Start: " . tcStart . "]" . chr(13) . chr(10) ; Setze Clipname ans Ende der Zeile
idn := i1 + 1 ; Clipnamen-Zeiger auf nächsten Clipnamen setzen
}
}
}
if (frEnde < frmNr(tcEnde))
bericht := "Ende bei Timecode " . tcEnde . " wurde nicht erreicht!" . chr(13) . chr(10) . bericht
if StrLen(comlines) < 10
Goto subende
FileAppend,%comlines%,D:\Temp\ed_command.txt ; Neue command-Datei dort abelgen
FileAppend,%bericht%,D:\Temp\ed_bericht.txt ; Neue command-Datei dort abelgen
cmd_code := f_ediClipClopBuildAVS(cmd_versions, cmd_nicknames, cmd_clipclop, cmd_post, cmd_code)
FileAppend %cmd_code%,D:\Temp\ed_export.avs
msgbox Das war´s.
subende:
Return
}
; Rechnet Timecode im Format hh:mm:ss:frameNr oder hh:mm:ss:mSek in Framenummer um beginnend bei 0,
; wobei 1s = 50 frames entspricht
frmNr(tc)
{ frmNr := substr(tc,1,2) * 3600 * 50
frmNr := frmNr + substr(tc,4,2) * 60 * 50
frmNr := frmNr + substr(tc,7,2) * 50
if (StrLen(tc) <= 11) ; Timecode als hh:mm:ss:ff (1-2 stellige Framenr)
frmNr := frmNr + substr(tc,10) * 2
else
frmNr := frmNr + floor((substr(tc,10) + 2)/20) ; Timecode als hh:mm:ss:MilliSekunden (>= 3 stellig)
return (frmNr) ; Vor Rundung Erhöhung um + 2ms, da Edius oft 1 ms zu wenig angibt
}
Continue next thread
Hotte
9th February 2015, 14:52
Continued Autohotkey subroutines:
f_ediClipClopCodeCreate(cmd_code, nick)
{ if Instr(cmd_code,"function " . nick . "(clip clp)")
goto funcEnde
cmd_code := cmd_code . "function " . nick . "(clip clp)`r`n{`r`n"
i := Instr(nick,"SHS")
if (i > 0)
{ s := Substr(nick,i + 3,3) * 1
w := Substr(nick,i + 7,2) * 1
x := Substr(nick,i + 10,1)
if (x = 3)
cmd_code := cmd_code . "clp = sharpen3(clp, strength=" . s . ", width=" . w . ")`r`n"
else if (x = 2)
cmd_code := cmd_code . "clp = sharpen2(clp, strength=" . s . ", width=" . w . ")`r`n"
else
cmd_code := cmd_code . "clp = sharpen1(clp, strength=" . s . ", width=" . w . ")`r`n"
}
if Instr(nick,"DHSS")
cmd_code := cmd_code . "clp = DeHalo_alpha(clp, highsens=100, ss=1.5)`r`n"
else if Instr(nick,"DH")
cmd_code := cmd_code . "clp = DeHalo_alpha(clp, highsens=100, ss=1.0)`r`n"
if Instr(nick,"MDG1")
cmd_code := cmd_code . "clp = fmdg1(clp)`r`n"
if Instr(nick,"MDG2")
cmd_code := cmd_code . "clp = fmdg2(clp)`r`n"
if Instr(nick,"MDG3")
cmd_code := cmd_code . "clp = fmdg3(clp)`r`n"
if Instr(nick,"IF25")
{ if Instr(nick,"IF25g")
cmd_code := cmd_code . "clp = SelectEven(clp)`r`n"
if Instr(nick,"IF25u")
cmd_code := cmd_code . "clp = SelectOdd(clp)`r`n"
if Instr(nick,"50N")
cmd_code := cmd_code . "clp = InterFrame(clp, Tuning=" . chr(34) . "weak" . chr(34) . ", OverrideAlgo=21, NewNum=50, NewDen=1, Cores=8)`r`n"
if Instr(nick,"50S")
cmd_code := cmd_code . "clp = InterFrame(clp, Tuning=" . chr(34) . "Film" . chr(34) . ", OverrideAlgo=2, NewNum=50, NewDen=1, Cores=8)`r`n"
if Instr(nick,"IF25u")
cmd_code := cmd_code . "clp = DuplicateFrame(clp,2)`r`n"
}
cmd_code := cmd_code . "return(clp)`r`n}`r`n`r`n"
funcEnde:
return cmd_code
}
f_ediClipClopBuildAVS(cmd_versions, cmd_nicknames, cmd_clipclop, cmd_post, cmd_code)
{ w := chr(34)
code := "SetMemoryMax(512)`r`n"
code := code . "SetMTMode(2,8)`r`n`r`n"
code := code . "PluginPath = " . w . "C:\Diverses\AvisynthPlugins\Interframe\" . w . "`r`n"
code := code . "LoadPlugin(PluginPath+" . w . "svpflow1.dll" . w . ")`r`n"
code := code . "LoadPlugin(PluginPath+" . w . "svpflow2.dll" . w . ")`r`n"
code := code . "Import(PluginPath+" . w . "InterFrame2.avsi" . w . ")`r`n"
code := code . "Import(" . w . "C:\Diverses\AvisynthPlugins\HK_Elementary_Tools.avsi" . w . ")`r`n`r`n"
code := code . "Avisource(" . w . "D:\Temp\Export.avi" . w . ")`r`n`r`n"
code := code . "ConvertToYV12()`r`n`r`n"
code := code . "CMD=" . w . "D:\Temp\ed_command.txt" . w . "`r`n`r`n"
code := code . cmd_versions . "`r`n`r`n"
code := code . "NickNames =" . w . w . w . "`r`n"
code := code . cmd_nicknames . w . w . w . "`r`n`r`n"
code := code . "SHOW=False" . "`r`n"
code := code . "NOERR=True" . "`r`n"
code := code . cmd_clipclop . "`r`n`r`n"
code := code . cmd_post . "`r`n`r`n"
code := code . cmd_code . "`r`n"
return code
}
Now we have a clipclop-commandfile which looks like this:
SOURCE 0,194
IF25u50S_SHS030W01X2_DHSS_MDG2 195,1052 # N3_00111.MOV [Start: 00:00:03:899]
SHS070W05X1_DH_MDG2 1053,1428 # N3_00126.avi [Start: 00:00:21:059]
MDG1 1429,1784 # N3_00121.avi [Start: 00:00:28:579]
SOURCE 1785,1794 # N3_00127.avi [Start: 00:00:35:700]
SOURCE 1794,1794
A bit confusing - doesnt´matter. It has been created automatically and it works perfectly with clipclop.
And now the automatically created code (not the one which suits the commandfile above) looks for example like this:
SetMemoryMax(512)
SetMTMode(2,8)
PluginPath = "C:\Diverses\AvisynthPlugins\Interframe\"
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
Import("C:\Diverses\AvisynthPlugins\HK_Elementary_Tools.avsi")
Avisource("D:\Temp\Export.avi")
ConvertToYV12()
CMD="D:\Temp\ed_command.txt"
V0 = IF25u50S_SHS030W01X2_DHSS_MDG2()
V1 = SHS070W05X1_DH_MDG2()
V2 = MDG1()
V3 = SOURCE()
V4 = DHSS_MDG2()
V5 = SHS040W01X2_MDG2()
V6 = DH_MDG2()
V7 = SHS100W05X1_DHSS_MDG2()
V8 = SHS030W01X2_DHSS_MDG3()
V9 = DH()
V10 = MDG3()
V11 = MDG2()
V12 = SHS070W05X1_DHSS_MDG2()
V13 = SHS030W01X3_DHSS_MDG2()
V14 = DHSS_MDG3()
NickNames ="""
IF25u50S_SHS030W01X2_DHSS_MDG2 = 0
SHS070W05X1_DH_MDG2 = 1
MDG1 = 2
SOURCE = 3
DHSS_MDG2 = 4
SHS040W01X2_MDG2 = 5
DH_MDG2 = 6
SHS100W05X1_DHSS_MDG2 = 7
SHS030W01X2_DHSS_MDG3 = 8
DH = 9
MDG3 = 10
MDG2 = 11
SHS070W05X1_DHSS_MDG2 = 12
SHS030W01X3_DHSS_MDG2 = 13
DHSS_MDG3 = 14
"""
SHOW=False
NOERR=True
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,cmd=CMD,nickname=NickNames,show=SHOW,NoErr=NOERR)
function IF25u50S_SHS030W01X2_DHSS_MDG2(clip clp)
{
clp = sharpen2(clp, strength=30, width=1)
clp = DeHalo_alpha(clp, highsens=100, ss=1.5)
clp = fmdg2(clp)
clp = SelectOdd(clp)
clp = InterFrame(clp, Tuning="Film", OverrideAlgo=2, NewNum=50, NewDen=1, Cores=8)
clp = DuplicateFrame(clp,1)
return(clp)
}
function SHS070W05X1_DH_MDG2(clip clp)
{
clp = sharpen1(clp, strength=70, width=5)
clp = DeHalo_alpha(clp, highsens=100, ss=1.0)
clp = fmdg2(clp)
return(clp)
}
function MDG1(clip clp)
{
clp = fmdg1(clp)
return(clp)
}
function SOURCE(clip clp)
{
clp = last
return(clp)
}
function DHSS_MDG2(clip clp)
{
clp = DeHalo_alpha(clp, highsens=100, ss=1.5)
clp = fmdg2(clp)
return(clp)
}
function SHS040W01X2_MDG2(clip clp)
{
clp = sharpen2(clp, strength=40, width=1)
clp = fmdg2(clp)
return(clp)
}
function DH_MDG2(clip clp)
{
clp = DeHalo_alpha(clp, highsens=100, ss=1.0)
clp = fmdg2(clp)
return(clp)
}
.... etc.
Clipclop is useful tool. And it has revolutionised and much faciliated the way I work with avisynth in connection with NLE.
Thanks to StainlessS for this wonderful tool.
StainlessS
10th February 2015, 00:34
Great stuff Hotte, even though you do not support this code, I am sure that there are others that are familiar with the language and would
not be at all surprised if there were other postings here.
I did not realize that AutoIt and AutoHotKey language had diverged to such an extent, maybe I'll give it a try one day.
Thanks for providing the code and your kind words.
Good luck.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.