View Full Version : Dynamic (indexed) filtering


Hotte
17th November 2014, 21:20
Hi,
is there something in avisynth to alter filtering due to an index or indexed frame ?

Say I tied to clips together into one single AVI with an NLE. Clip A has little noise, clip B is very noisy.

I would like to tell avisynth to apply weak noise reduction to clip A but strong parameters to clip B. I could add an index frame or something at the beginning of each clip to tell avisynth which filtering it should apply. After the filtering avysynth would remove the index frames.

Any ideas how to do this ?
Thanks.

TheFluff
17th November 2014, 21:22
write a program that generates an avisynth script full of trim commands, or use one already written (YATTA would be one example but it's really dated now)

or use vapoursynth which has this sort of thing kinda natively

StainlessS
17th November 2014, 22:20
Perhaps this might help,


Avisource("D:\avs\test.avi")
ORG=Last

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


NickNames =""" # Psuedonyms for clips
L0 = 1 # Light Luma
L1 = 2 # Med Luma
L2 = 3 # High Luma
C0 = 4 # Light Chroma
C1 = 5 # Med Chroma
C2 = 6 # High Chroma
LC0 = 7 # Light Luma + Chroma
LC1 = 8 # Med Luma + Chroma
LC2 = 9 # High Luma + Chroma
FH = 10 # Flip-H
FV = 11 # Flip-V
INV = 12 # Invert
"""

SCMD=""" # Clip editing commands in string, can also use commands in file
C0 0,99 # Light Chroma frames @ 0 -> 99
L0 100,-200 # Light Luma frames @ 100, 200 frames ie frames 100->299
INV 300,399 # Invert 300->399
L0 400,499 # Light Luma frames 400->499
FH 500,599 # Flip-H 500->599
LC2 600,699 # High Luma + Chroma
C1 800 # Med Chroma, Single frame
1 900,999 # Light Luma, We used the clip number instead of a NickName
FV 1000,1099 # Flip-V
LC1 2000,0 # Med Luma + Chroma, 2000 -> lastframe
"""

SHOW=True

ClipClop(ORG,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW)


ClipClop() here: http://forum.doom9.org/showthread.php?t=162266&highlight=clipclop

Replaces ranges in source clip with same range from alternate clips.
You can if you wish use clip number eg 1 to mean clip1 ie L0 (which will repesent V1).
Any ranges not replaced will remain as original clip.
Audio not affected.
Can replace as many ranges or single frames as you like (maximim that I've tried was about 40,000, parsed before first frame
served in about 1 second).
Max 255 replacement clips.

Hotte
17th November 2014, 22:42
Thanks stainless. I would not have been able to understand ClipClop() from the thread without this example, but your code makes it instantly clear.
The only issue is, that I would prefer not to determine the filter changes by given frame numbers but by key frames that are being inserted right before the clip area, where a new filter should be applied. I could easily do that in the NLE. I wished avisynth would then "react" to a certain keyframe or any other frame based information dynamically.
I do not know if the processing model of avisynth is capable of doing this - Just say no, if this approach is not possible.

StainlessS
17th November 2014, 22:46
I dont know of anything that can do as you wish in Avisynth, sorry.

poisondeathray
17th November 2014, 22:58
Was that just an oversimplified example ? Just two clips ? Appended together ?

Because there are obviously easier ways to that

Can you be more descriptive in what a typical use would be ? How many clips, variations, types of edits ?

Another way would be to use AVFS (avisynth virtual file system) and replace the clips with filtered avfs versions in the NLE once you've done your edits.

Or were you more interested in the mechanics and the approach as a theoretical experiment ?

StainlessS
17th November 2014, 23:09
And what do you mean by "keyframe or any other frame based information" or indexed frame ? and how would they denote filtering required ?

I dont use NLE's (well I did have a play a few times many years ago).

poisondeathray
17th November 2014, 23:12
@Hotte - If you're not familiar with AVFS, it's just an emulation method of making a "fake" AVI that allows you to use .avs scripts into NLE's and other programs. To the other program, it just "looks" like an uncompressed AVI . Nothing is rendered, you just mount the .avs. (You would have a different .avs for each version of filters, e.g heavy vs. light, etc...) . In most NLE's it's very easy to replace all instances of all videos with 2 clicks if you've organize the clips into a single folder. The problem you might have is memory issues if you deal with a lot of clips, or heavy filters

So another method you might use is use a "control layer" in the NLE to indicate to avisynth what filter to use with conditionalfilter() with one of the runtime functions like AverageChromaU . Since avisynth does this on a per frame basis, you use a solid color the same as your clip length as an overlay. The colors indicate what filters to apply over what sections. All you need to do is render out the overlay. So "red" might indicate filter this section with filter stack "A", "blue" might indicate filter this section with filter stack "B" , or something like AverageLuma() for white and dark. This isn't the same as what you asked for (inserting a single frame per section), but it works, as I've done this before

Hotte
17th November 2014, 23:32
poisondeathray: I would like to apply avisynth filters to a completed NLE-Project. The final video consists of numerous different clips and was exported as avi. Final step is to apply some subtle sharpening and degraining with tools only available with avisynth. In the NLE process I would like to predetermine which clip will have more or less sharpening or degraining when being post-processed by avisynth.
I think I could do that with StainlessS' approach. But then I would have to write a script or at least a textfile with all the frame-positions and filters to be applied. It seems much more practical to me if - in the NLE - I could insert a certain keyframe that would tell avisynth: Hey, the follwing frames need sharpen=3.0, and one clip later another keyframe (or information of whatever kind) which tells avisynth to apply sharpen=1.0 now, because this clip is already pretty sharp and so on.

I read that "conditional filtering" allows adaptive motion filtering so in principle it seems possible, however the available frame runtime functions seem difficult to be "misused" as keyframes (and - honestly - I do not understand all the mechanics).

Yeah it´s not a theoretical but a practical question.

Hotte
17th November 2014, 23:37
Just to add: I am not looking for something to add to the NLE or to use with AVFS. Forget about it. I export an AVI from NLE and load it into avisynth as a final process. And because there are some "special" frames coded into it, avisynth´s filters a being steered by these special frames. They are just there to set parameters. Could be a subtitle saying "sharpen=3.0". The problem is to evaluate such a frame.

poisondeathray
17th November 2014, 23:42
I read that "conditional filtering" allows adaptive motion filtering so in principle it seems possible, however the available frame runtime functions seem difficult to be "misused" as keyframes (and - honestly - I do not understand all the mechanics).




The control layer approach just chooses frames from a filtered version based on the color of the overlay. So if your filters are adaptive or temporal, then the final version will also be . It's 100% accurate , and has nothing to do with keyframes. I'm probably not describing it very well. You render out the AVI as normal. But you also render out the colored overlay. The colors tell avisynth which frames to choose from which filtered version .

StainlessS
17th November 2014, 23:49
You perhaps could do something like bottom quarter left frame Fine Red ($FF0000), bottom Right Fine Blue ($0000FF),
top lhs, maybe eg 6 or 8 32x32 blocks of either BLACK ($000000) or WHITE ($FFFFFF) binary encoded to mean a filter clip number.

Avisynth script could scan your clip looking for RED/BLUE "I'm here" type markers and write a ClipClop command file.
You would need to write the script for the V1, V2 etc clips as given in clipclop example but would not need NickName,
can directly use the binary coded clip number (clip 0 is reserved for original clip and so binary 0 would mean do not touch).

After that, run it though clipclop, no problem.

OR a control layer as PDR suggests, YOU have to have some way to encode command data, what can you suggest.

EDIT:
Could be a subtitle saying "sharpen=3.0",
Nah, OCR and then some kind AI to try to figure out what you want and then to write a good script, no chance.
YOU would have to decide what each numbered filter would do, and write the script as in the V1,V2 examples given in clipclop.

If you had only a simple filter in mind with only a couple of variables eg FFT3DFilter(Plane=4,Sigma=VAR_1,Sharpen=VAR_2)
then if you can find a way to encode to two variables into a control clip then those could be used to vary the VAR_1 VAR_2 variables,
either continuously (every frame) or if you can also encode some kind of "I'm HERE" marker, then effective from that frame onwards.

Hotte
18th November 2014, 00:19
Stainless:
OK, I understand the principle. Could you tell me how avisynth scans a clip e.g. for $FF0000 color blocks ? Just a few codelines perhaps ? Sorry, I am pretty new to avisynth and you guys are all so enormously experienced (Its my fault to grabbing for the stars with so limited knowledge....).

poisondeathray:
I understand! In NLE I would overlay my cut video with different solid colors over time (the control layer) where I would like a certain filter stack to be applied. Each color represents a certain filter stack. I would render out the original (avi1) plus the control layer as avi2 and feed both avi's into a conditionalfilter(). Sounds good!
Could you please, please help me with some code statements (say with simple blur(1.0) / blur(1.58) due to a different colorcode from avi2)
Thanks!

poisondeathray
18th November 2014, 01:27
poisondeathray:
I understand! In NLE I would overlay my cut video with different solid colors over time (the control layer) where I would like a certain filter stack to be applied. Each color represents a certain filter stack. I would render out the original (avi1) plus the control layer as avi2 and feed both avi's into a conditionalfilter(). Sounds good!
Could you please, please help me with some code statements (say with simple blur(1.0) / blur(1.58) due to a different colorcode from avi2)
Thanks!




Yes! that's it. When you edit it in the NLE, it helps to change the opacity of the control layer to 50% or something to "see" what is going on when you do the actual editing. Change it back when you export

The problem with what you initially wanted, is a single control frame doesn't indicate to avisynth anything about how many frames to affect (mark in, but no mark out point) . It also introduces other problems such as having to deleting it.



Sure, the 2 case example is straight forward. "Blur" , might not be easy to distinguish, so in this example, I choose levels to make a A) dark FilterA B) blown out FilterB. I chose the control layer to be black for FilterA, and red for FilterB. You can easily change the filters or control layer variables, or use different expressions like greater than, less than etc.....

