ClipClop

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (added category)
(ClipClop: add documentation)
 
Line 1: Line 1:
#REDIRECT [[External_filters#Frame_Replacement.2FRange_Processing]]
+
{{FilterCat5|External_filters|Plugins|Plugins_x64|Adjustment_filters|Range_Processing}}
{{FilterCat|External_filters|Adjustment_filters|Range_Processing}}
+
[[Category:Plugins]]
 +
{{Filter3
 +
|1={{Author/StainlessS}}
 +
|2=v1.26
 +
|3=[https://web.archive.org/web/20200526144512if_/https://files.videohelp.com/u/223002/ClipClop_x86_x64_dll_v1-26_20181222.zip ClipClop_x86_x64_dll_v1-26_20181222.zip]
 +
|4=Frame Replacement / Range Processing
 +
|5=[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 +
|6=[https://forum.doom9.org/showthread.php?t=162266 Doom9 Forum]
 +
}}
 +
<br>
 +
== Description ==
 +
ClipClop is a simple plugin to replace ranges in a source clip with the same range, from a replacement clip. Supports up to 255 replacement clips, with unlimited number of replacements into output clip.
 +
 
 +
If you wanted to do 1000 single frame replacements in script, that would require 3 trims and 2 splices for each replaced frame, ie 3000 trims and 2000 splices. This would involve 5000 'zero cost' filters which together will cost a little more than zero. With ClipClop(), this is reduced to 1 single filter with an overhead of approx 1 trim or splice filter. There is a small overhead setting up the filter (before the very 1st frame is fetched) while parsing the file/string commands, but then parsing and setting up 5000 trim/splice filters in a script would not be without cost either. Clipclop can parse in the region of 40,000 commands (from file) in about 1 second [guessed, based on timing the sister plugin Prune(), a trim/splice plugin].
 +
 
 +
v1.10, Implements 'Nickname's, Pseudonyms for the replacement clips, ie instead of '17 100,200' you could use eg 'dn 100,200', in this case it might be to replace frames 100 to 200 of the source clip with the same frames of a denoised clip (clip 17). OR, 'cp 345' to replace frame 345 with a clip where frame n was copied from frame n-1 of the source clip, ie CopyFromPrevious
 +
[this could be generated via 'SelectEvery(1,-1)', or 'CopyFromNext' clip by 'SelectEvery(1,1)]. Supports Nicknames of up to 31 characters in length so you could use eg 'PredictFromPrevious 1234', or 'FlippedVertical 666,999'. Nicknames allow you to think in terms of functionality rather than to keep looking up which clip index holds a modified clip and you could actually write your command file/string before you even know how many clips you need, what clip index they will be, or even how you will actually create/process the clip.
 +
<br>
 +
<br>
 +
== Requirements ==
 +
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
 +
* [x64]: [[AviSynth+]]
 +
* Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 +
<br>
 +
* [https://www.microsoft.com/en-us/download/details.aspx?id=26368 Microsoft Visual C++ 2008 Redistributable Package (x86 / x64)]
 +
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>ClipClop-x86</tt>
 +
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>ClipClop-x64</tt>
 +
<br>
 +
 
 +
== [[Script variables|Syntax and Parameters]] ==
 +
<pre>
 +
ClipClop(clip source, clip R1, ... , clip R255, string 'Cmd',string 'SCmd', bool 'Show', bool 'Ver',int 'dv', bool 'NoErr',string "Nickname",bool "Purge")
 +
 
 +
Compulsory args:
 +
 
 +
        Source, clip, No default [AKA (also known as) R0 in commands].
 +
 
 +
        Rx,    clip, No Default
 +
                Replacement clips, at least one required,
 +
                The first clip R1, up to R255 are supported, 255 clips in all.
 +
 
 +
Optional args:
 +
 
 +
        Cmd,    string, Default= "", Not set.
 +
                Command file, use eg "Clop.txt" for command file in your *.avs script directory.
 +
 
 +
        SCmd,  string, Default= "", Not set.
 +
                Command String, as for command file, but commands supplied in a string rather than a file.
 +
 
 +
        Show    bool, Default= false.
 +
                true = Show info. v2.6 plugin only required for Show or Ver args with v2.6 colorspace.
 +
 
 +
        ver    bool, Default=false.
 +
                true = Show version. v2.6 plugin only required for Show or Ver args with v2.6 colorspace.
 +
 
 +
        dv      int, Default 0, possible values, 0 - 4 (Out of range values will default to 4==Debug==FULL)
 +
                Generates info/warning/error messages during the filter setup stage (before 1st frame is displayed).
 +
 
 +
                0 = No info
 +
                1 = Errors sent to DebugView window (Need DebugView Utility)
 +
                2 = Warnings & Errors sent to DebugView window
 +
                3 = Parsing Info, Warnings & Errors sent to DebugView window.
 +
                4 = Debug info, Parsing Info, Warnings & Errors sent to DebugView window (dll Testing, or just for your curiosity).
 +
 
 +
                In DebugView, filter for "ClipClop:" to skip all the extraneous stuff generated by other plugins/programs.
 +
                (On "Menu:Edit-Filter/Highlight", and enter "ClipClop:", all ClipClop messages are prefixed by "ClipClop:".
 +
 
 +
                http://technet.microsoft.com/en-gb/sysinternals/bb545027
 +
 
 +
        NoErr,  bool, Default false
 +
 
 +
                false = Stop on ANY command error. (usual mode)
 +
                    You will be informed in DebugView which (if any) errors can be ignored if switched to NoErr==true.
 +
 
 +
                true =  Suppress trivial errors where possible.
 +
                    Only use after you have viewed and dismissed as unimportant any DebugView errors displayed when NoErr==false.
 +
                    Not all errors are ignorable.
 +
 
 +
        Nickname, String, default "" (not set) [Added v1.10].
 +
                Nicknames representing a clip index eg 'cp 37' instead of '5 37'.
 +
 
 +
        Purge, bool, default True. (New v1.20)
 +
 
 +
                False, do not Purge un-used clips.
 +
 
 +
                True (Default), Purge unused clips. Set all un-used clips to NULL within ClipClop, so if they are not used
 +
                    anywhere else, then clips can be released from memory. Purged clips shown when dv==3 or 4, ie INFO or DEBUG.
 +
 
 +
 
 +
Clipclop is a simple plugin to replace ranges in a source clip with the same range,
 +
from a selection of up to 255 replacement clips, unlimited range replacements.
 +
The source clip must be supplied and at least one of the replacement clips must also to be
 +
supplied or it will throw an error.
 +
Also, the replacement clips must be in the same colorspace, same size as the source clip.
 +
If the Rx clips are longer than the source clip, then the framecount will be truncated
 +
to that of the source clip and will not produce an error (the clip itself will not be touched,
 +
the plugin will consider it to have the same frame count as the source).
 +
 
 +
ClipClop will accept up to 255 replacment (Rx) clips, they are not named
 +
and must follow the source clip. (Hopefully that is enough for those of you who are
 +
very demanding [You know who you are])  ;)
 +
Replacement clips start at R1 and go up to R255.
 +
 
 +
Either the command file (Cmd) or the Command string (SCmd) must also be supplied, if both
 +
are supplied, the commands in the Command File are processed first followed by those in the
 +
Command String. Where replacements are done more than once, the later one will take effect.
 +
 
 +
 
 +
The Command file (Cmd) and the Command String (SCmd) will have a series of ranges to 'clop'
 +
(ie replace) and will have the below format.
 +
 
 +
Rx(s,e)
 +
 
 +
 
 +
Where the 'R' is optional and can be omitted.
 +
 
 +
where x is the replacement clip index number eg R7 is replacement clip 7, (the first one is R1).
 +
 
 +
Where the '(' and ')' are optional and if skipped then the opening '(' must be replaced by Comma ',' or ' ' (SPACE).
 +
 
 +
Where the ',' (COMMA) can be replaced with a ' ' (SPACE) [only needed if 'e' is specified].
 +
 
 +
Where the ')' is strictly speaking, unnecessary, whether the '(' is used or not.
 +
 
 +
s is the start frame and MUST be supplied.
 +
 
 +
e is optional and if missing, then the range will consist of only 1 frame.
 +
 
 +
        If e=0, then the range will continue to the last frame of the REPLACEMENT CLIP (Rx) , it will not
 +
        produce an error if the replacement clip is shorter than the source clip. (would be limited to the
 +
        length of the shorter clip, either source or replacement).
 +
 
 +
        If e is -ve (negative) then it will represent a -ve frame count eg -2 means 2 frames.
 +
 
 +
These are all valid:
 +
 
 +
R1 (35,42)      # This is a comment
 +
R1 65 374
 +
2 1000
 +
3 3700 5000
 +
4 (36734,0)    # My helicopter is full of penguins
 +
5,23644,-3
 +
R6,20,30)
 +
R6(56,123
 +
 
 +
If the command file contained the above commands then clips R1 to R6 have all to be supplied to ClipClop.
 +
 
 +
The Cmd file commands MUST be line separated (ie one command per line).
 +
 
 +
The SCmd commands can be either Line Separated as the CMD commands or use a ';' SEMICOLON separator, as in
 +
 
 +
SCMD="R1(35,42) # My Zeppelin is full of lead ; R1 65 374
 +
        R2,1000,1200; R2(1400,1500)
 +
        R3(2000,-100)  # My Spaceship is replete with aardvarks"
 +
 
 +
 
 +
In SCmd, A SEMICOLON ';' would NOT be acceptable in a COMMENT, it would signify a new line and command pending
 +
(ie PARSE error, it would look for a command following the ';').
 +
 
 +
R0 can be used in the commands to mean replace with the source clip, might be of use to reset
 +
parts of a replaced range, back to how it originally was before previous clopping. Might be useful where
 +
eg denoised clip used to replace a range, produced several unacceptable frames that need to be restored from
 +
the original source.
 +
 
 +
-----------------------
 +
 
 +
v1.10, Nickname string is roughly the same format as SCMD, SEMICOLON (;) separated if on same line
 +
or line separated, and can also contain comments. A Nickname, MUST start with either an underscore ('_'),
 +
or an Alphabetic character ('A' -> 'Z' or 'a' -> 'z'). The remainder of the nickname can contain underscore,
 +
alphabetic or numeric ('0' - '9') characters, as in "_Testing_123_Testing" or "AnyOldName_432" or "Fred".
 +
The length limit on Nicknames is 31 characters.
 +
There are a set of RESERVED names that CANNOT be redefined by Nickname, "Rnnn" or "rnnn" where 'nnn' represents
 +
1 or more numeric digits. In a command file/string, you can use eg "R0" (or '0') to refer to the source clip and "R1"
 +
to "R255" (or '1' to '255') to refer to the replacement clips whether or not they have nicknames applied.
 +
As well as "(", "," and SPACE " " separators, a nickname allows "=". Below some valid examples:-
 +
 
 +
NickName = "
 +
    CopyFromPrevious=1 # Comment ; PredictFromNext,2 # another comment ; DN 3
 +
    CO=4
 +
    ZX(5)
 +
    QP (6)
 +
    XXX 7 # Patient: My hand hurts when I do this. ; ttt = 8 # Doctor: Then stop doing that!
 +
    ds123dgsdg__dld 9
 +
    ww(10
 +
    yy=11)
 +
"
 +
 
 +
Nicknames do not have to be in ascending order, but might be best to keep them that way.
 +
 
 +
Using above Nickname example,
 +
 
 +
"dn 2000,3000" would replace source frames 2000 to 3000 with clip 3 frames 2000 to 3000, when used in a command
 +
file or command string. Nicknames are case insignificant ('A' == 'a').
 +
 
 +
----------------------
 +
 
 +
If NoErr is true, then the plugin will try to avoid throwing an error for 'suspect' commands, not all
 +
errors will be ignored.
 +
Commands that do not fit in the valid formats described above will not be ignored (PARSE error).
 +
-ve start frame will not be ignored (PARSE error, it could be clipped to 0, but I REFUSE to allow it).
 +
If an Rx clip has been omitted (missed out) then all Rx commands can be ignored.
 +
If a range fully or partially falls outside of either the source or Rx clips, then those can
 +
be ignored (invalid part of the range).
 +
 
 +
 
 +
 
 +
It is recommended that you DO use the linked DebugView utility, to check out warnings,
 +
ClipClop() will try to warn you if you need to re-evaluate your,,, evaluations.
 +
It will warn of things like source and replacement clips being of different number of frames,
 +
there is no need to be alarmed by the NoErr option, you do not have to use it.
 +
Dont always use NoErr = true, unless you really really know what you
 +
are doing [or your name is 'Cretindesalpes' :) ].
 +
 
 +
---------------------------------------------------------------------------------------------
 +
Almost all of the hard work of ClipClop is done during setting up the filter. During the rendering
 +
stage, ClipClop() does not do anything terribly clever, it just selects the frame to use from a
 +
pre-calculated array or uses the source frame instead, but what it does do, it does fast as possible.
 +
How can ClipClop be used, well if your source is mostly OK, but one range needs some sort of denoising,
 +
and another range needs color correction and a third needs both, then you could eg create a denoised clip,
 +
and create a color corrected clip, and a third with both denoising and color correction and
 +
specify the ranges to 'clop' with the altered clips, Only the ranges that are actually
 +
used with have the denoising/color correction done, and the source clip will be used most
 +
of the time and those parts will be very fast.
 +
 
 +
Be warned, if you create a replacement clip using some ULTRA slow motion compensated function and eg
 +
replace 1 in 10 frames then it will fly like the wind for 9 frames and jerk to an almost halt for 1, repeatedly,
 +
this is not a problem in ClipClop(), it cannot make your ULTRA slow function go faster (It will be a little
 +
disturbing if you do that but you could always use eg "AssumeFPS(0.001)" to smooth out the jerks it might however
 +
take a little longer :)
 +
 
 +
---------------------------------------------------------------------------------------------
 +
 
 +
GetParity is implemented in the plugin as requested by Cretindesalpes (Thanks).
 +
 
 +
---------------------------------------------------------------------------------------------
 +
 
 +
Sister, Trim/splice plugin Prune() [v1.10 with Nicknames too].
 +
 
 +
http://forum.doom9.org/showthread.php?t=162446
 +
 
 +
 
 +
---------------------------------------------------------------------------------------------
 +
 
 +
v1.20, NickName's are extended to allow MAGIC CLIPS.
 +
Magic clips are handled more strictly and cannot be overwritten or redefined, and also cannot be used with a clip range,
 +
the range (or more specifically the number of clips [or frames]) is fixed in the NickName definition of the Magic Clip.
 +
Magic clips were added for a particular application and it is not expected that you will want to use them yourself,
 +
the application is included in the AVS folder by name DoctorFrames.avs.
 +
A Magic Clip is a series of associated clips which are treated as a special group, the number of clips in the group is
 +
indicated by being preceded by a colon (':').
 +
In NickName string,
 +
 
 +
NICKNAME="""
 +
    I3=6:3  # Interpolate 3 frames. Clips start at index 6, 3 clip group. Clip index's 6 to 6 + 3 - 1.
 +
"""
 +
 
 +
In above case, the Magic group starts at clip 6 and consists of 3 clips (ie clip 6 to clip 8).
 +
With a command of "I3 100" in either Cmd file or SCmd string,
 +
  Source_Frame      Replaced_With
 +
  R0(100)              R6(100)
 +
  R0(101)              R7(100)
 +
  R0(102)              R8(100)
 +
 
 +
You must use the NickName to do Magic Clip replacement, you cannot eg specify in SCMD "6 100", you must use eg "I3 100".
 +
You cannot overwrite a Magic Clip replacement, it will produce an error.
 +
 
 +
---------------------------------------------------------------------------------------------
 +
---------------------------------------------------------------------------------------------
 +
---------------------------------------------------------------------------------------------
 +
 
 +
Example usage script using NickNames:
 +
###
 +
    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 (clip index number)
 +
        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)
 +
</pre>
 +
<br>
 +
 
 +
== Examples ==
 +
[[TODO]]
 +
<br>
 +
<br>
 +
== Changelog ==
 +
<pre>
 +
    17/Aug/2011 - ver 1.0      - 1st Public Release
 +
    18/Aug/2011 - ver 1.01      - Bugfix, added Height check, Thanks IanB.
 +
    22/Aug/2011 - ver 1.02Alpha - Cretindesalpes, IanB & Gavino, suggested mods, Not released to public.
 +
    23/Aug/2011 - ver 1.02Beta  - Testing 123, Testing.
 +
    27/Aug/2011 - ver 1.03      - Now shows all parsing errors in DebugView before abort. Added SCMD line subindex.
 +
    29/Aug/2011 - ver 1.04      - Fixed, SCMD *IGNORED* clips generated an extra *EMPTYLINE* DebugView INFO entry.
 +
                                - Better warnings, error messages & advisory.
 +
    05/Nov/2011 - ver 1.05      - BUGFIX 'Rx(0)' interpreted as 'Rx(0,0)' instead of 'Rx(0,-1)'.
 +
    25/Mar/2012 - ver 1.10      - Added Nicknames.
 +
    17/Aug/2014 - ver 1.20      - Versions 2.5 and 2.6. Added Magic.
 +
    18/Nov/2014 - ver 1.21      - Fixed, was showing R%x hex Rx Clip instead of R%d decimal.
 +
    29/Mar/2015 - ver 1.22      - Recompile with VS 2008 and v2.6 dll with Avisynth 6 Header.
 +
    01/Apr/2015 - ver 1.23      - Display NickNames in original casing when Show.
 +
    28/Aug/2017 - ver 1.24      - If NoErr && Cmd="" && SCmd="" then return input source clip only (bypass ClipClop).
 +
    02/Nov/2017 - ver 1.25      - Recompile vs 2008
 +
    27/Oct/2018 - ver 1.26      - Add x64.
 +
</pre>
 +
<br>
 +
 
 +
== Archived Downloads ==
 +
{| class="wikitable" border="1"; width="500px"
 +
|-
 +
!!width="100px"| Version
 +
!!width="200px"| Download
 +
!!width="200px"| Mirror
 +
|-
 +
!v1.26
 +
|[https://web.archive.org/web/20200526144512if_/https://files.videohelp.com/u/223002/ClipClop_x86_x64_dll_v1-26_20181222.zip ClipClop_x86_x64_dll_v1-26_20181222.zip]
 +
|[http://www.mediafire.com/file/0992cb3ge40qh11/ClipClop_x86_x64_dll_v1-26_20181222.zip/file ClipClop_x86_x64_dll_v1-26_20181222.zip]
 +
|}
 +
<br>
 +
== External Links ==
 +
<br>
 +
<br>
 +
-----------------------------------------------
 +
'''Back to [[External_filters#Frame_Replacement/Range_Processing|External Filters]] &larr;'''
 +
-----------------------------------------------

Latest revision as of 15:56, 26 May 2020

Abstract
Author StainlessS
Version v1.26
Download ClipClop_x86_x64_dll_v1-26_20181222.zip
Category Frame Replacement / Range Processing
License GPLv2
Discussion Doom9 Forum


Contents

[edit] Description

ClipClop is a simple plugin to replace ranges in a source clip with the same range, from a replacement clip. Supports up to 255 replacement clips, with unlimited number of replacements into output clip.

If you wanted to do 1000 single frame replacements in script, that would require 3 trims and 2 splices for each replaced frame, ie 3000 trims and 2000 splices. This would involve 5000 'zero cost' filters which together will cost a little more than zero. With ClipClop(), this is reduced to 1 single filter with an overhead of approx 1 trim or splice filter. There is a small overhead setting up the filter (before the very 1st frame is fetched) while parsing the file/string commands, but then parsing and setting up 5000 trim/splice filters in a script would not be without cost either. Clipclop can parse in the region of 40,000 commands (from file) in about 1 second [guessed, based on timing the sister plugin Prune(), a trim/splice plugin].

v1.10, Implements 'Nickname's, Pseudonyms for the replacement clips, ie instead of '17 100,200' you could use eg 'dn 100,200', in this case it might be to replace frames 100 to 200 of the source clip with the same frames of a denoised clip (clip 17). OR, 'cp 345' to replace frame 345 with a clip where frame n was copied from frame n-1 of the source clip, ie CopyFromPrevious [this could be generated via 'SelectEvery(1,-1)', or 'CopyFromNext' clip by 'SelectEvery(1,1)]. Supports Nicknames of up to 31 characters in length so you could use eg 'PredictFromPrevious 1234', or 'FlippedVertical 666,999'. Nicknames allow you to think in terms of functionality rather than to keep looking up which clip index holds a modified clip and you could actually write your command file/string before you even know how many clips you need, what clip index they will be, or even how you will actually create/process the clip.

[edit] Requirements


*** vcredist_x86.exe is required for ClipClop-x86
*** vcredist_x64.exe is required for ClipClop-x64


[edit] Syntax and Parameters

ClipClop(clip source, clip R1, ... , clip R255, string 'Cmd',string 'SCmd', bool 'Show', bool 'Ver',int 'dv', bool 'NoErr',string "Nickname",bool "Purge")

Compulsory args:

        Source, clip, No default [AKA (also known as) R0 in commands].

        Rx,     clip, No Default
                Replacement clips, at least one required,
                The first clip R1, up to R255 are supported, 255 clips in all.

Optional args:

        Cmd,    string, Default= "", Not set.
                Command file, use eg "Clop.txt" for command file in your *.avs script directory.

        SCmd,   string, Default= "", Not set.
                Command String, as for command file, but commands supplied in a string rather than a file.

        Show    bool, Default= false.
                true = Show info. v2.6 plugin only required for Show or Ver args with v2.6 colorspace.

        ver     bool, Default=false.
                true = Show version. v2.6 plugin only required for Show or Ver args with v2.6 colorspace.

        dv      int, Default 0, possible values, 0 - 4 (Out of range values will default to 4==Debug==FULL)
                Generates info/warning/error messages during the filter setup stage (before 1st frame is displayed).

                0 = No info
                1 = Errors sent to DebugView window (Need DebugView Utility)
                2 = Warnings & Errors sent to DebugView window
                3 = Parsing Info, Warnings & Errors sent to DebugView window.
                4 = Debug info, Parsing Info, Warnings & Errors sent to DebugView window (dll Testing, or just for your curiosity).

                In DebugView, filter for "ClipClop:" to skip all the extraneous stuff generated by other plugins/programs.
                (On "Menu:Edit-Filter/Highlight", and enter "ClipClop:", all ClipClop messages are prefixed by "ClipClop:".

                http://technet.microsoft.com/en-gb/sysinternals/bb545027

        NoErr,  bool, Default false

                false = Stop on ANY command error. (usual mode)
                     You will be informed in DebugView which (if any) errors can be ignored if switched to NoErr==true.

                true =  Suppress trivial errors where possible.
                     Only use after you have viewed and dismissed as unimportant any DebugView errors displayed when NoErr==false.
                     Not all errors are ignorable.

        Nickname, String, default "" (not set) [Added v1.10].
                Nicknames representing a clip index eg 'cp 37' instead of '5 37'.

        Purge, bool, default True. (New v1.20)

                False, do not Purge un-used clips.

                True (Default), Purge unused clips. Set all un-used clips to NULL within ClipClop, so if they are not used
                    anywhere else, then clips can be released from memory. Purged clips shown when dv==3 or 4, ie INFO or DEBUG.


Clipclop is a simple plugin to replace ranges in a source clip with the same range,
from a selection of up to 255 replacement clips, unlimited range replacements.
The source clip must be supplied and at least one of the replacement clips must also to be
supplied or it will throw an error.
Also, the replacement clips must be in the same colorspace, same size as the source clip.
If the Rx clips are longer than the source clip, then the framecount will be truncated
to that of the source clip and will not produce an error (the clip itself will not be touched,
the plugin will consider it to have the same frame count as the source).

ClipClop will accept up to 255 replacment (Rx) clips, they are not named
and must follow the source clip. (Hopefully that is enough for those of you who are
very demanding [You know who you are])  ;)
Replacement clips start at R1 and go up to R255.

Either the command file (Cmd) or the Command string (SCmd) must also be supplied, if both
are supplied, the commands in the Command File are processed first followed by those in the
Command String. Where replacements are done more than once, the later one will take effect.


The Command file (Cmd) and the Command String (SCmd) will have a series of ranges to 'clop'
(ie replace) and will have the below format.

Rx(s,e)


Where the 'R' is optional and can be omitted.

where x is the replacement clip index number eg R7 is replacement clip 7, (the first one is R1).

Where the '(' and ')' are optional and if skipped then the opening '(' must be replaced by Comma ',' or ' ' (SPACE).

Where the ',' (COMMA) can be replaced with a ' ' (SPACE) [only needed if 'e' is specified].

Where the ')' is strictly speaking, unnecessary, whether the '(' is used or not.

s is the start frame and MUST be supplied.

e is optional and if missing, then the range will consist of only 1 frame.

        If e=0, then the range will continue to the last frame of the REPLACEMENT CLIP (Rx) , it will not
        produce an error if the replacement clip is shorter than the source clip. (would be limited to the
        length of the shorter clip, either source or replacement).

        If e is -ve (negative) then it will represent a -ve frame count eg -2 means 2 frames.

These are all valid:

R1 (35,42)      # This is a comment
R1 65 374
2 1000
3 3700 5000
4 (36734,0)     # My helicopter is full of penguins
5,23644,-3
R6,20,30)
R6(56,123

If the command file contained the above commands then clips R1 to R6 have all to be supplied to ClipClop.

The Cmd file commands MUST be line separated (ie one command per line).

The SCmd commands can be either Line Separated as the CMD commands or use a ';' SEMICOLON separator, as in

SCMD="R1(35,42) # My Zeppelin is full of lead ; R1 65 374
        R2,1000,1200; R2(1400,1500)
        R3(2000,-100)  # My Spaceship is replete with aardvarks"


In SCmd, A SEMICOLON ';' would NOT be acceptable in a COMMENT, it would signify a new line and command pending
(ie PARSE error, it would look for a command following the ';').

R0 can be used in the commands to mean replace with the source clip, might be of use to reset
parts of a replaced range, back to how it originally was before previous clopping. Might be useful where
eg denoised clip used to replace a range, produced several unacceptable frames that need to be restored from
the original source.

-----------------------

v1.10, Nickname string is roughly the same format as SCMD, SEMICOLON (;) separated if on same line
or line separated, and can also contain comments. A Nickname, MUST start with either an underscore ('_'),
or an Alphabetic character ('A' -> 'Z' or 'a' -> 'z'). The remainder of the nickname can contain underscore,
alphabetic or numeric ('0' - '9') characters, as in "_Testing_123_Testing" or "AnyOldName_432" or "Fred".
The length limit on Nicknames is 31 characters.
There are a set of RESERVED names that CANNOT be redefined by Nickname, "Rnnn" or "rnnn" where 'nnn' represents
1 or more numeric digits. In a command file/string, you can use eg "R0" (or '0') to refer to the source clip and "R1"
to "R255" (or '1' to '255') to refer to the replacement clips whether or not they have nicknames applied.
As well as "(", "," and SPACE " " separators, a nickname allows "=". Below some valid examples:-

NickName = "
    CopyFromPrevious=1 # Comment ; PredictFromNext,2 # another comment ; DN 3
    CO=4
    ZX(5)
    QP (6)
    XXX 7 # Patient: My hand hurts when I do this. ; ttt = 8 # Doctor: Then stop doing that!
    ds123dgsdg__dld 9
    ww(10
    yy=11)
"

Nicknames do not have to be in ascending order, but might be best to keep them that way.

Using above Nickname example,

"dn 2000,3000" would replace source frames 2000 to 3000 with clip 3 frames 2000 to 3000, when used in a command
file or command string. Nicknames are case insignificant ('A' == 'a').

----------------------

If NoErr is true, then the plugin will try to avoid throwing an error for 'suspect' commands, not all
errors will be ignored.
Commands that do not fit in the valid formats described above will not be ignored (PARSE error).
-ve start frame will not be ignored (PARSE error, it could be clipped to 0, but I REFUSE to allow it).
If an Rx clip has been omitted (missed out) then all Rx commands can be ignored.
If a range fully or partially falls outside of either the source or Rx clips, then those can
be ignored (invalid part of the range).



It is recommended that you DO use the linked DebugView utility, to check out warnings,
ClipClop() will try to warn you if you need to re-evaluate your,,, evaluations.
It will warn of things like source and replacement clips being of different number of frames,
there is no need to be alarmed by the NoErr option, you do not have to use it.
Dont always use NoErr = true, unless you really really know what you
are doing [or your name is 'Cretindesalpes' :) ].

---------------------------------------------------------------------------------------------
Almost all of the hard work of ClipClop is done during setting up the filter. During the rendering
stage, ClipClop() does not do anything terribly clever, it just selects the frame to use from a
pre-calculated array or uses the source frame instead, but what it does do, it does fast as possible.
How can ClipClop be used, well if your source is mostly OK, but one range needs some sort of denoising,
and another range needs color correction and a third needs both, then you could eg create a denoised clip,
and create a color corrected clip, and a third with both denoising and color correction and
specify the ranges to 'clop' with the altered clips, Only the ranges that are actually
used with have the denoising/color correction done, and the source clip will be used most
of the time and those parts will be very fast.

Be warned, if you create a replacement clip using some ULTRA slow motion compensated function and eg
replace 1 in 10 frames then it will fly like the wind for 9 frames and jerk to an almost halt for 1, repeatedly,
this is not a problem in ClipClop(), it cannot make your ULTRA slow function go faster (It will be a little
disturbing if you do that but you could always use eg "AssumeFPS(0.001)" to smooth out the jerks it might however
take a little longer :)

---------------------------------------------------------------------------------------------

GetParity is implemented in the plugin as requested by Cretindesalpes (Thanks).

---------------------------------------------------------------------------------------------

Sister, Trim/splice plugin Prune() [v1.10 with Nicknames too].

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


---------------------------------------------------------------------------------------------

v1.20, NickName's are extended to allow MAGIC CLIPS.
Magic clips are handled more strictly and cannot be overwritten or redefined, and also cannot be used with a clip range,
the range (or more specifically the number of clips [or frames]) is fixed in the NickName definition of the Magic Clip.
Magic clips were added for a particular application and it is not expected that you will want to use them yourself,
the application is included in the AVS folder by name DoctorFrames.avs.
A Magic Clip is a series of associated clips which are treated as a special group, the number of clips in the group is
indicated by being preceded by a colon (':').
In NickName string,

NICKNAME="""
    I3=6:3   # Interpolate 3 frames. Clips start at index 6, 3 clip group. Clip index's 6 to 6 + 3 - 1.
"""

In above case, the Magic group starts at clip 6 and consists of 3 clips (ie clip 6 to clip 8).
With a command of "I3 100" in either Cmd file or SCmd string,
   Source_Frame      Replaced_With
   R0(100)               R6(100)
   R0(101)               R7(100)
   R0(102)               R8(100)

You must use the NickName to do Magic Clip replacement, you cannot eg specify in SCMD "6 100", you must use eg "I3 100".
You cannot overwrite a Magic Clip replacement, it will produce an error.

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

Example usage script using NickNames:
###
    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 (clip index number)
        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)


[edit] Examples

TODO

[edit] Changelog

    17/Aug/2011 - ver 1.0       - 1st Public Release
    18/Aug/2011 - ver 1.01      - Bugfix, added Height check, Thanks IanB.
    22/Aug/2011 - ver 1.02Alpha - Cretindesalpes, IanB & Gavino, suggested mods, Not released to public. 
    23/Aug/2011 - ver 1.02Beta  - Testing 123, Testing.
    27/Aug/2011 - ver 1.03      - Now shows all parsing errors in DebugView before abort. Added SCMD line subindex.
    29/Aug/2011 - ver 1.04      - Fixed, SCMD *IGNORED* clips generated an extra *EMPTYLINE* DebugView INFO entry.
                                - Better warnings, error messages & advisory.
    05/Nov/2011 - ver 1.05      - BUGFIX 'Rx(0)' interpreted as 'Rx(0,0)' instead of 'Rx(0,-1)'.
    25/Mar/2012 - ver 1.10      - Added Nicknames.
    17/Aug/2014 - ver 1.20      - Versions 2.5 and 2.6. Added Magic.
    18/Nov/2014 - ver 1.21      - Fixed, was showing R%x hex Rx Clip instead of R%d decimal.
    29/Mar/2015 - ver 1.22      - Recompile with VS 2008 and v2.6 dll with Avisynth 6 Header.
    01/Apr/2015 - ver 1.23      - Display NickNames in original casing when Show.
    28/Aug/2017 - ver 1.24      - If NoErr && Cmd="" && SCmd="" then return input source clip only (bypass ClipClop).
    02/Nov/2017 - ver 1.25      - Recompile vs 2008
    27/Oct/2018 - ver 1.26      - Add x64.


[edit] Archived Downloads

Version Download Mirror
v1.26 ClipClop_x86_x64_dll_v1-26_20181222.zip ClipClop_x86_x64_dll_v1-26_20181222.zip


[edit] External Links




Back to External Filters


Personal tools