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. |
8th October 2010, 01:57 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
ExBlend deblender - v1.03b2
ExBlend() By StainlessS
Unfortunately, VBulletin forum does not allow old thread title change so have opened new thread here:- https://forum.doom9.org/showthread.php?t=175948 In brief: Code:
ExBlend() v1.04 YV12, YV16, YV24, YV8, YUY2 PROGRESSIVE source. Avisynth v2.5+ (YV12 & YUY2 only for v2.58 plugin) Avisynth v2.58, avs/+ 2.60 x86 and x64 dll's. Filter for detecting pairs of blends and replacing them with un-blended frames. The filter is specific to a particular type of blending, where the source was 24 FPS Progressive, and converted to 30 FPS (eg Film to Video CD) by blending as in below:- A B C D # 24 FPS Source (6 blocks of 4 frames = 24 FPS) A B cb cd D # Blended to 30 FPS (6 blocks of 5 frames = 30 FPS) The original frame C was thrown away, leaving a repeated sequence of 3 good frames and 2 blended frames. The framerate may then have been slowed by 0.1% to 29.97 FPS for NTSC (American) color TV standards. The filter will also deal with similarly blended 25 FPS to 30 FPS video in which case the blending would be as below:- A B C D E # 25 FPS Source (5 blocks of 5 frames = 25 FPS) A B cb cd D E # Blended to 30 FPS (5 blocks of 6 frames = 30 FPS) Again, it may be slowed to 29.97 FPS. In this case there will be a repeated sequence of 4 good, 2 blended frames. The Filter locates the blended pairs, subtracts the previous frame from the 1st blended frame, it also subtracts the following frame from the 2nd blended frame and then blends both of these 'candidate' frames together to 'iron out' any noise and eg compression artifacts. This should be very close to the original frame 'C' that was thrown away as noted above.
__________________
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; 18th December 2018 at 23:47. Reason: update |
8th October 2010, 06:40 | #2 | Link |
Leader of Dual-Duality
Join Date: Aug 2010
Location: America
Posts: 134
|
this looks like it could be useful, I will take a look tomorrow
__________________
I'm Mr.Fixit and I feel good, fixin all the sources in the neighborhood My New filter is in the works, and will be out soon |
8th October 2010, 15:00 | #3 | Link |
Registered User
Join Date: Jan 2007
Posts: 729
|
I gather that your filter treats blending of actually progressive frames, am I right?
When I experienced blends (pre-1998 or so anime), they were often irregular - either starting or ending at some line mid-field (and also, the ghost picture would gradually gains/loses stregth). And yeah, they were field-blends, not frame blends, and combined with hard telecined video |
8th October 2010, 18:52 | #4 | Link |
Registered User
Join Date: Nov 2009
Posts: 110
|
Is there a way to use this to recover the original stream that is destroyed by ABC? Here in Austin, TX we receive the feed as 1080i (affiliates upconvert the 720p stream). That 29.97fps stream needs to be run through inverse telecine which leaves a 23.976fps stream with blends.
Currently, I run it through double framerate yadif and the srestore it back to 23.976. |
8th October 2010, 21:57 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This Filter is mainly intended for retrieval of old stuff.
@mandarinka, I think but am not sure, that I have seen what you describe, attributed with the name peculiar blend. Exblend will not touch such source and may be detrimental to such. Exblend is highly targeted to only one type of blending. It is NOT a fix all for everything. Of the many deblend type plugins or scripts, ExBlend is probably the most targeted of all. It deals with stuff that has gone from eg 24FPS (Progressive) to VCD (mpeg1 does not deal with anything other than progressive) and so blended field's etc dont come into it. @txporter Same again I'm afraid, old stuff really. If you have eg a Blaze Star,Betty Page or Tempest storm clip, or such, shot on film and transferred to VCD then, this is what ExBlend was made for. I mention those examples, knowing that ExBlend does exactly what is says on the tin, for (at least, for some of those examples, I have seen results on similar). I'm a big fan of DeSpot, great stuff but needs to be fed with stuff it can deal with, hence ExBlend(). It is less than likely that ExBlend can help with more modern stuff. Strictly in the realm of vintage recovery. EDIT: Having read the above, seems that 'stuff' is my new favorite word, way more genteel than my usual favorite word. As mentioned in first post, ExBlend comes with EXPERIMENTOR2.AVS which allows you to play with the filter and familiarize yourself with it. It synthesizes the type of blending that it deals with and then fixes it. It would therefore also allow you to see what that type of blending looks like. This AVS, produces a 4 window display with the blended clip, a metrics clip, the deblended result and an amplified difference between the result and the IDEAL result (which it also synthesizes). A further supplied AVS, (MAKEBLEND.AVS) just synthesizes a blended clip so you can save it, compress it and then fix using the also supplied FIXBLEND.AVS script. FIXBLEND also allows you to play with some of the args that are not useful in EXPERIMENTOR.AVS, EXPERIMENTOR.AVS will almost certainly result in a 100% success rate, because it deals with clean and uncompressed video. The MAKEBLEND/FIXBLEND scripts make for a more realistic scenario, and will without much fiddling with settings produce in the region of about 97% success rate (typically srestore would return about 82% for similar source). FIXBLEND.AVS also allows use of the newly extended (1.02b) manual override commands which can produce 100% success if you are prepared to spend a little time creating a command text file. The reality is though that in most cases any blends that slip though are in static scenes and are not terribly important (two identical frames blended together look blended neither to the viewer nor Exblend).
__________________
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; 9th October 2010 at 19:20. |
10th December 2010, 17:06 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This was posted in reply to another thread and should I think be
appended here also:- Think I made a big mistake there in the description for ExBlend(). Now believe that what ExBlend fixes is 3:2 pulldown that has been blend deinterlaced and then vertically downsized to half height. The results are indistinguishable from perfectly blended frames as described for ExBlend(). ExBlend will not touch 3:2 pulldown blend deinterlaced that has NOT been downsized. I had a clip that someone wanted cleaned up, I mistakenly assumed that it used the ExBlend() description of blended frames and knocked up a script to fix that problem. I then found that the clip kept going out of sequence and needed some kind of detector. I was not at the time a regular visitor to Doom9, and only ever sought filters etc from WarpEnterprises. Not finding a filter to fix the problem, I eventually dug out a compiler and ExBlend is the result. This was my first coding (not counting a little bit of VB) in about 14 or 15 years, but it does exactly what I wanted from it and even surpassed my expectations. I later found a script in the old downloadable Avisynth site that turned out to be almost identical to the script I had done. Searching the site I found a link to that particular script that had the name of the author in it, it was ActionMan133. In Actionman133's writeup, he also made the blended frames assumption that I had done and so this reinforced my theory as to the cause. Have recently seen a thread on-site where he obviously re-assessed and came to the 3:2 blend deinterlaced, resize, opinion. I dont really have much NTSC footage myself (thank goodness) and have not really had that many samples to try ExBlend on but those that I have had, ExBlend performed brilliantly. I think that for non downsized stuff, the only way to go is probably srestore script, srestore (I think) detects using AverageLuma (or perhaps YDifferenceFromPrevious or whatever its called) whereas the ExBlend filter actually does a sort of test deblend to detect. This allows srestore to detect the 'almost blends' produced by blend deinterlacing but requires a certain amount of clean up of the produced frames. As Exblend detects what looks like perfectly blended frames, the results do not really require any extra clean up and in many cases the resulting deblended frames look cleaner than those on either side. I have been toying with the idea (but not tried it out yet) that vertically downsizing by half, a 3:2 pulldown clip with blend deinterlacing, only for the detection in ExBlend mode=1, and then doing the second pass (mode=2) at full size, this would though not produce clean output as they were not true blended frames, perhaps I could do some kind of cleaning, I think that it could potentially be faster than srestore but of course the cleaning would add extra cost in time. EDIT: See FixBlendIVTC rather than sRestore.
__________________
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; 17th February 2012 at 05:17. |
12th December 2010, 06:43 | #7 | Link |
Huh?
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
|
Interesting....gonna try this on Disney's crappy DVD release of the 1992 X-Men series.
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it. |
13th December 2010, 21:42 | #8 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
at a higher resolution and then downsized, try plain use ExBlend, if it after a minute or two that the 'R' (ratio) flag is set (show>1) then it is not detecting it, try the downsize thing. Good luck and give us a report, thanks. EDIT:- have dismissed all thoughts about the downsize thing, not a good idea.
__________________
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 April 2011 at 17:44. |
|
27th April 2011, 17:54 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
A few observations I have made recently.
I had a sort of junk area of my hard drive where I had accumulated several GB of short demo type clips, over about 3 or 4 years, mostly internet samples in various containers, eg MPG, AVI WMV, & FLV. I decided that I wanted them off my hard drive and so I eventually viewed and dumped or recoded them as x264, for eventual archival on DVD. In the process of doing this, I found about 40 or 50 NTSC clips that looked like good candidates for Exblend() recovery. Every Candidate that was identified, was recovered, well. The least best recovery rate was in the region of 94%+, recovered frames from the original pair of blends. This leads me to believe that Exblend() is not as previously told, limited to recovery from VCD clips. The clips recovered varied in dimension, but all vertically less that 480 (and nearly all of them 29.97 FPS, one or two were 30FPS). I dont have much in the way of NTSC stuff, so am limited in ability to do much test on that material. However, much of the "sludge", above that I had acquired, proved to be good test material. I guess the main problem is identifying suitable material, so here is a short description of the blends and how to identify them. Imagine a clip where the original source clip was of a single telegraph pole, displaced laterally, due to the vid being taken from vantage point of a travelling car. The frame before the blend pair would be a single pole, the first blend would be a blend of the first pole, plus a second pole. The second blend would be a blend of the second pole and the third pole, and the frame after the blend pair would be the third pole alone. (These poles are obviously the same pole, only the position changed). Not very technical I know, but what I usually do is place my thumb nail against the first lone telegraph pole, move to the 1st blend pair, identify that one of the 1st blended poles coincides with the first one, move my thumb nail to the second blended pole in the 1st blend and then move on to the second blend pair, if same, then move thumb nail to the other blend in the second blend pair, and move on to the frame following the second blend, and compare again. Basically, the blend pair should contain a common "telegraph pole" not appearing either before or after the blend pair. It is this "telegraph pole", that Exblend() recovers. Exblend(), should only be used on PROGRESSIVE material, anything exhibiting combing should be avoided. ExBlend() uses the average of vertical pairs of pixels to reduce the effects of noise in the blend detector. I am reluctant to remove this averaging (and so make it less effective) and also dont want to add in an extra combing detector which would reduce the speed of ExBlend. If fed source containing combing, ExBlend() may seem to be working ok (according to metrics) but this would be false, it would be interpreting the vertical averaging of combing as blends. It is therefore very important that the user is aware that combing, is to be avoided. Do NOT use Exblend() on DirectShowSource(). Directshow decoders (especially mpg) can do eg deinterlacing or inverse 3:2 pulldown, could be that any blending you are seeing in your player is actually created by directshow, and does not exist in the actual file. Any attempt to reverse Directshow created blending would be better dealt with by other means. If a Directshow decoder does inverse 3:2 pulldown, it will take a few frames to get into sync and as ExBlend() requests 7 frames for every target frame, this will send any directShow decoder doing Inverse 3:2 pulldown into fits, and produce all kinds of jumps and jerks, decoder "massaging" is not a good idea before ExBlend(). If you cannot use anything other than DirectShowSource for you source clip, I suggest converting to an AVI, I habitually use ffmpeg for this. for eg a WMV to AVI conversions (with ffmpeg somewhere in you path [or on the same directory as your command and source file]) CONTENTS OF I_WMV_to_AVI.CMD --------------------- ffmpeg -i i.WMV -vcodec huffyuv -acodec pcm_s16le D:\AVS\IN\i.wmv.avi Pause --------------------- The source clips should be named I.WMV and of course the destination file above is "D:\AVS\IN\i.wmv.avi" Also, the "Show" modes of ExBlend(), I only really use either mode 0 (off, during second pass) or 5, other modes are really intended for me during testing, if an "R" in orange flag is displayed (at the end), then the clip is not ExBlend() material, if the clip shows less than about 90% recovery, then I would think that it is not quite right. In most cases ExBlend() should exhibit a recovery rate of above 95% although 94% is probably Ok, I have not witnessed any recovery rate less than about 94% in ExBlend() (with suitable source). If you need further experience of the type of blend that Exblend() will recover, try the ExBlend() EXPERIMENTOR.AVS which will simulate the blending, so you can recognise it (and try the 'thumbnail' thing). Lastly, would be nice if someone (anyone) could say if they found Exblend() of use, up to now there has be zero +ve feedback and I'm just a little unsure if I am the only one who can use it (in which case I am at fault for not documenting well). If it is of zero use, then perhaps it should be withdrawn, or would not at all warrent further development, (or at least further publication).
__________________
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 ??? |
4th February 2012, 03:35 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Am (reasonably) close to releasing an ExBlend update, there follows an un-prepared publication,
just what Ive got presently, twill follow shortly. The new release, when released, will expose some of the inner workings of Exblend() and give cause to those better equipt to dealing with masks etc, to write scripts that can better deal with blending. (hang on, just gotta getta another can out the fridge). Sorry bout that. There is nothing here plugin wise, just a quickref that I'm knocking up as I work, and I thought I would give it up for comment, still by no means complete, but if you would like any input, now might be a good time. So the meanderings as they are right now, follow. here's what I've got so far: EDIT:- Text Removed, see next 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; 16th February 2012 at 15:41. |
16th February 2012, 15:46 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
New Version - ExBlend() v1.03b 15/Feb 2012
A Quickref from new version:- Code:
EVERYTHING HERE OVERRULES OLD DOCS (See old docs Also) ExBlend() v1.03b+ QuickRef YV12, YUY2, PROGRESSIVE Only. Quick OverView, ExBlend() is a plugin to repair damage caused by blend Deinterlacing of telecined clips, which results in a double blend, every five frames, GGGBBGGGBBGGGBB etc where 'G' is good and 'B' is blend. Also used for telecined clips that were downsized from 720x480 to VCD 352x240 which look similar to the above mentioned damage. Exblend(Clip,int "mode",int "pal",float "lockthresh",float "ithresh",int "show",string "ExBfile",bool "ver",bool "revip", string "override",int "lv",int "dv",int "disp",clip "Dclip",int "CompUB",bool "Decimate",int "DecompIx",int "DecClpIx",bool "Debug") Mode 0: Free Running Mode (Deprecated) -------------------------------------------------------------- Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int -1 1 0 PAL = -1, ONLY allowed HERE in MODE 0 LockThresh float 0.0 100.0 1.0 default rarely needs change. IThresh float 0.0 100.0 3.0 default rarely needs change. Show int 0 5 5 Metrics (0=OFF,5=FULL, either of these two most usual) Exbfile string - - "ExBlend" Project: (logging Only), 'exbfile'.XBD Not created. Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Reverse Metrics Direction when show > 1 Override string - - - IGNORED (MODE 1 ONLY) Lv int 0 5 0 Logfile: 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG Dv int 0 5 0 DebugView: 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG Disp int 0 3 1 Display mode, 0=BLENDED(original), 1=EXBLEND, 2= SRESTORE, 3=COMPONENT, (4=ADJACENT Invalid) DClip clip - - UNSET Denoised Detection Clip, Same colorspace & dimensions as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool - - - IGNORED Decompix int 1 2 1 IGNORED (MODE 2 decimated ONLY) DecClpIx int <0 255 1 IGNORED (MODE 1 ONLY) Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5) Mode 1: (ExBlend v1.03+ Scan & Store Data, default, Need to do this before using MODE==2) ------------------ Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int 0 1 0 PAL -1 Not Allowed (Error) LockThresh float 0.0 100.0 1.0 default rarely needs change. IThresh float 0.0 100.0 3.0 default rarely needs change. Show int 0 5 5 Metrics (0=OFF,5=FULL) Exbfile string - - "ExBlend" Project: logs,'Exbfile'.XBD & Decimated (Mode 2) Frames Cmd file. Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Reverse Metrics Direction when show > 1 Override string - - "" Input Override Command file Lv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (logfile) Dv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (DebugView) Disp int 0 3 1 Display mode, 0=BLENDED(original), 1=EXBLEND, 2= SRESTORE, 3=COMPONENT, (4=ADJACENT Invalid) DClip clip - - UNSET Denoised Detection Clip, Same colorspace & dimensions as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool - - - IGNORED (MODE 2 ONLY) Decompix int 1 2 1 IGNORED (MODE 2 decimated ONLY) DecClpIx int <0 255 1 Clip index used in eg Exblend_Decimated.Txt, <0 == NONE. Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5) Mode 2: (Final Output mode, needs MODE 1 pass 1st.) ------------------------------------------------------------- Arg Type Min Max Default Comment clip clip clip clip NONE YV12 & YUY2 PROGRESSIVE Pal int - - - Ignored, Set from 'Exbfile'.XBD LockThresh float - - - Ignored, Set from 'Exbfile'.XBD IThresh float - - - Ignored, Set from 'Exbfile'.XBD Show int 0 5 0 Metrics (NON-DECIMATED:0=OFF,5=FULL | DECIMATED:0=OFF,>0 ON) [DEFAULT different to modes 0 & 1] Exbfile string - - "ExBlend" Project: (logging, Inputs Project Mode 1 XBD file) Ver bool False True False ALL ARGS IGNORED if true Revip bool False True False Not used when Decimate (Metrics are different).) Override string - - - IGNORED, Set in Mode 1 Lv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (logfile) Dv int 0 5 0 0=Off, 1=ERR, 2=WARN,3=INFO,4=VERBOSE,5=DEBUG (DebugView) Disp int 0 4 1 If Decimate, 0_BLENDED, 1_EXBLEND, 3_COMPONENT & 4_ADJACENT valid (2_SRESTORE converted to EXBLEND) DClip clip - - UNSET Usually as Mode 1 (or NONE), Same colorspace as Clip. CompUB int 0 2 2 Component Unblend Mode for DISP display mode Decimate bool false True True Decompix int 1 2 1 Decimated Component Index. Valid if DECIMATE & disp=0_BLENDED/3_COMPONENT/3_ADJACENT else Ignored. DecClpIx int <0 255 1 IGNORED (MODE 1 ONLY) Debug bool false True False Switch On: ERRORS, WARNINGS and DEBUG logging (ie 1,2 and 5)
__________________
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 ??? |
16th February 2012, 15:48 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
And as the post limit is 16000 chars, here is part 2.
Code:
To use ExBlend(), you need to do a scan of the clip first using eg: ExBlend(clip, Mode=1) # AssumeFPS(250.0) or ExBlend(clip, Mode=1,dclip=DCLIP) # AssumeFPS(250.0) Where DCLIP is a denoised detection clip if required. Scan through the file and it will create an ExBlend.XBD file for Mode 2 as in below example. ExblendedClip=ExBlend(clip, Mode=2,dclip=DCLIP) DISP: (Display Mode) Controls which frames are returned instead of Blended Frames, using CompUB & Decompix as additional controls. Non-Blended frames will ALWAYS return frames from source clip. Where 'S' is Source Clip Frame, 'D' is DCLIP Detection clip frame (if supplied Else 'S') In 'mode' 0, 1, & 2 (mode 2 when Decimate == False): 0 DISP_BLENDED If (CompUB !=0), Returns blended frame from D, else blended frame from S. 1 DISP_EXBLEND Blended frames are unblended as for CompUB. 2 DISP_SRESTORE 1st Blended frame is unblended as for CompUB, 2nd replaced with frame after 2nd blend. 3 DISP_COMPONENT Blended frames replaced with COMPONENT frame as for CompUB. In 'mode' 2 with Decimate==True: (only DISP 0, 1,3 and 4 valid) 0 DISP_BLENDED If (CompUB !=0), Returns BLENDED frame from D, else blended frame from S, further control via Decompix to select 1st or 2nd blend frame of blend pair. You might want to set CompUB to 0 here to return the original blended source frame and not from the DClip. 1 DISP_EXBLEND Blended frames are unblended as for CompUB (Same as NOT Decimated). 3 DISP_COMPONENT Returns COMPONENT frame as for CompUB, Decompix==1 = 1st Component frame, 2 =2nd. 4 DISP_ADJACENT Returns source frame 'S' adjacent to Decompix blend index. CompUB: (Component Unblend Mode) Unblend-ing is achieved in two stages, firstly, two component frames are recoverd, and then the average of these two components is used to finally recover the unblended frame. Each of the component frames is unblended using a blended frame and also the good frame adjacent to the blended frame. CompUB controls which clips are used in reconstruction of the component frames where both Source clip and Dclip are provided. If no Dclip is supplied then the source clip is always used (Obviously). CompUB ranges from 0 to 2, where, (below assumes a Dclip) 0 = No frames of Dclip, both blended And blend adjacent frames comes from source clip. 1 = One Frame comes from Dclip ie the blended frame. The adjacent frame comes from source clip. 2 = Both blended and adjacent frames come from Dclip (Default [experimental, may change]). An easy way of remembering it is as the number of Dclip frames used in the reconstruction of the Component frames. (Info:- The Blend detector always uses the Dclip if supplied ie "DDDD"). 0 == "SSSS", 1 == "SDDS", 2 == "DDDD", where the two middle letters are the blends and outer are adjacent. Decompix: (Decimated Component Index) When Decimate is true, (MODE 2 only) the only valid DISP Display modes are 0_DISP_BLENDED, 1_DISP_EXBLEND, 3_DISP_COMPONENT and DISP_ADJACENT (only valid in mode==2 and when Decimate==true). 0_DISP_BLENDED, using both CompUB and Decompix, you can pull out the blended frame from either blend index 1 or 2, and from either the source clip (most usual) or the Dclip if required, using the CompUB arg. Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. 1 DISP_EXBLEND is the usual disp mode and returns a fully unblended frame for each pair of blends. 3 DISP_COMPONENT, returns the component frame for either blend index 1 or blend index 2 (1st or 2nd blend), Decompix specifies which of the 2 blend component frames are returned. Can be used to 'pull out' component frames (1 & 2) from a decimated clip for alternative processing. eg, you could do some kind of denoising on the component frames before blending them together yourself with eg Merge(). You could then replace your denoised and merged frames back into the decimated clip, using eg ClipClop() plugin. ExBlend() does no denoising itself. 4 DISP_ADJACENT, returns the source 'S' frame adjacent to the Decompix blend index frame. Might be useful to anyone wanting to do their own advanced un-blending in script, using ExBlend() only as the detector. ExbFile: (ExBlend Project File, [default "ExBlend"], Changed function a little in v1.03) The Exbfile project name is used to create log file names (eg "ExBlend_1.LOG", where '_1' represents the active MODE at the time). In MODE 1 only, it is also used to create eg an "ExBlend.XBD" file which totally replaces any detection stage in MODE 2 and all of the info required to Decimate in Mode 2 is contained in the XBD file. Mode 1, also creates an eg "ExBlend_Decimated.TXT", which is a command file for use in a range/frame replacement plugin. [eg ClipClop()], This "ExBlend_Decimated.TXT" is a file containing frame numbers that can be used to select MODE 2 decimated output blend recovered frames. In Mode 2, you can choose to not Decimate, in which case it would be as previous versions of ExBlend and require later Decimation using your favorite Decimator. Or, you can Decimate if you choose, you can process the Decimated output of ExBlend 1_DISP_EXBLEND using your favorite Motion Compensated denoiser, and feed the original ExBlend output and the denoised output into ClipClop, using the ExBlend_Decimated.TXT command file to replace the ExBlend recovered un-blended frames with the denoised ones, and NOT requiring yet another pass. Pass 1 to generate the XBD and decimated frames file and Pass 2 to unblend, decimate, motion compensated denoise and replace back into the ExBlended clip again. DecClpIx: (Decimated Clip Index, MODE 1 Only) This setting (-ve to 255 [default 1]), sets the clip index used in the MODE==1 creation of (default) "ExBlend_Decimated.Txt" file. This command file is a command file intended for the ClipClop() frame replacement plugin. For ClipClop(), the format would be like so:- "1 666" Where '1' is the clip index number for the replacement clip, and '666' is the frame to replace. This could be used like this, FixedClip = ClipClop(ExblendedClip,DenoisedExblendedClip,CMD="ExBlend_Decimated.Txt") In the above, 'ExblendedClip' would be clip 0, and 'DenoisedExblendedClip' clip 1, it would replace the cleaned up frames back into the deblended clip after eg post Exblend recovery denoising (eg MCDegrain). You could also use the Prune() plugin to view ONLY the unblended Denoised frames, Prune requires clip index's starting at 0 BUT, the below should work OK. FixedFramesOnlyClip = Prune(FixedClip,FixedClip,CMD="ExBlend_Decimated.Txt") OR FixedFramesOnlyClip = Prune(DenoisedExblendedClip,DenoisedExblendedClip,CMD="ExBlend_Decimated.Txt") without putting them back into the ExblendedClip clip first. As Prune()'s clips index starts at zero, we used the input clip name twice so we can use clip 1 (2nd FixedClip) to match the command file. To view just the ExBlended frames (without denoise) eg: Prune(ExblendedClip,ExblendedClip,CMD="ExBlend_Decimated.Txt") To extract the two component clips recovered frames only, and view them side by side COMPUB=2 # you choose C1=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=1) C2=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=2) C1_2=(Prune(C1,C1,CMD="ExBlend_Decimated.Txt") C2_2=(Prune(C2,C2,CMD="ExBlend_Decimated.Txt") StackHorizontal(C1_2,C2_2) To extract the two component recovered frames, denoise them, merge together put back into ExBlended decimated clip. COMPUB=2 # you choose C1=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=1).MCDegrain(3) C2=ExBlend(clip,Mode=2,disp=3,CompUB=COMPUB,Decompix=2).MCDegrain(3) #Return StackHorizontal(C1,C2) Combine = Merge(C1,C2) # Repaired. Average of the two denoised component frame clips. FixedClip=ClipClop(C1,Combine,CMD="ExBlend_Decimated.Txt") Above C1 is mistake, C1 is denoised, need a non-denoised intermediary clip instead. As an alternative to using double clip names in Prune, you can change the default clip index in the "ExBlend_Decimated.Txt" (Decimated Frames file) so that Prune or some other alternative could be used with another clip index, a -ve "DecClpIx" will miss out the clip index altogether, but you would then have to use another frame replacement plugin alternative to ClipCLop() (Whose index needs to be 1). Together, Disp, Decimate, CompUB, Decompix, and eg ExBlend_Decimated.Txt allows ExBlend() to expose both of the component frames (Decompix) fashioned with the desired CompUB method, after eg Motion compensated processing, merged together to create the finally recovered frame, this result would then be fed back into either one of the two ExBlend unblended component clips via ClipClop() and the ExBlend_Decimated.Txt command file. Advanced scriptors may wish to extract the clips containing the blended frames and adjacent frames for both blend index 1 and blend index 2 and do some clever masking and such to recover the unblended frames themselves.
__________________
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 February 2012 at 13:17. |
16th February 2012, 16:01 | #13 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here from an example clip courtesy of JohnMeyer from his thread here:-
http://forum.doom9.org/showthread.php?t=162599 The clip in question is 3:2 pulldown that has been resized as if progressive. Pic1 is the original, 2nd is a Blur(0,1) used as a Dectection clip, 3rd pic is ExBlend() output, and pic 4 is McDegrained ExBlend output. ExBlend now outputs a command file for ClipClop() frame/range replacement plugin so that you can use eg McDegrain on the clip and then pluck out the recovered frames and put them back into the original clip again. ExBlend also implements now native decimation, so that step is no longer necessary. In addition, ExBlend, exposes some of it's inner working so that an advanced scriptor could perhaps do some real clever deblending that is beyond ExBlend. There follows a script that actually does the deblending itself, and the McDegrained output of it is indistinguishable from the McDregrained ExBlend output. There is a little redundancy in the script but I'll give it as supplied in the new version zip. Code:
# ########################################################################## # Unblend frames in script, use ExBlend() only for detection and decimation. # Raw frames extracted from source/Dclip and unblended via script, # then put back into decimated clip. # # Requires mt_MaskTools, MCDegrain, ClipClop() & Prune() # # ########################################################################## Import("MCDegrain.avs") AVISource("problem video.avi") Crop(2,0,-2,-0) # VDUB DONT Like 636 width) DCLIP=Blur(0.0,1.0) # Required as bad combing due to resize on Telecine clip. #Return Exblend(mode=1,CompUB=2,Dclip=DCLIP) # 1st Pass to create ExBlend.XBD ADJACENT=4 BLENDED=0 # ORG=Exblend(mode=2,disp=0,CompUB=0,dclip=DCLIP) # Original combed Clip, Decimated EXB=ClipClop(ORG,ExBlend(mode=2,CompUB=2,dclip=DCLIP).MCDegrain(3),CMD="ExBlend_Decimated.Txt") # ExBlend clip with denoising # Above, Decimate=true, is default in Mode 2. # Decimated clip with Frames Adjacent to Blend index 1 (from Dclip, [CompUB==2]) A1=Exblend(mode=2,disp=ADJACENT,Decimate=true,CompUB=2,dclip=DCLIP,Decompix=1) # Decimated clip with Frames Blend index 1 (from Dclip, [CompUB==2]) IX1=Exblend(mode=2,disp=BLENDED,Decimate=true,CompUB=2,dclip=DCLIP,Decompix=1) # Decimated clip with Frames Blend index 2 (from Dclip, [CompUB==2]) IX2=Exblend(mode=2,disp=BLENDED,Decimate=true,CompUB=2,dclip=DCLIP,Decompix=2) # Decimated clip with Frames Adjacent to Blend index 2 (from Dclip, [CompUB==2]) A2=Exblend(mode=2,disp=ADJACENT,Decimate=true,CompUB=2,dclip=DCLIP,Decompix=2) ########################################################################### # To recover a blend component frame, we use: # (IX * 2) - A, ie ((blended_frame * 2) - Adjacent_frame) # # For Chroma, # (((IX - 128) * 2) - (A - 128)) + 128 # IX*2 - (128 *2) - A + 128 + 128 # IX*2 - A - (128 *2) + 128 + 128 # IX*2 - A (ie same as for Luma). ########################################################################### #Below 2 ClipClops NOT NECESSARY, X & Y same frame in non blended frames, however, including the # ClipClop's, will be faster as non blended frames taken from A1 instead of mt_lutxy() output. # As mt_lutxy affects all frames we recover the good non-blended frames from any decimated clip (A1), using ClipClop. # 1st component unblended frames, (IX1 * 2) - A1 Component1=ClipClop(A1,mt_lutxy(IX1,A1,"x 2 * y -",Y=3, U=3, V=3),"ExBlend_Decimated.Txt") # 2nd component unblended frames, (IX2 * 2) - A2 Component2=ClipClop(A1,mt_lutxy(IX2,A2,"x 2 * y -",Y=3, U=3, V=3),"ExBlend_Decimated.Txt") ########################################################################### # Optional Denoise Component clips (Recovering from A1 again as McDegrain changes good frames too) #Component1=ClipClop(A1,Component1.McDegrain(3),CMD="ExBlend_Decimated.Txt") # Can comment out #Component2=ClipClop(A1,Component2.McDegrain(3),CMD="ExBlend_Decimated.Txt") # Can comment out # Blend both component frames together to 'iron out' noise, [Should NOT alter good frames (same frame) ie (Z + Z) / 2 = Z]. Fixed = Merge(Component1,Component2) # (C1 + C2) / 2 ########################################################################### # Optional Denoise completely recovered clip. (Restore good frames again). Fixed=ClipClop(A1,Fixed.McDegrain(3),CMD="ExBlend_Decimated.Txt") # Can Comment out FixedFramesOnly = Prune(Fixed ,Fixed ,CMD="ExBlend_Decimated.Txt") ########################################################################### #Return FixedFramesOnly #Return Fixed D=ClipDelta(EXB,Fixed) TOP=Stackhorizontal(ORG,fixed) BOT=Stackhorizontal(EXB,D) return Stackvertical(TOP,BOT) ###################################### # ORIGINAL CLIP | SCRIPT UNBLEND # # ---------------------------------- # # EXBLEND DENOISE | Diff EXB-SCRIPT # ###################################### Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") { # Return Clip Difference of input clips (amp==true = Amplified, show==true = show background) amp=Default(amp,false) show=Default(show,false) c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale() c1=clip1.subtract(clip2) c1=(amp)?c1.levels(127,1.0,129,0,255):c1 return (show)?c1.Merge(c2):c1 } of the output, the above code affects (blur) only the de-blended ones and MCDegrain would have the effect of sharpening those up again [I think]) See new version, on MediaFire via Sig EDIT:- See also 2 previous posts (exceeded D9 limit post limit). EDIT: Below links might be useful. "Problem Video.AVI" (link already included with ExBlend, or get from John's Thread.) http://www.mediafire.com/?5vaci1oepo3kjb1 ClipClop Plugin. http://forum.doom9.org/showthread.php?t=162266 Prune Plugin: http://forum.doom9.org/showthread.php?t=162446
__________________
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; 14th December 2018 at 15:40. |
6th January 2013, 20:03 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
New version ExBlend() v1.03b2, Fixed "decimation=false" output frame rate bug.
See Mediafire in sig. EDIT: The above expanation is as clear as mud, dont know how better to do it though.
__________________
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; 8th January 2013 at 07:55. |
2nd January 2014, 21:16 | #15 | Link |
Registered User
Join Date: Sep 2005
Location: Vancouver
Posts: 600
|
This is a very slick filter. It's criminal that this doesn't have more responses!
On my system, the default location for writing "Exbfile" is the Plugin's dir rather than the script dir. This is a problem because it gets written to the VirtualStore and then isn't read back when set to mode=2. (My plugin is located in %PROGRAMFILES(x86)%\AviSynth 2.5\plugins\) You may want to note in the doc that you can get a much faster Mode 1 scan by setting show=0. Mine went from 230-260 fps to 600-700 fps. |
16th August 2014, 10:02 | #16 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
StainlessS, I'm trying your ExBlend filter, but I can't make it work.
I have a clip at 30fps with 4NormalFrames and 2FrameBlended, so the original should be a PAL 25fps. I load this script in VD, play it a little, then close it, but I can't find any written file in C: (I use W7 64bit). Code:
LoadPlugin("Z:\ExBlend\ExBlend.dll") #different dir from Avisynth plugins FFmpegSource2("myfile.mp4") Global PAL = 1 # The original frame rate PRIOR to blended frame rate conversion # 0 = 24 FPS FILM or 23.976 FPS (3 good 2 BAD), 1 = 25 FPS PAL (4 Good 2 BAD), -1 = AUTO PAL Detect Global ITHRESH = 3.0 # Just so we use same ithresh for UNBLENDED & METRICS (default 3.0) Global LOCKTHRESH = 1.0 # Experimental lock, 0.0 Off, suggest about 1.0 Global VER=false # Shows version info SetupExblend(1) # Experiment with PAL THRESH and ITHRESH Settings for ExBlend(), and create DATA FILE in C:\ return Last Function SetupExBlend(Clip Last, Int Mode){ UNBLENDED = Exblend(Last,Mode=Mode,pal=PAL,lockthresh=LOCKTHRESH,ithresh=ITHRESH,Show=0) # Fixed Clip METRICS = Exblend(Last,Mode=Mode,pal=PAL,lockthresh=LOCKTHRESH,ithresh=ITHRESH,Show=5,ver=VER) # Just to show Metrics # Make Windowed display clip LEFTCLIP =StackVertical(Last,UNBLENDED) RIGHTCLIP=StackVertical(METRICS,Diff(Last,UNBLENDED)) StackHorizontal(LEFTCLIP,RIGHTCLIP) # Glue them together # last=METRICS assumefps(250.0) # For quick scanning using VirtualDubMod return Last } EDIT: I searched in all HDs (both C and the others) this: exbfile* with no result Last edited by franketto; 16th August 2014 at 10:10. |
17th August 2014, 17:14 | #17 | Link | |
Registered User
Join Date: May 2014
Posts: 74
|
I found it, the error was:
Quote:
If not, the filter outputs in the console (like DebugView), ie: "ExBlend:- BUFFER INCOMPLETE (5.0)", but normally nobody opens a console to see error messages... It should be better to note this in the docs. If you want to test the filter on partial file you must use trim(). Could reducing the original res (only in progressive clips) be another trick to speed up the mode=1? After that in mode=2 restore the original res. Or this can affect negatively the xbd file? |
|
17th August 2014, 17:51 | #18 | Link |
Registered User
Join Date: Sep 2005
Location: Vancouver
Posts: 600
|
Instead of hitting Play, it makes more sense to use Run video analysis pass anyway since then you get the full FPS your CPU is capable of generating rather than having to guess with AssumeFPS. AvsPmod also has an analysis pass option.
|
17th August 2014, 22:41 | #19 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Yep, video analysis pass probably best (fastest) in Vdub current, however I mostly use VDubMod which does not have that analysis mode,
also, VD video analysis pass jumps back to frame 0 at conclusion, and I like to see the metrics on last frame.
__________________
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 2014, 13:11 | #20 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
Something doesn't work with the previous code:
Img larger: http://i.imgur.com/sLK9MDw.png testfile: https://www.sendspace.com/file/z8474n Last edited by franketto; 18th August 2014 at 13:17. |
Tags |
deblend, film restoration, removeblend, unblend |
Thread Tools | Search this Thread |
Display Modes | |
|
|