For this example, the original clip is colorbars ("orig" in the script), frames 0-299 . Pretend this is the AVI that you exported

My control layer goes from 0-150 black, 151-299 red in this example . Pretend this is the overlay layer that you exported . Control layer doesn't have to be the same dimensions as main video. It can be 16x16 for example. That will export very fast from NLE

It's easy to debug with "show=true" to see what values are being returned . Comment it out of course when you use it for final encode. You can choose different runtime functions to measure (I used AverageChromaU in this example, for Red)
http://avisynth.nl/index.php/ConditionalFilter#Runtime_Functions

You can use conditionalselect() for more cases as well, or combine conditional filter calls
http://avisynth.nl/index.php/ConditionalFilter




colorbars(width=640,height=480, pixel_type="yv12").showframenumber().trim(0,299)
orig=last

orig
levels(0,0.1,255,0,255,false)
subtitle("FilterA")
FilterA=last

orig
levels(0,3,255,0,255,false)
subtitle("FilterB")
FilterB=last

red=blankclip(orig, color=color_red)
black=blankclip(orig)

controllayer=black.trim(0,150)+red.trim(151,299)

ConditionalFilter(controllayer, filtera, filterb, AverageChromaU()", ">", "120", show=true)

StainlessS
18th November 2014, 01:42
SEE edit above

It would probably be easiest to have a separate control clip rather than a Fine Red/Blue I'm Here type clip (easier for you mostly, not really a problem this end).
You could have continuously varying VARS (as mentioned above) or FILTER_FROM_HERE type frames. For FILTER_FROM_HERE mode, non switch on
frames could be BLACK, and ignored (use previously set filter vars). (Or maybe just use the bottom half of frame to flag FILTER_FROM_HERE leaving top
half of frame to encode data).

If not ignored, then would need to extract some kind of data from eg Binary BLOCK coding in particular positions, OR
eg area 0,0,8,8 (x,y,w,h) might hold info as Average Luma data range 16->235 representing eg 0.0 to 1.0 for a particular variable for eg Sharpen.
eg area 8,0,8,8 (x,y,w,h) might hold info as Average Luma data range 16->235 representing eg 5.0 to 8.0, for some other function.
eg area 16,0,8,8, etc.
OR maybe if only eg 3 variables in total, simply encode 1 in each of the RGB channels, 0,0,0 being ignored and 1->255 being scaled to whatever
was required for particular output variable.

RT_Stats has a number of runtime functions to scan a frames, down to individual pixels for luma or RGB and can easily extract binary block coded
data or encoded as eg luma or RGB channel level. It really only requires that you can successfully encode something, we can extract it (but not subtitles, hehe).
I guess you could even encode ASCII text into Luma or RGB channels and RT_Stats could pick it out of that channel and convert it from a number eg
65 to ASCII 'A'.

It really all depends on what you can persuade your NLE to let you encode on your control clip key frames.
You could even if you like have eg BLACK frame = IGNORED, ORANGE (giving us exactly what you consider to be orange) meaning eg Degrain = 1.1, Sharpen 1.2.
RED = Degrain = 1.2, Sharpen 1.1
etc.

You need to figure out what you can encode, then we'll set about extracting that.

poisondeathray
18th November 2014, 01:53
Here is an example of a 3 state situation, using ConditionalSelect() . It's the same above, but the control layer is black , grey, and white , and goes from 0-100,101-200,201-300 in this simple example

I chose black = filterA , grey= original, white= filterB




colorbars(width=640,height=480, pixel_type="yv12").showframenumber().trim(0,299)
orig=last

orig
levels(0,0.1,255,0,255,false)
subtitle("FilterA")
FilterA=last

orig
levels(0,3,255,0,255,false)
subtitle("FilterB")
FilterB=last

black=blankclip(orig) #16
grey=blankclip(orig, color=$A9A9A9) #161
white=blankclip(orig, color=$FFFFFF) #235

controllayer=black.trim(0,100)+grey.trim(101,199)+white.trim(200,299)

ConditionalSelect(controllayer, "luma_av = AverageLuma()"+chr(13)+"luma_av < 170 ? (luma_av < 17 ? 2 : 1) : 0", FilterB, orig, FilterA, show=true)



How did I know to use those specific numbers <17 and <170? I used them in ConditionalFilter and used show=true. The values are 16 for black, 161 for the shade of grey I used (color=$A9A9A9), and 235 for white

StainlessS
18th November 2014, 02:11
PDR, can I suggest this as easier, especially when a few more Filters are added


colorbars(width=640,height=480, pixel_type="yv12").showframenumber().trim(0,299)
orig=last

orig
levels(0,0.1,255,0,255,false)
subtitle("FilterA")
FilterA=last

orig
levels(0,3,255,0,255,false)
subtitle("FilterB")
FilterB=last

black=blankclip(orig) #16
grey=blankclip(orig, color=$A9A9A9) #161
white=blankclip(orig, color=$FFFFFF) #235

controllayer=black.trim(0,100)+grey.trim(101,199)+white.trim(200,299)

Cond_S = """
luma_av = AverageLuma()
Result = luma_av < 170 ? (luma_av < 17 ? 2 : 1) : 0
Return Result
"""

ConditionalSelect(controllayer,Cond_S, FilterB, orig, FilterA, show=true)


Only extracted the string expression to Cond_S and added the Result var

EDIT: From RT_Stats

RT_RgbChanAve(clip c,int "n"=current_frame,int "delta"=0,int "x"=0,int "y"=0,int "w"=0,int "h"=0,bool "interlaced"=false,
int "chan"=0,int "mask"=NOT_USED, int "MaskMin"=128,"MaskMax"=255)
Return int -1, if no valid pixels in Mask clip.
Returns FLOAT average channel value (0.0 -> 255.0) in frame(n+delta) for area x,y,w,h, and selected Chan channel (0=R,1=G,2=B, RGB32 3=ALPHA).


Can just use eg

Red = RT_RgbChanAve(0) # Red = RT_RgbChanAve(0,w=1,h=1) for single pixel sample at 0,0
Grn = RT_RgbChanAve(1)
Blu = RT_RgbChanAve(2)


if you want to use RGB color, can also perhaps use the RGB colors from avisynth Colors_Rgb_avsi, here a small sample

global color_aliceblue = $F0F8FF
global color_antiquewhite = $FAEBD7
global color_aqua = $00FFFF
global color_aquamarine = $7FFFD4
global color_azure = $F0FFFF
global color_beige = $F5F5DC
global color_bisque = $FFE4C4


EDIT: If using the avsi, then this function might be easier

RT_RGB32AsInt(clip,int "n"=current_frame,int "delta"=0,int "x"=0,int "y"=0)
Compile/Runtime clip function.
Given an RGB32 clip that had a pixel value created from an Int, gets that pixel and returns as the
original Int. By creating single pixel clips and stacking them horizontally/vertically,
you can use a frame as a two dimensional array of Int, perhaps use the frame number for a third dimension.

Returns colors as RGB Int, will get from pixel(0,0) by default but be much quicker than scanning entire frame.

poisondeathray
18th November 2014, 02:18
Nice StainlessS, I'll keep it in mind. I've only used the 2 filter case before with my NLE, because I prefer to do it these sorts of things with remapframes() method in avisynth.

Hotte
18th November 2014, 03:25
Thank you guys - so much input! It will take me some time to go through your suggestions and come back with questions.

Short first question concerning performance: Are Filter A and B both calculated for the whole video or only for those parts of the video where they are finally applied to ? I use quite performance hungry filters. Selecting out of 3 or 4 variants might slow down heavily if everything is being calcualted for the whole clip ?

StainlessS
18th November 2014, 03:49
Only for those parts of the video where they are finally applied to.
Any filters not used at all (as in the ClipClop example) will only have the overhead of calling any filter constructors, ie before the first frame is served.

Hotte
18th November 2014, 07:28
Any filters not used at all (as in the ClipClop example) will only have the overhead of calling any filter constructors

allright, how about the ConditionalSelect(controllayer,Cond_S, FilterB, orig, FilterA, show=true) ?

StainlessS
18th November 2014, 13:25
ConditionalSelect() is a filter and requires calling of constructor (once at startup), the Cond_S script is executed for each frame, not really
that much of an overhead to scan a single frame using eg AverageLuma, however complete frame is scanned. If you used
RT_AverageLuma(x=0,y=0,w=1,h=1) or RT_RgbChanAve(x=0,y=0,w=1,h=1) to sample a single pixel @0x0 then would of course be faster.
ConditionalSelect() or ScriptClip() etc scripts are slow if they contain filters with high startup costs (at each frame), but
AverageLuma/RT_AverageLuma are functions not filters (they do not return a frame) and so have no start up constructor overhead.
I would not worry too much about speed here, but it depends upon what way you choose to encode command data.
A single specific RGB color could be used to mean many filter settings, but as I said you would need to
set up the V1 type filters (as in clipclop example), would also be faster than trying to programmatically make adjustments at each frame
(together with filter constructor overheads at each frame).

EDITED:

StainlessS
18th November 2014, 14:19
As PDR suggested somewhere, control clip could be eg 32x32 (or whatever) in size and so very fast to process.
Instead of ConditionalSelect() could just scan the clip and write a ClipClop command file.
Eg you could equate RGB $FF00FF to mean FFT3DFilter(Plane=0,Sigma=3.5,sharpen=0.5).
At this end, when writing ClipClop command file, we could convert RGB $FF00FF to be eg clip number 1, or even NickName "FFT_0_35_05",
if clip 1 chosen then need to make filter chain for clip 1 equivalent to FFT3DFilter(Plane=0,Sigma=3.5,sharpen=0.5), if
NickName "FFT_0_35_05", chosen, then can delay decision about which clip number it is, can create control clip, scan control clip
in Avisynth to make ClipClop command file using chosen nickname strings (rather than fixed clip index), and then after you have
created all your filters chains, decide which filter chain will be applied to a clip number, and then define the NickNames to suit the
chosen clip index.
What I'm getting at is, you equate eg RGB $FF00FF to be "FFT_0_35_05", and later decide how you are gonna achieve that.

EDIT: I'll do a small example of what I mean a little later today.

Hotte
18th November 2014, 21:42
StainlessS, though I am getting to the limit of my understanding, I am happily waiting for codelines with a simple example to try out. Sound an interesting approach!

StainlessS
19th November 2014, 01:54
Almost there but I've got a squash resistant bug somewhere.
Way faster than I thought it might be.
Hopefully the example (well its pretty much the whole thing really) will clarify a few things.

StainlessS
19th November 2014, 18:24
Here is a script that just makes a test Control clip identical functionality to SCMD in first example given in post #3.


# MakeControlClipAVI.avs, Make Dummy control clip for testing, Save to Control.AVI

ORG=Avisource("D:\avs\test.avi").ConvertToRGB32().PointResize(32,32).KillAudio # Take Blankclip attributes from this

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
"""

SHOW=FALSE

ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW)


Script to extract RGB color from Control Clip and convert to ClipClop Command file.

# MakeClopCmd.avs, Convert commands embedded in Control.AVI RGB COLOUR, to ClipClop Command file.

Avisource("Control.AVI").ConvertToRGB32 # Just incase RGB24
CMD = "Command.Txt" # ClipClop Command file (Output of this script)

###
### HERE, YOU DECIDE THE NICKNAMES TO USE FOR WHICH COLOR CONTROL, BUT NOT WHICH CLIP INDEX THEY REFER TO
###

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
"""

###
### Create Color_Code -> NickName DBase
###
RT_FileDelete(CMD) # Delete existing Command file
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
RT_DBaseAlloc(DB,0,"iss") # Create zero record DB (Int,String,String)
MakeColorNickDBase(DB,MAP) # Fill DB with Color->NickName data (sorted by HexColor)

###
### Scan Control.AVI and create ClipClop Command file
###
GSCript("""
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) {
Dat = (n==FC) ? -1 : RT_BitAND(RT_RGB32AsInt(n=n,x=0,y=0),$FFFFFF) # Sample single pixel RGB32 Color as Int (clr Alpha)
if(n == FC || Dat != CurrCol) {
Frames = n - SFrm
if(Frames > 0) { # If not Frame 0
if(Frames == 1) { # Write NickName and Frame Number
RT_DebugF("%-16s %6d # $%06X %s",CurrNick,SFrm,CurrCol,CurrComm)
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)
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_FileDelete(DB) # Clean up
return MessageClip(RT_String("All Done, Created %s",CMD))

###
###
###
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
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
}
""")


Function MakeColorNickDBase(String DB,String MAP) {
/*
Parse MAP string and create Sort Ascending (by Hex Color) DBase for efficiently Scanning Control.AVI
*/
GSCript("""
MAP=RT_StrReplaceDeep(RT_StrReplace(MAP,Chr(9)," ")," "," ") # TAB and 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
For(i=0,NLINES-1) {
STR = RT_TxtGetLine(M,i)
S = STR
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(MidStr(S,1,1)=="$") {
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("String(%d) Hex Color Code Missing @'%s'\n'%s'",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(MidStr(S,1,1)=="=") {
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("String(%d) NickName Missing @'%s'\n'%s'",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(MidStr(S,1,1)=="#") {
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) # 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("String(%d) Non Parse @'%s'\n'%s'",i,S,STR))
}
""")
Return RT_DBaseRecords(DB) # Return Something
}


Final ClipClop script using Command.txt file created by above previous script

Avisource("D:\avs\test.avi")

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 MUST match those used in previous script

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
"""

SHOW=True
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,cmd=CMD,nickname=NickNames,show=SHOW)


ClipClop Command.txt file extacted from test Control.AVI

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


Here original SCMD in post#3 example

SCMD=""" # Clip editing commands in string, can also use commands in file
C0 0,99 # Light Chroma frames @ 0 -> 99
L0 100,-200 # Light Luma frames @ 100, 200 frames ie frames 100->299
INV 300,399 # Invert 300->399
L0 400,499 # Light Luma frames 400->499
FH 500,599 # Flip-H 500->599
LC2 600,699 # High Luma + Chroma
C1 800 # Med Chroma, Single frame
1 900,999 # Light Luma, We used the clip number instead of a NickName
FV 1000,1099 # Flip-V
LC1 2000,0 # Med Luma + Chroma, 2000 -> lastframe
"""


EDITED:

StainlessS
20th November 2014, 14:05
If you want to use colors as the nicknames (some may find it easier), then below script will enable use of all color names
(minus the initial 'color_') mentioned in Avisynth standard Colors_rgb.avsi as RGB control colors in your control.avi clip:

EDIT: Avisynth+ is broken as far as RT_PluginDir() is concerned, you could change to explicit path if required.


# MakeClopCmdUsingColorsRgbAvsi.avs

Avisource("Control.AVI").ConvertToRGB32 # Just incase RGB24
CMD = "Command.Txt" # ClipClop Command file (Output of this script)
USED = "Commands_Used.Txt"

COLORS_AVSI=RT_PluginDir()+"\colors_rgb.avsi"
Assert(Exist(COLORS_AVSI),RT_String("%s\nDoes NOT exist in Plugins Dir",COLORS_AVSI))
CMAP=RT_ReadTxtFromFile(COLORS_AVSI)

RT_FileDelete(CMD) # Delete existing Command file
RT_FileDelete(USED)
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
RT_DBaseAlloc(DB,0,"issb") # Create zero record DB (Int,String,String,bool)

T_START=RT_TimerHP()
MakeColorAvsiNickDBase(DB,CMAP) # Fill DB with Color->NickName data (sorted by HexColor)
###
### Scan Control.AVI and create ClipClop Command file using names from Colors_RGB.Avsi
###
GSCript("""
RECORDS = RT_DBaseRecords(DB)
HEXFIELD = 0 # Int field
NICKFIELD = 1 # String field
COMMFIELD = 2 # String field
USEDFIELD = 3 # Bool field
FC = FrameCount

CurrCol = -1
CurrNick = ""
CurrComm = ""
SFrm = 0

For(n=0,FC) {
Dat = (n==FC) ? -1 : RT_BitAND(RT_RGB32AsInt(n=n,x=0,y=0),$FFFFFF) # Sample single pixel RGB32 Color as Int (clr Alpha)
if(n == FC || Dat != CurrCol) {
Frames = n - SFrm
if(Frames > 0) { # If not Frame 0
if(Frames == 1) { # Write NickName and Frame Number
RT_DebugF("%-16s %6d # $%06X %s",CurrNick,SFrm,CurrCol,CurrComm)
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)
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_DBaseSetField(DB,SRec,USEDFIELD,True) # Used
}
}
}
TIM=RT_TimerHP-T_START
RT_WriteFile(USED,"# Total Time Taken = %.3f secs for %d Frames\n#\n",TIM,FC)
for(n=0,RECORDS-1) {
if(RT_DBaseGetField(DB,n,USEDFIELD)) {
S=RT_String("%-20s # $%06X %s",RT_DBaseGetField(DB,n,NICKFIELD),RT_DBaseGetField(DB,n,HEXFIELD),RT_DBaseGetField(DB,n,COMMFIELD))
RT_WriteFile(USED,"%s",S,Append=True)
}
}

RT_FileDelete(DB) # Clean up
return MessageClip(RT_String("All Done, Created '%s' AND '%s'",CMD,USED))

###
###
###
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
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
}
""")

Function MakeColorAvsiNickDBase(String DB,String CMAP) {
GSCript("""
Fnd_S=RT_String("GLOBAL\nCOLOR_\n=\n")
Rep_S=RT_String("\n\n\n")
CMAP=RT_StrReplaceMulti(CMAP,Fnd_S,Rep_S,sig=False) # Delete some stuff
CMAP=RT_StrReplaceDeep(RT_StrReplace(CMAP,Chr(9)," ")," "," ") # TAB and SPACE compact (multi to single SPACE)
NLINES = RT_TxtQueryLines(CMAP) # Lines of text in CMAP
M=""
For(i=0,NLINES-1) {
S = RT_TxtGetLine(CMAP,i)
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(StrLen(S)>0 && MidStr(S,1,1)!="#") {
Dollar=RT_FindStr(S,"$")
Assert(Dollar>0, RT_string("Dollar Not Found @ Line%d\n%s",i,S))
H=MidStr(S,Dollar+1)
H=RevStr(H)
While(RT_Ord(H)==32) { H=MidStr(H,2) } # Eat White
H=RevStr(H)
NN=MidStr(S,1,Dollar-1)
While(RT_Ord(NN)==32) { NN=MidStr(NN,2) } # Eat White
NN=RevStr(NN)
While(RT_Ord(NN)==32) { NN=MidStr(NN,2) } # Eat White
NN=RevStr(NN)
S=RT_String("%s%s",H,NN)
M=RT_TxtAddStr(M,S)
}
}
M=RT_TxtSort(UCase(M),Mode=0) # Sort Ascending (by Hex Color Code)
NLINES = RT_TxtQueryLines(M) # Lines of text in M
For(i=0,NLINES-1) {
S = RT_TxtGetLine(M,i)
H=MidStr(S,1,6)
NICK=MidStr(S,7)
HexCol=RT_NumberValue(H,16)
Comment = NICK
RT_DebugF("%3d ] $%06X %-20s # %s",i,HexCol,NICK,Comment) # Output to DebugView
RT_DBaseAppend(DB,HexCol,NICK,Comment,False) # Append record to DBase
}
Return RT_DBaseRecords(DB) # Return Something
""")
}


Ouput from previously posted test Control.avi

RED 0,99 # $FF0000 RED
BLUE 100,299 # $0000FF BLUE
POWDERBLUE 300,399 # $B0E0E6 POWDERBLUE
BLUE 400,499 # $0000FF BLUE
SILVER 500,599 # $C0C0C0 SILVER
DARKGRAY 600,699 # $A9A9A9 DARKGRAY
BLACK 700,799 # $000000 BLACK
MAGENTA 800 # $FF00FF MAGENTA
BLACK 801,899 # $000000 BLACK
BLUE 900,999 # $0000FF BLUE
PLUM 1000,1099 # $DDA0DD PLUM
BLACK 1100,1999 # $000000 BLACK
ORANGE 2000,13860 # $FFA500 ORANGE


And additional output to 2nd file, Commands_Used.txt

# Total Time Taken = 17.406 secs for 13861 Frames
#
BLACK # $000000 BLACK
BLUE # $0000FF BLUE
DARKGRAY # $A9A9A9 DARKGRAY
POWDERBLUE # $B0E0E6 POWDERBLUE
SILVER # $C0C0C0 SILVER
PLUM # $DDA0DD PLUM
RED # $FF0000 RED
MAGENTA # $FF00FF MAGENTA
ORANGE # $FFA500 ORANGE


EDITED: Added time taken to Commands_Used.txt

Hotte
21st November 2014, 23:00
Stainless, you really put a lot of work into this!

Forgive a beginner...it is not easy to understand all this.
So what I did: I copied clipclop26.dll into my avisynth plugins folder. Then I copied the first code box of #26.
First question: What is "D:\avs\test.avi" ?
I put one of my avi-clips in place here and ended up with "avisynth access violation" reading my file. Of course i did something wrong. Which file has to be loaded here ?
Thanks.

StainlessS
22nd November 2014, 00:36
Did the error msg give a line number ?

What was size of clip, HD ?

Edit, mobile at moment.

You did nothing wrong, I seem to have a problem somewhere.
The avi you mention was just any old clip, for testing.
The access violation is a little worrying.
I'll get back soon.

Hotte
22nd November 2014, 09:46
The error is precisely:
Avisynth open failure
Avisynth: access violation at 0x00000000 in c:\...VirtualDub.exe
attempting to read from 0x00000000
(D:\...\myscript.avs, line 64)

line64 is the ClipClop(V0,... line, which is the last line in myscript.avs.
My avisynth Version is 2.60 built 2012-05-16
My load command is ORG=Avisource("D:\Video\_Pool\bk.avi").ConvertToRGB32()....
bk.avi is a 4-sek Edius canopus hq 1920x1080 avi source clip at 50fps and is 156Mbytes large.
I have not quite understood what the first step does. I suppose it creates an index clip of the same length as my input clip with a number of colored frames that are being used to filter the main clip differently in the next steps. Is that right ?

StainlessS
22nd November 2014, 17:10
In an earlier post, PoisonDeathRay suggests use of a 'Control.Avi' clip instead of your 'marker frames' embedded in source clip, idea.
A range of frames of a specific colour would be used to apply a particular filter chain to that range, and you would not need to
get rid of your embedded marker frames afterwards.
Post #26 just creates a test control.avi clip where ranges of frames are set to specific 'Command Colors', with meaning exactly the same as
post #3 script. I dont have your NLE nor your clips but still need something to test with, this is it.
The only requirement of the input to the ControlAvi creator script is that it has more than 2000 frames as one of the commands is applied
from frame 2000, to the end of clip (ie 2000,0).
There was some time ago a problem reported by Jenyok, however all I could get out of him was something like "It does not work",
which does not assist much. IIRC the problem seemed to be with 64bit and memory greater than 4GB, I'm on XP32 4GB and can find
no problem that affects me.
I'll do a debug version of Clipclop for you, and include a copy of DebugView, can you please run DebugView to capture messages and PM me back the
results, its probably gonna be the only way I can find the problem.

I think PDR suggested that he already uses something similar to the Control.avi thing, go back a re-read what he said, I dont use NLE's and
so dont know what is or is not available. (EDIT: IIRC PDR said he only uses 2 color control clip to select from choice of two filter chains
and used ReplaceFramesSimple instead of clipclop [RFS only deals with 2 clips]).

EDIT:
I suppose it creates an index clip of the same length as my input clip with a number of colored frames that are being used to filter the main clip differently in the next steps. Is that right ?

Yep, thats pretty much it, but every frame is significant, ie entire range of frames should be set at specific color, BLACK is source.

EDIT: By the way, did you actually try post #3 script, if so presumably that worked OK ?

StainlessS
22nd November 2014, 18:14
I forgot, there is already some Debug functionality in ClipClop, but only in the constructor (when parsing NickNames, Commands),
add DV=5 to ClipClop line. And download this DebugView and run before script.
http://technet.microsoft.com/en-gb/sysinternals/bb896647.aspx

It should at least let me know if it occurs in constructor or during GetFrame().

With crashing script, can you also try adding "PURGE=False" to clipclop line. (any difference ?)

Hotte
23rd November 2014, 19:39
Thanks, StainlessS.
First I replaced the input video, because it had less than 2.000 frames. Just to be clear: I am using an ordinary clip taken with my camera as input. Still it´s a canopus avi 50fps 1920x1080 that runs fine with mediaplayer or whatever.
I added PURGE=False and also DV=5 to the clipclop-line and I tried the code in #3 also.

I downloaded debug an started it.
Then I started the script with same result.
In any constellation Debug always throws the same single line:
[3456] SSETools 0.1

Is that of any help ?

StainlessS
23rd November 2014, 19:50
"[3456] SSETools 0.1", I think that is just a message saying the SSETools 0.1 have been installed (LoadPlugin),
Any program can write to debug output at any time.
My debug stuff usually incudes a colon ( : ) eg "ClipClop: ", you can set filter in debugview on only show debug
output including colon.
I'm gonna re-install my system now (crashing lately due to hacking several USB drivers for android devices, screwed the registry).

I'm not really sure what is happening, the bug reveals itself in VirtualDub so frame has already had metrics text rendered on frames
without access violation, not really a clue what the cause of bug is.

Hotte
23rd November 2014, 20:31
I am happy to try out something else if you like. No stress.

Just to be sure I added the code that causes the error here.
# MakeControlClipAVI.avs, Make Dummy control clip for testing, Save to Control.AVI

ORG=Avisource("D:\Video\_Pool\HD Nikon D5300\N3_00390.avi").ConvertToRGB32().PointResize(32,32).KillAudio # Take Blankclip attributes from this

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
"""

