Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
17th August 2011, 20:56 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
ClipClop v1.27 - Range/Frame Replacement plug - 27 Jul 2021
Docs in brief (full docs see post #38:- https://forum.doom9.org/showthread.p...00#post1860800 )
Code:
ClipClop() Range/Frame Replacement Plugins for Avisynth v2.58, v2.60 avs+ x86 & x64 by StainlessS. Video:- Planar, YUY2, RGB32, RGB24. v2.60 dll all Valid Colorspaces incl HBD where Avs+. Does NOT affect Audio (as source clip). 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. 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) http://forum.doom9.org/showthread.php?t=162446 Also Get this, DebugView http://technet.microsoft.com/en-gb/s...rnals/bb545027 Available via Sig, mediafire.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 27th July 2021 at 21:30. |
17th August 2011, 22:15 | #2 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Oh this is great, I used to stack a bunch of ReplaceFramesSimple() commands to select between multiple clips and it wasn't very convenient.
Suggestions:
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding Last edited by cretindesalpes; 17th August 2011 at 22:17. |
17th August 2011, 23:07 | #3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
You could make the Replacement clip list an unlimited array instead of 10 fixed arguments, i.e. type string "cc+[cmd]s[show]b[ver]b".
Also you only test the width's are the same not the height's. |
18th August 2011, 02:45 | #4 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Not sure I get exactly what you mean there, could you spell out exactly how you envisage this please.
I will look into the other suggestions. Quote:
on such (eg a thread by vcmohan, in which you took part), I failed to get it working, and as I was in a hurry to get it working, I reversed back to the way it had been working prior to that. I actually like the ability to supply numbered clips and was probably going to add a flag to ignore Rx commands where Rx was not supplied. Also could easily increase command indexes by using 0-9,A-Z, but might be a bit tricky if only R were supplied instead of RR. I supplied the AVSValue arg in question to the constructor, but It just kept giving me zero number of elements in the array. Would 36 replace clips be insufficient?, if adamant, then I guess I could have another go at getting the cc+ thing working. Quote:
maybe two on it. Will correct that and update, before going to bed. @all Just for your info:- Will also probably make a plugin that can take a list of trims and output the result, probably with a number of source clips. EDIT:- See Prune() in mentioned in 1st post. Also, have currently got a plugin that uses comands for single frame replacement using named commands for eg: CP n, Copy frame n-1 into frame n from same source clip CN n, Copy frame n+1 into frame n from same source clip RF n, Copy frame n alternate clip into frame n of source clip. PP n, Copy frame n from PredictFromPrev clip to n of source. PN n, Copy frame n from PredictFromNext clip to n of source. Where PredictFrom clips are created in a script using MVTools. Also will add single frame bi-directional predicted clip and also a pair of bi-directional replacement clips for a pair of damaged frames. Also, Got a plugin on the drawing board, (working but incomplete) that selects single frames from a clip and could eg be used to 'pull out' frames used in the eg CP plugin above. This could be used instead of the CP plugin but using the same command file to view the edited/un-edited frames without lots of scanning. Also intend to give it the ability to pull out not just single frames but also optionally to pull out a frame either side of the single frames, and also the ability to put back a single frame in the same place that it got them from, all using the same command file. This would be potentially usefull for creating a RotoScoping software tool, that could be given both frames either side of a bad one to aid in hand repair of the frame in a RotorScoping paint type program. Afterwards, a SelectEvery(3,1) would pick out the edited frames and then put them back where they belong. Of course the frames could be saved as Bitmaps for the editing program if required and reloaded back into Avisynth converted to the correct colorSpace before replacement.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 12th October 2011 at 04:41. Reason: Clarification |
||
18th August 2011, 04:12 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
ClipClop v1.01 with height bug pointed out by IanB, fixed.
See attachment in first post (when cleared) or click on ExBlend in sig for MediaFire download.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
18th August 2011, 08:24 | #6 | Link | |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
Quote:
3 50 100 1 990 1100 7 2000 3000 and now we provide original and replacement clips with only 1000 frames. I would like the third command to be ignored and the second one truncated to range 990 999.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
|
18th August 2011, 12:11 | #7 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Why not just allow any integer? (ie 10 and up as well) I haven't looked at your source, but you obviously already have the ability to parse integers in order to recognise the frame numbers. I prefer the "cc+" style interface. One of the advantages of a plugin over a script function is that you can have a variable number of arguments in this way. You must be doing something wrong in the code if you can't get this to work, as it is very simple to do. |
|
18th August 2011, 12:47 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@cretindesalpes,
Thankyou for your clarification, that is probably how I would have interpreted your request, but was not 100% sure that was what you meant. It's coming. @Gavino, OK OK, enough already, I give up, shall have another go at the 'cc+' thing, but will I think keep the original working style (perhaps renamed) for myself, will also give ability to use multicharacter indexes. EDIT: I guess I was fixated on the Rx commands using only two characters because that is how they were originally implemented in another plugin with additional commands like CP and PN. The Rx commands were seen (by me) as two character commands rather than a clip index, I guess I left myself open to being forced to change, when I later made the 'R' optional, in ClipClop.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 22nd August 2011 at 17:25. |
23rd August 2011, 04:54 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here, is a revised version of the ClipClop v1.02Beta, helpfile for your perusal.
EDIT: Link Removed.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 27th August 2011 at 00:47. Reason: Outdated. |
27th August 2011, 00:49 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
New version, perhaps the last, ClipClop v1.03 for Avisynth 2.5+.
See First Post.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
27th August 2011, 05:05 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@cretindesalpes
v1.03, surpasses your requirements for ignoring out of range frames, it allows the Rx clips to be shorter than the source clip (as well as longer) and will ignore ranges/partial ranges that are invalid for shorter Rx clips. However, there is a tricky situation that I am unsure I have handled in the best manner. Source clip 1000 frames, Rx clip 500 frames. How should I handle Rx(980,0), The frame_end = 0 arg means frame 499 of the Rx clip and hence is below the frame_start arg, and therefore a non ignorable ERROR. I could rearrange the logic to check whether the start frame is higher than the end of Rx clip and ignore purely on that, before the comparison end frame < start frame. Do you have any thoughts in that area, perhaps you feel it would not be an issue, I would never use shorter Rx clips with Clipclop. EDIT: Anybody else feels like chiming in on the above question, please feel free.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 27th August 2011 at 18:39. |
28th August 2011, 10:33 | #12 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
I think it's good to ignore this error too. Let me explain my needs in detail. I have a framework for complex and resource-hungry avisynth processing. The whole processing is break up into multiple passes, and the clip is split into 1-minute segments, generating a lot of lossless intermediate files. A few .bat scripts run multiple avisynth instances simultaneously to process the segments and synchronize after each pass until all passes are done.
When I'm processing segment S from pass P, the avs script loads and concatenates segments S-1, S and S+1 from pass P-1 (or any other previous pass), inserts blank frames at the beginning to shift the loaded content at its original position but does nothing at the end. The result is trimmed to segment S. I use a single script per pass and all mentioned frames numbers are relative to the clip beginning, as if it was all in one piece. And this is where I need the plugin to ignore out-of-range frames when they are not requested, because when processing a segment, the script doesn't know the real length of the full clip. A plugin like TFM has this very issue with its override file, but as a workaround, it gracefully handles a Loop(-1) on its input and a subsequent Trim(), so it's easy to write a wrapper around it. ReplaceFrameSimple isn't fixed as easily, that's why I greatly appreciate this working alternative.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding Last edited by cretindesalpes; 28th August 2011 at 10:37. |
29th August 2011, 02:53 | #13 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@cretindesalpes
I am sorry, it seems my answer to you got a bit lost I did do a significant post, but it aint here now. (EDIT: my Mobile Broadband keeps disconnecting me lately.) Here, is a revised version of the ClipClop v1.04, See 1st post.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 2nd September 2011 at 10:37. |
5th November 2011, 07:42 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Clipclop() v1.05 update see first post, available via sig until attachement cleared.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
25th March 2012, 03:35 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
New Version v1.10, Major improvement, see 1st post.
Code:
ClipClop() v1.10, Range/Frame Replacement Plugin for Avisynth v2.5+ by StainlessS. Planar, YUY2, RGB32, RGB24. Does NOT affect Audio (as source clip). 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 40000 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. Once you've tried ClipClop(), you will wonder why you spent all those years doing it the hard way. (Repeat after me, "I dooo believe in Fairies!".)
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th March 2012 at 03:44. |
27th March 2012, 05:34 | #16 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here a modification of a script function posted by Gavino (Thankyou Maestro)
http://forum.videohelp.com/threads/3...=1#post2089696 EDIT: Update version of below DoctorFrames included in zip, with frame interpolations up to 22 frames. Code:
Function DoctorFrames(clip c, String "Scmd",String "Cmd",bool "Show",int "dv") { # Replace damaged single frames using commands in a either command string or file. Scmd = Default(Scmd,"") # User supplied list of newline or semicolon separated commands. Cmd = Default(Cmd,"") # User supplied Filename containing newline separated commands. Show = Default(Show,false) # Show Info on frame dv = Default(dv,0) # ClipClop DebugView level (Need DebugView utility) sup = c.MSuper() PreFilt = c.DeGrainMedian() # prefiltered for better motion analysis supPreFilt = PreFilt.MSuper() ci_bv = sup.MAnalyse(isb=true, delta=2) ci_fv = sup.MAnalyse(isb=false, delta=2) ci = c.MFlowInter(sup,ci_bv, ci_fv, time=50.0, ml=100).DuplicateFrame(0).Trim(0,c.Framecount()-1) cp = c.SelectEvery(1,-1).Trim(0,c.Framecount()-1) # chop off extra frame cn = c.SelectEvery(1,1).DuplicateFrame(c.Framecount()-1) # Make same length as source pp_fv = supPreFilt.MAnalyse(isb = false, truemotion=true,delta = 1) pp=c.MFlow(sup,pp_fv) pn_bv = supPreFilt.MAnalyse(isb = true, truemotion=true,delta = 1) pn=c.MFlow(sup,pn_bv) NickName=" # Define Command mnemonics allowed in command string and file. CI=1 # CopyFromInterpolated CP=2 # CopyFromPrevious (frame n replaced with frame n-1) CN=3 # CopyFromNext (frame n replaced with frame n+1) PP=4 # PredictFromPrevious (frame n replaced with frame predicted from frame n-1) PN=5 # PredictFromNext (frame n replaced with frame predicted from frame n+1) " Return c.ClipClop(ci,cp,cn,pp,pn,scmd=Scmd,cmd=Cmd,nickname=Nickname,show=show,dv=dv) } Avisource("D:\avs\avi\TEST.AVI") Trim(1000,-10) ++ trim(2000,-10) ++ trim(3000,-10) # Make two scene changes SCMD=" CI 5 # CopyFromInterpolated clip frame 5 CP 9 # CopyFromPrevious at last frame before scene change CN 10 # CopyFromNext at first frame of scene change CI 15 # CopyFromInterpolated clip frame 15 PP 19 # PredictFromPrevious at last frame before scene change PN 20 # PredictFromNext at first frame of scene change CI 25 # CopyFromInterpolated clip frame 25 " DoctorFrames(Scmd,show=true) Thread on fixing broken frames here:- http://forum.doom9.org/showthread.php?t=152758 EDIT:- For single frame repair only. EDIT:- Easy to mod for eg frame range denoising. EDIT:- @IanB & Gavino, Thanx for impelling the array of clips, would never have gotten here otherwise. EDIT: SCMD using mnemonics is equivalent to this (the mnemonic just an alternative means of giving clip index number) Code:
SCMD=" 1 5 # CopyFromInterpolated clip frame 5 2 9 # CopyFromPrevious at last frame before scene change 3 10 # CopyFromNext at first frame of scene change 1 15 # CopyFromInterpolated clip frame 15 4 19 # PredictFromPrevious at last frame before scene change 5 20 # PredictFromNext at first frame of scene change 1 25 # CopyFromInterpolated clip frame 25 "
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 20th August 2014 at 16:17. |
27th March 2012, 08:21 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
See Also previous post
Would anyone be interested in my extending the ClipClop Nickname's to include multiple single frame replacements from multiple consecutive clips, explaination: A Nickname including eg "CI_PAIR=22,2" and a command supplied as "CI_PAIR 100" might be used to replace frame 100 with frame 100 of clip 22 and frame 101 with frame 100 of clip 23. Likewise, Nickname of "CI5=66,5" could eg allow you to use commands like "CI5 1000" to repair 5 frames from frame 1000 but only requiring the frame number of the first frame (would require 5 replacement clips [66 - 70] for the operation). Any thoughts ? EDIT: could also be used to eg replace a pair of frames at scene change, if frame n is frame before scene change then replace n with n-1 and n+1 with n+2 (either copied or predicted). EDIT: Above suggestion implemented in v1.2 as MAGIC CLIPS.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 20th August 2014 at 16:19. |
25th May 2013, 06:21 | #18 | Link | |
Registered User
Join Date: Aug 2008
Posts: 65
|
Dear!
I love your plug-in ClipClop (http://forum.doom9.org/showthread.php?t=162266). But difficult to figure it out. So if i have an avs script like that Quote:
I need an example to understand. Thank you so much. Last edited by lintran; 25th May 2013 at 10:35. |
|
25th May 2013, 15:20 | #19 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Sorry, but best I can suggest is
Code:
LoadPlugin("VSFilterMod.dll") LoadPlugin("ffms2.dll") FFVideoSource("VIDEO.mkv", threads=1) v001= TextSubMod("A.ass").Trim(0,970).Logo("B.png",Start=50,End=920,I=12,O=12).FadeIn0(3).FadeOut0(3) v002= Trim(971,1118).Logo("B.png",Start=50,End=97,I=12,O=12).FlipHorizontal().FadeIn0(3).FadeOut0(3) v003= Trim(1119,1266).Logo("B.png",Start=50,End=97,I=12,O=12).FlipVertical().FadeIn0(3).FadeOut0(3) v004= Trim(1267,1548).Logo("B.png",Start=50,End=231,I=12,O=12).FlipHorizontal().FlipVertical().FadeIn0(3).FadeOut0(3) v005= Trim(1549,28169).Logo("B.png",Start=50,End=26570,I=12,O=12).FlipVertical().FadeIn0(3).FadeOut0(3) v006= Trim(28170,39426).Logo("B",Start=50,End=11206,I=12,O=12).FlipHorizontal().FlipVertical().FadeIn0(3).FadeOut0(3) v007= Trim(39427,120881).Logo("B",Start=50,End=81404,I=12,O=12).FlipVertical().FadeIn0(3).FadeOut0(3) v008= Trim(120882,128426).Logo("B.png",Start=50,End=7494,I=12,O=12).FlipHorizontal().FlipVertical().FadeIn0(3).FadeOut0(3) v009= Trim(128427,128617).Logo("B.png",Start=50,End=140,I=12,O=12).FadeIn0(3).FadeOut0(3) v010= Trim(128618,128768).Logo("B.png",Start=50,End=100,I=12,O=12).FlipHorizontal().FlipVertical().FadeIn0(3).FadeOut0(3) v001+v002+v003+v004+v005+v006+v007+v008+v009+v010 LanczosResize(852,480) alternate clips. Prune, might be more appropriate but each and every trim needs different manipulation and so there would be no advantage over using plain trims. Prune would be better if you had maybe 4 or 5 (or more) clips and wanted select multiple ranges from each of them and splice them together.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 25th May 2013 at 15:57. |
17th August 2014, 21:45 | #20 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
ClipClop() v1.20, see 1st post.
Code:
17/Aug/2014 - ver 1.20 - Versions 2.5 and 2.6. Added Magic. Code:
ClipClop(clip source, clip R1, ... , clip R255, string 'Cmd',string 'SCmd', bool 'Show', bool 'Ver',int 'dv', bool 'NoErr',string "Nickname",bool "Purge") ... 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. ... 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.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 31st August 2014 at 17:47. |
Tags |
remapframes editing range |
Thread Tools | Search this Thread |
Display Modes | |
|
|