SHOW=FALSE

ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW,DV=5,PURGE=False)

StainlessS
20th December 2014, 14:35
I'm back, sorry, I sort of got waylaid.

Try This


# MakeControlClipAVI.avs, Make Dummy control clip for testing, Save to Control.AVI

# Requires clip at least 2001 frames

Avisource("D:\avs\test.avi")
#Avisource("D:\Video\_Pool\HD Nikon D5300\N3_00390.avi")

Trim(0,2000) # 2001 frames

ConvertToRGB32().KillAudio
# .PointResize(32,32) # We want to see Metrics in debug test

ORG=Last # Take Blankclip attributes from this

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
"""

SHOW =TRUE
PURGE=TRUE
DV =4

ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,scmd=SCMD,nickname=NickNames,show=SHOW,DV=DV,PURGE=PURGE)


Also included here with debug version LINK REMOVED, See post #40.
Just change to name of clip with at least 2001 frames.

Next post has sample of output

StainlessS
20th December 2014, 14:37
Post #2 of 2.

Sample Debug output

00000001 0.00000000 ClipClop: AvisynthPluginInt Calling Addfunction
00000002 0.00004232 ClipClop: AvisynthPluginInt Returns to Avisynth
00000003 0.13216157 SSETools 0.1
00000004 0.26308435 ClipClop: AvisynthPluginInt Calling Addfunction
00000005 0.26310748 ClipClop: AvisynthPluginInt Returns to Avisynth
00000006 0.26315022 ClipClop: Create_ClipClop ENTRY
00000007 0.26317528 ClipClop: Create_ClipClop Getting dv from args[6].AsInt(0)
00000008 0.26319981 ClipClop: Create_ClipClop Check Invalid dv
00000009 0.26322374 ClipClop: Create_ClipClop Printing (c)
00000010 0.26324499 ClipClop:
00000011 0.26326647 ClipClop: v1.22 - 20 Dec 2014 - (c) StainlessS.
00000012 0.26328796 ClipClop:
00000013 0.26330933 ClipClop: DEBUG, Avisynth Creating Filter. Calling ClipClop Constructor
00000014 0.26333857 ClipClop: DEBUG, Constructor IN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
00000015 0.26336256 ClipClop: DEBUG, ENTRY Rx Clips = 12
00000016 0.26338610 ClipClop: DEBUG, Command File = NO ('')
00000017 0.26340926 ClipClop: DEBUG, Command String = YES
00000018 0.26343262 ClipClop: DEBUG, NoErr = NO
00000019 0.26345587 ClipClop: DEBUG, DV = 4
00000020 0.26347896 ClipClop: DEBUG, Show = YES
00000021 0.26350209 ClipClop: DEBUG, Ver = NO
00000022 0.26352519 ClipClop: DEBUG, Nickname = YES
00000023 0.26354855 ClipClop: DEBUG, Purge = YES
00000024 0.26357061 ClipClop: DEBUG,
00000025 0.26359525 ClipClop: DEBUG, About to Allocate Arrays
00000026 0.26363355 ClipClop: DEBUG, About to Initalize Arrays & Check ColorSpace & Rez
00000027 0.26368421 ClipClop: INFO, Source clip R0 = 2001 frames
00000028 0.26371622 ClipClop: DEBUG, Initalize & Check Done, About to Parse
00000029 0.26373932 ClipClop: DEBUG, About to Parse Nicknames
00000030 0.26376501 ClipClop: DEBUG, NICKNAME Line 1:1 *COMMENT ONLY* # Psuedonyms for clip index
00000031 0.26379389 ClipClop: INFO, NICKNAME Line 2:1 SOURCE=R0 : $SOURCE = 0 # Original Clip BLACK
00000032 0.26382202 ClipClop: INFO, NICKNAME Line 3:1 L0=R1 : $L0 = 1 # Light Luma BLUE
00000033 0.26384926 ClipClop: INFO, NICKNAME Line 4:1 L1=R2 : $L1 = 2 # Med Luma GREEN
00000034 0.26387659 ClipClop: INFO, NICKNAME Line 5:1 L2=R3 : $L2 = 3 # High Luma CYAN
00000035 0.26390368 ClipClop: INFO, NICKNAME Line 6:1 C0=R4 : $C0 = 4 # Light Chroma RED
00000036 0.26393101 ClipClop: INFO, NICKNAME Line 7:1 C1=R5 : $C1 = 5 # Med Chroma MAGENTA
00000037 0.26395851 ClipClop: INFO, NICKNAME Line 8:1 C2=R6 : $C2 = 6 # High Chroma YELLOW
00000038 0.26398584 ClipClop: INFO, NICKNAME Line 9:1 LC0=R7 : $LC0 = 7 # Light Luma + Chroma WHITE
00000039 0.26401323 ClipClop: INFO, NICKNAME Line 10:1 LC1=R8 : $LC1 = 8 # Med Luma + Chroma ORANGE
00000040 0.26404062 ClipClop: INFO, NICKNAME Line 11:1 LC2=R9 : $LC2 = 9 # High Luma + Chroma DARKGRAY
00000041 0.26406819 ClipClop: INFO, NICKNAME Line 12:1 FH=R10 : $FH = 10 # Flip-H SILVER
00000042 0.26409569 ClipClop: INFO, NICKNAME Line 13:1 FV=R11 : $FV = 11 # Flip-V PLUM
00000043 0.26412323 ClipClop: INFO, NICKNAME Line 14:1 INV=R12 : $INV = 12 # Invert POWDERBLUE
00000044 0.26414704 ClipClop: DEBUG, About to Parse Command String
00000045 0.26417291 ClipClop: DEBUG, SCMD Line 1:1 *COMMENT ONLY* # Clip editing commands in string, can also use commands in file
00000046 0.26420280 ClipClop: INFO, SCMD Line 2:1 C0{4}[0,99] $C0 0,99 # Light Chroma frames @ 0 -> 99 RED
00000047 0.26423320 ClipClop: INFO, SCMD Line 3:1 L0{1}[100,299] $L0 100,-200 # Light Luma frames @ 100, 200 frames ie frames 100->299 BLUE
00000048 0.26426348 ClipClop: INFO, SCMD Line 4:1 INV{12}[300,399] $INV 300,399 # Invert 300->399 POWDERBLUE
00000049 0.26429293 ClipClop: INFO, SCMD Line 5:1 L0{1}[400,499] $L0 400,499 # Light Luma frames 400->499 BLUE
00000050 0.26432267 ClipClop: INFO, SCMD Line 6:1 FH{10}[500,599] $FH 500,599 # Flip-H 500->599 SILVER
00000051 0.26435244 ClipClop: INFO, SCMD Line 7:1 LC2{9}[600,699] $LC2 600,699 # High Luma + Chroma DARKGRAY
00000052 0.26438093 ClipClop: INFO, SCMD Line 8:1 C1{5}[800,800] $C1 800 # Med Chroma, Single frame MAGENTA
00000053 0.26441076 ClipClop: INFO, SCMD Line 9:1 L0{1}[900,999] $1 900,999 # Light Luma, We used the clip number instead of a NickName BLUE
00000054 0.26444116 ClipClop: INFO, SCMD Line 10:1 FV{11}[1000,1099] $FV 1000,1099 # Flip-V PLUM
00000055 0.26447037 ClipClop: INFO, SCMD Line 11:1 LC1{8}[2000,2000] $LC1 2000,0 # Med Luma + Chroma, 2000 -> lastframe ORANGE
00000056 0.26449230 ClipClop: INFO,
00000057 0.26451555 ClipClop: INFO, ---------- Purge Check ---------
00000058 0.26453742 ClipClop: INFO,
00000059 0.26456189 ClipClop: INFO, L1 (R2) Not used in Output Clip ... Purging
00000060 0.26458618 ClipClop: INFO, L2 (R3) Not used in Output Clip ... Purging
00000061 0.26461053 ClipClop: INFO, C2 (R6) Not used in Output Clip ... Purging
00000062 0.26463470 ClipClop: INFO, LC0 (R7) Not used in Output Clip ... Purging
00000063 0.26465780 ClipClop: INFO, Clips Purged = 4
00000064 0.26467955 ClipClop: INFO,
00000065 0.26470277 ClipClop: DEBUG, Constructor About to End
00000066 0.26472574 ClipClop: DEBUG, Constructor 0 Errors
00000067 0.26474980 ClipClop: DEBUG, Constructor OUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
00000068 0.26477149 ClipClop: DEBUG, Returning ClipClop Filter to Avisynth
00000069 0.26479468 ClipClop: Create_ClipClop EXIT
00000070 0.51500839 ClipClop:
00000071 0.51502734 ClipClop: GetFrame on Frame 0
00000072 0.51505649 ClipClop: GetFrame on Frame 0 Calling rClips[4]->GetFrame(0)
00000073 0.51508272 ClipClop: GetFrame on Frame 0 Check Non NULL, rClips[4] = $0162EAA0
00000074 0.52703381 ClipClop: GetFrame Calling DrawShow to print metrics
00000075 0.52759683 ClipClop: DrawShow Making Writable and rendering metrics
00000076 0.52893412 ClipClop: DrawShow_0 Writing Metrics='0 ] ClipClop:'
00000077 0.52899581 ClipClop: DrawShow_1 Writing Metrics='Using Clip C0{R4}[0]'
00000078 0.52907097 ClipClop: GetFrame Returned from DrawShow
00000079 0.52911550 ClipClop: GetFrame Returning frame 0 to Client
00000080 0.56394333 ClipClop:
00000081 0.56398171 ClipClop: GetFrame on Frame 1
00000082 0.56402183 ClipClop: GetFrame on Frame 1 Calling rClips[4]->GetFrame(1)
00000083 0.56406194 ClipClop: GetFrame on Frame 1 Check Non NULL, rClips[4] = $0162EAA0
00000084 0.56411493 ClipClop: GetFrame Calling DrawShow to print metrics
00000085 0.56414109 ClipClop: DrawShow Making Writable and rendering metrics
00000086 0.56491482 ClipClop: DrawShow_0 Writing Metrics='1 ] ClipClop:'
00000087 0.56497115 ClipClop: DrawShow_1 Writing Metrics='Using Clip C0{R4}[1]'
00000088 0.56503612 ClipClop: GetFrame Returned from DrawShow
00000089 0.56506181 ClipClop: GetFrame Returning frame 1 to Client
00000090 0.60306340 ClipClop:
00000091 0.60308617 ClipClop: GetFrame on Frame 2
00000092 0.60311323 ClipClop: GetFrame on Frame 2 Calling rClips[4]->GetFrame(2)
00000093 0.60314047 ClipClop: GetFrame on Frame 2 Check Non NULL, rClips[4] = $0162EAA0
00000094 0.60316902 ClipClop: GetFrame Calling DrawShow to print metrics
00000095 0.60319525 ClipClop: DrawShow Making Writable and rendering metrics
00000096 0.60393482 ClipClop: DrawShow_0 Writing Metrics='2 ] ClipClop:'
00000097 0.60399139 ClipClop: DrawShow_1 Writing Metrics='Using Clip C0{R4}[2]'
00000098 0.60405618 ClipClop: GetFrame Returned from DrawShow
00000099 0.60408169 ClipClop: GetFrame Returning frame 2 to Client
00000100 0.64785111 ClipClop:

...

00000340 1.59617686 ClipClop:
00000341 1.59637558 ClipClop: GetFrame on Frame 27
00000342 1.59639561 ClipClop: GetFrame on Frame 27 Calling rClips[4]->GetFrame(27)
00000343 1.59642994 ClipClop: GetFrame on Frame 27 Check Non NULL, rClips[4] = $0162EAA0
00000344 1.59658682 ClipClop: GetFrame Calling DrawShow to print metrics
00000345 1.59667611 ClipClop: DrawShow Making Writable and rendering metrics
00000346 1.59767580 ClipClop: DrawShow_0 Writing Metrics='27 ] ClipClop:'
00000347 1.59768903 ClipClop: DrawShow_1 Writing Metrics='Using Clip C0{R4}[27]'
00000348 1.59776580 ClipClop: GetFrame Returned from DrawShow
00000349 1.59779859 ClipClop: GetFrame Returning frame 27 to Client
00000350 1.60504556 ClipClop: DEBUG, Destructor IN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
00000351 1.60506737 ClipClop: DEBUG, Destructor delete[] Pseudonyms
00000352 1.60514390 ClipClop: DEBUG, Destructor delete[] rFramesHi
00000353 1.60515594 ClipClop: DEBUG, Destructor delete[] rClips
00000354 1.60519373 ClipClop: DEBUG, Destructor delete[] modedat
00000355 1.60523093 ClipClop: DEBUG, Destructor OUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hotte
21st December 2014, 16:32
Hi Stainless,

welcome back and thanks a lot for your efforts.

I downloaded Cliclop-Debug dll and started the code above replacing test-avi with my file that you were being so nice to leave as comment in the code.

Error-Message was the same:
Avisynth open failure:
Avisynth: access violation at 0x00000000 in C:\Diverses\VirtualDub\VirtualDub.exe,
attempting to read from 0x00000000
(D:\Temp\clipclop.avs, line 76)

Debug output has only 6 lines:
[2904] ClipClop: AvisynthPluginInt Calling Addfunction
[2904] ClipClop: AvisynthPluginInt Returns to Avisynth
[2904] SSETools 0.1
[2904] ClipClop: AvisynthPluginInt Calling Addfunction
[2904] ClipClop: AvisynthPluginInt Returns to Avisynth
[2904] ClipClop: Create_ClipClop ENTRY

I hope that helps.
Hotte

StainlessS
21st December 2014, 17:02
Well that is weird, everything looks OK to me, perhaps I cannot see the wood for the trees.

Here is source, perhaps someone can spot a problem that I cannot.

// This is the function that created the filter, when the filter has been called.
// This can be used for simple parameter checking, so it is possible to create different filters,
// based on the arguments recieved.

AVSValue __cdecl Create_ClipClop(AVSValue args, void* user_data, IScriptEnvironment* env) {
DPRINTF(("Create_ClipClop ENTRY")) // LAST Message Printed
DPRINTF(("Create_ClipClop Getting dv from args[6].AsInt(0)")) // Added Line
int dv = args[6].AsInt(0); // dv
DPRINTF(("Create_ClipClop Check Invalid dv")) // Added Line
if(dv<0 || dv>4) { // Default to Debug if invalid
DPRINTF(("Create_ClipClop Correcting dv")) // Added Line
dv=4;
}
if(dv) { // Below SHOULD be printed as dv == 4, ie crash before here
DPRINTF(("Create_ClipClop Printing (c)")) // Added Line
OutputDebugString("ClipClop:\n"); // Line separator in DebugView
OutputDebugString(VERS " - (c) StainlessS.\n"); // Version
OutputDebugString("ClipClop:\n"); // Line separator in DebugView
}
if(dv>3) {
OutputDebugString("ClipClop: DEBUG, Avisynth Creating Filter. Calling ClipClop Constructor\n");
}
// Call the constructor with the arguments provied.
AVSValue ret = new ClipClop(
args[0].AsClip(), // clip compulsory arg
args[1], // Rx array, at least one
args[2].AsString(""), // Cmd file
args[3].AsString(""), // SCmd String
args[4].AsBool(false), // Show
args[5].AsBool(false), // Ver
dv, // dv
args[7].AsBool(false), // NoErr
args[8].AsString(""), // Nickname
args[9].AsBool(true), // Purge
env);
if(dv>3)
OutputDebugString("ClipClop: DEBUG, Returning ClipClop Filter to Avisynth\n");
DPRINTF(("Create_ClipClop EXIT"))
return ret;
}


// The following function is the function that actually registers the filter in AviSynth
// It is called automatically, when the plugin is loaded to see which functions this filter contains.
#ifdef AVISYNTH_PLUGIN_25
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) {
#else
/* New 2.6 requirement!!! */
// Declare and initialise server pointers static storage.
const AVS_Linkage *AVS_linkage = 0;

/* New 2.6 requirement!!! */
// DLL entry point called from LoadPlugin() to setup a user plugin.
extern "C" __declspec(dllexport) const char* __stdcall
AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {

/* New 2.6 requirment!!! */
// Save the server pointers.
AVS_linkage = vectors;
#endif
DPRINTF(("AvisynthPluginInt Calling Addfunction"))
env->AddFunction("ClipClop", "cc+[Cmd]s[SCmd]s[Show]b[Ver]b[dv]i[NoErr]b[Nickname]s[Purge]b", Create_ClipClop, 0);
// The AddFunction has the following paramters:
// AddFunction(Filtername , Arguments, Function to call,0);

// Arguments is a string that defines the types and optional nicknames of the arguments for you filter.
// c - Video Clip
// i - Integer number
// f - Float number
// s - String
// b - boolean
// . - Any type (dot)
// Array Specifiers
// i* - Integer Array, zero or more
// i+ - Integer Array, one or more
// .* - Any type Array, zero or more
// .+ - Any type Array, one or more
// Etc

DPRINTF(("AvisynthPluginInt Returns to Avisynth"))
return "`ClipClop' ClipClop plugin";
// A freeform name of the plugin.
}

StainlessS
21st December 2014, 17:54
ClipClop Debug updated here with 2.6 + 2.58 dll's and source added.
http://www.mediafire.com/download/spi25vgbhmsuauc/ClipClop_Debug.zip

EDIT: Added a couple more messages to debug output, re-uploaded.

Debug output in post #37 updated.

StainlessS
21st December 2014, 22:44
OK, I think I may have twigged what the problem is,

The error is precisely:
Avisynth open failure
Avisynth: access violation at 0x00000000 in c:\...VirtualDub.exe
attempting to read from 0x00000000
(D:\...\myscript.avs, line 64)

line64 is the ClipClop(V0,... line, which is the last line in myscript.avs.
My avisynth Version is 2.60 built 2012-05-16
My load command is ORG=Avisource("D:\Video\_Pool\bk.avi").ConvertToRGB32()....
bk.avi is a 4-sek Edius canopus hq 1920x1080 avi source clip at 50fps and is 156Mbytes large.
I have not quite understood what the first step does. I suppose it creates an index clip of the same length as my input clip with a number of colored frames that are being used to filter the main clip differently in the next steps. Is that right ?

We use this in source

/* New 2.6 requirement!!! */
// Declare and initialise server pointers static storage.
const AVS_Linkage *AVS_linkage = 0;

/* New 2.6 requirement!!! */
// DLL entry point called from LoadPlugin() to setup a user plugin.
extern "C" __declspec(dllexport) const char* __stdcall
AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {

/* New 2.6 requirment!!! */
// Save the server pointers.
AVS_linkage = vectors;


Which is implemented for Avisynth v2.6 Alpha 4 (you are using Alpha 3),

Update to v2.6 Alpha 5, and I hope the problem will disappear. (Or alternatively use the v2.58 dll).

(Although, how it gets as far as it does without crashing sooner, I dont know.)

EDIT: This post seems to confirm conclusion: http://forum.doom9.org/showthread.php?p=1657879#post1657879

EDIT: Although according to Sourceforge, there were releases in March 2011 and next was Jan 2013, so perhaps you are using
an MT version.

EDIT: Yep, GOT IT. Installed MT version from same date as yours and I get a crash, update as suggested to latest MT should fix it.
Here: http://forum.doom9.org/showthread.php?t=148782

EDIT: Yep, the new MT v2.6 works fine. You may need the latest version of 7zip to extract Avisynth.dll as WinRar may have problems with the new 7zip format used.

Hotte
23rd December 2014, 01:26
YEAH!
I was able to produce this control clip with changing colours over time now. But I had to add ConvertToYV12 at the very end, otherwise Canopus HQ would have produced a plain blank avi out of virtual dub (it does not seem to like RGB). I hope this is of no disadvantage of any kind in the next steps !?

Sorry to report that it took me quite some time to find out, that I need your RT_stats-plugin to proceed with step 2 (it does not seem to be mentioned as a prerequisite in the doc...).
Another great addition as far as I am able to judge....

So next trap door now. I am sure, this is a much easier one for you:

Avisynth open failure:
Script error: there is no function named "GSCript"
(D:\Temp\Create Commandfile.avs, line 166)
(D:\Temp\Create Commandfile.avs, line 32)

It´s there ?!

# MakeClopCmd.avs, Convert commands embedded in Control.AVI RGB COLOUR, to ClipClop Command file.

Avisource("D:\Temp\Control.avi").ConvertToRGB32 # Just incase RGB24
CMD = "Command.Txt" # ClipClop Command file (Output of this script)

###
### HERE, YOU DECIDE THE NICKNAMES TO USE FOR WHICH COLOR CONTROL, BUT NOT WHICH CLIP INDEX THEY REFER TO
###

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
"""

###
### Create Color_Code -> NickName DBase
###
RT_FileDelete(CMD) # Delete existing Command file
DB = "~"+RT_LocalTimeString+".DB" # Temp DBase filename
RT_DBaseAlloc(DB,0,"iss") # Create zero record DB (Int,String,String)
MakeColorNickDBase(DB,MAP) # Fill DB with Color->NickName data (sorted by HexColor)

###
### Scan Control.AVI and create ClipClop Command file
###
GSCript("""
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) {
Dat = (n==FC) ? -1 : RT_BitAND(RT_RGB32AsInt(n=n,x=0,y=0),$FFFFFF) # Sample single pixel RGB32 Color as Int (clr Alpha)
if(n == FC || Dat != CurrCol) {
Frames = n - SFrm
if(Frames > 0) { # If not Frame 0
if(Frames == 1) { # Write NickName and Frame Number
RT_DebugF("%-16s %6d # $%06X %s",CurrNick,SFrm,CurrCol,CurrComm)
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)
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_FileDelete(DB) # Clean up
return MessageClip(RT_String("All Done, Created %s",CMD))

###
###
###
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
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
}
""")


Function MakeColorNickDBase(String DB,String MAP) {
/*
Parse MAP string and create Sort Ascending (by Hex Color) DBase for efficiently Scanning Control.AVI
*/
GSCript("""
MAP=RT_StrReplaceDeep(RT_StrReplace(MAP,Chr(9)," ")," "," ") # TAB and 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
For(i=0,NLINES-1) {
STR = RT_TxtGetLine(M,i)
S = STR
While(RT_Ord(S)==32) { S=MidStr(S,2) } # Eat White
if(MidStr(S,1,1)=="$") {
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("String(%d) Hex Color Code Missing @'%s'\n'%s'",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(MidStr(S,1,1)=="=") {
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("String(%d) NickName Missing @'%s'\n'%s'",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(MidStr(S,1,1)=="#") {
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) # 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("String(%d) Non Parse @'%s'\n'%s'",i,S,STR))
}
""")
Return RT_DBaseRecords(DB) # Return Something
}


Thanks!

StainlessS
23rd December 2014, 05:44
Whoops, sorry bout dat. Almost everything I do requires RT_Stats, also GScript, and sometimes GRunt, both from that now elusive fellow Gavino.
(rumour has it that he has gotten religion, and gone to work in a leper colony on the dark side of the moon) :)

GSCript: http://forum.doom9.org/showthread.php?t=147846&highlight=GSCript

GRunt: http://forum.doom9.org/showthread.php?t=139337

It is suggested to always have both of these gems in your autoload plugins dir.
GScript allows use of eg if/else and for/while loops to extend the Avisynth script language
(makes some things a lot less cumbersome, and some impossible/implausible things possible).

There may be potential problem Converting to YV12 for Canopus as conversion to YV12 and back again to RGB can set inexact RGB color,
(R and/or G and/or B component off by 1). You might need to use only specific colors that convert to YV12 and back again without being
'zonked'.
Is it not possible to use eg UT_Video, very good codec and fast. Do some comparisons with Canopus and see if you like it.

EDIT: Also, the Control.avi will only be 32x32 in size so does not actually require any kind of HD codec.

EDIT: The Control.avi stuff relies on exact RGB color, anything else would both complicate and slow your workflow (significantly).

EDIT: Only the Control.avi needs to be RGB, your working clip can be any colorspace you like.

Hotte
23rd December 2014, 09:41
Thanks, that was definetly helpful.

I also downloaded UT-codec and coded the Control.avi in RGB as Utvideo RGB VCM using Fast recompress in VDub.

Now I am getting:
Avisynth open failure:
Cannot Find RGB Hex Color($DF0000) in DBase @ Frame 0
([GScript], line 29)
([GScript], line 34)
([GScript], line 35)
([GScript], line 35)
(D:\Temp\Videotest\Create Commandfile.avs, line 101)

StainlessS
23rd December 2014, 14:05
Hi Hotte, that threw me a little bit, but figured it out.
You need to use the original script from post #26 and not the debugging script which puts metrics on frame.
EDIT: To make the control.avi

Also, dump the debug version of ClipClop and use the current release, everything should then I hope run OK.

EDIT: Also, You dont need to use Fast Recompress in VD, as it is already RGB and being compressed to UT_Video RGB,
just saving you from doing an un-necessary step every time, just leave on Full Processing, dont think there will be much
if any time penalty.

Hotte
23rd December 2014, 20:27
Getting close now, but still...
I did everything you asked me, i.e. replaced clipclop26.dll and used the script of #26, and so I got the command-text file.

Now on to step 3 I run into new troubles while opening the script:

Avisynth open failure:
Avisynth: access violation at 0x000428E9 in C:\Windows\system32\fftw3.dll,
attempting to write to 0x00000040
(D:\Temp\Videotest\Create Final.avs, line 14)


Before you decide to have a look into this - remember it´s Christmas!

Avisource("D:\Video\_Pool\HD Nikon D5300\N3_00390.avi")

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 MUST match those used in previous script

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
"""

SHOW=True
ClipClop(V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,cmd=CMD,nickname=NickNames,show=SHOW)

StainlessS
23rd December 2014, 20:52
I am sorry, forgot how much a newbie you are. ( well at post start, I had no idea of that,
Bit pissed right now.
Perhaps someone else can advise on required dll, s.
Is fft3dfilter,
Please some one sort him out.

Actually, that is just a democlip, and u could substitute anything.
Hotte, I expect you to get into av scripting, you know it makes sense.

Hotte
23rd December 2014, 21:30
Oops! Very sorry for that.

If it is just a missing dll I´ll be getting there. I thought I had FFT3DFilter installed already and the message was driving me into wrong direction. You really went a long way. Thanks a lot.

Hotte
23rd December 2014, 22:06
GOT IT RUNNING NOW!

I just replaced FFT3DFilter with the filters of my taste (I do not use FFT3DFilter anyway) and here we are: The effects change nicely over time steered by the color index clip.

This way I will be able to use color to preempt automated post-processing with avisynth in NLE already. That christmas-dream has come true.

StainlessS:thanks::thanks::thanks: for this powerful tool and excellent advice.

Hotte
24th December 2014, 13:01
Meanwhile last message from my side:

I made a couple of tests in connection with my video editor and I can tell you that it works perfectly and is most recommended. Some (like me) may have to adjust index colors to get there since NLE-export might shift colors somewhat.

Again thanks to StainlessS. clipclop is a very useful tool!

If anyone is interested in a summary of what came out of all the discussion and how you can make use of it for yourself, just leave a message. Then I will write something after christmas days.

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.