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. |
12th June 2013, 13:46 | #1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
RoboCrop, v1.13 - 07 Feb 2020
RoboCrop v1.13, v2.58, avs/+ v2.60, x86 and x64 dll's.
Requires VS2008 CPP Runtimes. V1.13 Docs overflow 16kb limit, so left at v1.0 docs below. See post #37 for v1.13 Docs over two posts. Here: http://forum.doom9.org/showthread.ph...03#post1696703 Code:
RoboCrop() To Protect And Serve - by StainlessS @ Doom9:- http://forum.doom9.org/showthread.php?t=168053 VIDEO: Planar, YUY2, RGB. AUDIO: No change. Plugin's for both Avisynth v2.5 and v2.6. RoboCrop is an automatic cropping solution to crop black borders from video clips, loosely based on (but using no code from) Autocrop by Glenn Bussell. For the most part, you can just call it with RoboCrop(clip) and not bother with any other arguements, it is intended to be pretty much autonomous in its decisions. You might however want to alter eg WMod and HMod if your encoder has special requirements, and perhaps Laced if your source is likely to be fully progressive. Borders are detected by sampling at Samples frames, at scanlines (h/v) using AverageLuma (RGB is converted to Luma Y at either TV or PC levels, See Matrix). This sampling is done on all 4 sides of the frame. If a scanline Average luma is below or equal to Thresh, then is considered possible black border, above considered possible image, if Baffle [default=4] adjacent scanlines above Thresh, then it IS image. Function RoboCrop(clip c,int "Samples"=32,Float "Thresh"=-32,bool "Laced"=true,int "WMod",int "HMod",int "RLBT"=15,bool "Debug"=false, \ float "Ignore"=0.2,int "Matrix"=(c.width<=720?2:3), int "Baffle"=4, bool "ScaleAutoThreshRGB"=true,bool "ScaleAutoThreshYUV"=false, \ int "CropMode"=2,bool "Blank"=false,bool "BlankPC"=false,bool "Align"=false,bool "Show"=false,String "LogFn"="",bool "LogAppend"=false, \ Float "ATM"=4.0) Args:- Samples=32, Number of frames to sample from source clip c. As an observation, most clips have good border recogition within the 1st 2 sampled frames using the default -32.0 AUTOTHRESH although have noticed some dark clips that required ~8 samples (maybe more) for full recognition @ default Thresh = -32.0 We use a default Samples=32, because we are intrinsically paranoid. If clip more than 250 frames, will ignore the first 5% and last 10% of frames when both auto-thresholding and crop sampling to try to negate effects of artificial black in titles and end credits. (Even without this feature, it always skips beginning and end where possible like this "00100100100" where 1 represents sampled frames when sampling 3 frames from 11). Thresh: Default= -32.0 (==DEFAULT AUTOTHRESH, any -ve Thresh is AUTOTHRESH where Thresh adjustments are automatic). Thresh > 0: (Explicit Threshold) A user supplied +ve Thresh should be at correct TV/PC levels for the the clip being worked on ie 16->235 for TV levels and 0->255 for PC Levels (RGB, as appropriate for matrix being used). Thresh <= 0: (AUTOTHRESH) When Thresh <= 0, the clip will be sampled over Samples frames to find the minimum YPlaneMin (using Matrix if RGB) which we will call MINLUMA and an Explicit Threshold calculated by adding MINLUMA to abs(Thresh), after that it is processed as for Thresh > 0: (Explicit Threshold) as noted above, but, before adding MINLUMA, some AUTOTHRESH massaging occurs. Here AUTOTHRESH Thresh massaging occurs in sequence:- 1 ) if (Thresh == DEFAULT AUTOTHRESH && ATM < 32.0) (DEFAULT AUTOTHRESH = -32.0, defaulted OR user supplied): Let FrameRange = FrameEnd-FrameStart+1 (after skipping titles and end Credits, also Samples limited to FrameRange). Samples_massage = (Samples>=16) ? 1.0 : (Samples-1) * (1.0/(16-1)) Range_massage =(Float(frmend-frmstart+1)/samples >= 250) ? 1.0 :(Float(frmend-frmstart)/samples * (1.0/(250-1))) Thresh = -(((Samples_massage * Range_massage) * (32.0 -ATM)) + ATM) The adjustment to Auto Thresh is to reduce the possibility of overcropping on eg a dark low 'Samples' clip, or where source FrameRange (ie temporal frame set) is too small to take a reliable sample from. Resulting massaged Thresh will range between -ATM and -32.0. Although massaging is intended to reduce overcropping, it could result in not cropping enough border (less disastrous), its a bit of a balancing act really. See also ATM. 2 ) If RGB AND PC matrix(default) AND ScaleAutoThreshRGB==True(default) then Thresh= Thresh*(255.0/(235-16)) 3 ) If YUV AND ScaleAutoThreshYUV==True(default=false) then Thresh= Thresh*(255.0/(235-16)) Steps 2) and 3) above, by default treat a -ve AUTOTHRESH as being @ TV Levels and so Scale RGB Thresh to PC levels but not YUV. If you want to supply a PC levels AUTOTHRESH Thresh for RGB, then simply set ScaleAutoThreshRGB=false to inhibit scaling. Note, if a TV levels Matrix is supplied for RGB, then scaling will always be inhibited. If your clip is YUV at PC levels and you want to use eg DEFAULT AUTOTHRESH (-32.0, which is considered to be @ TV levels), then set ScaleAutoThreshYUV=True to enable Thresh scaling. If your clip is YUV at PC levels and you want to use a PC levels AUTOTHRESH (-ve) then leave ScaleAutoThreshYUV at default false which does not scale Thresh. After any scaling, MINLUMA is then added to abs(Thresh) and processed as for +ve Explicit Threshold as noted above. NOTE, RoboCrop 'massages' DEFAULT THRESH (exactly -32.0) if low samples count or if short clip. Reason being to avoid overcropping when insufficient data available for reliable cropping. It is considered better to not crop enough or at all, than to overcrop. You can override by simply setting an explicit threshold (+ve) of eg 40.0, or setting a NON-DEFAULT auto thresh (-ve) eg -16.0 or -32.1, where YPlaneMin is established for the sampled frames and then abs(thresh) is added to that value which is then used as an explicit thresh. Laced:, Default=true, true for Interlaced. RoboCrop automatically deduces colorspace cropping restrictions and sets internal XMod and YMod, eg XMod and YMod would both be set to 2 for YV12, for YUY2 Xmod=2, YMod=1, etc. If Laced==true, then internal YMod is doubled so as not to destroy chroma. Below WMod and HMod are both defaulted to internal XMod and YMod respectively after the Laced hint is applied to YMod. WMod:, Default=The natural chroma cropping restriction of the colorspace concerned, eg 2 for YV12. HMod:, Default=The natural chroma cropping restriction of the colorspace concerned, BUT, doubled if laced=true. The above WMod,HMod sets rounding for legal cropping coords for colorspace concerned. WMod MUST be a multiple of internal XMod as described under Laced above, or it will throw an error. HMod MUST be a multiple of internal YMod as described under Laced above, or it will throw an error. If eg colorspace is YV12 then YMod would be set to 2, and if Laced, then YMod would be doubled to 4, so HMod MUST be a multiple of 4. Some encoders may require an WMod/HMod of eg 8 or 16, and if set thus, would crop off more or less depending upon which CropMode is set, if later resizing will be done, then encoder requirements can be satisfied during the resize. NOTE, Some players and VirtualDubMod (Helix YV12 decoder) dont like WMOD less than 4 (Vdub latest, OK, internal decoder). RLBT:=15=All Borders, Bitflags of edges to crop, 15 ($0F) crops all four. Each letter in the name 'RLBT' represents an edge and bit position starting with 'R' in bit 3 representing the value 8 (2^3=8). 'L' = bit 2=4 (2^2=4), 'B' = bit 1=2 (2^1=2), 'T' = bit 0=1 (2^0=1). To calculate the RLBT bitflags, for 'R'(Right) add 8, for 'L'(Left) add 4, for 'B'(Bottom) add 2, and for 'T'(Top) add 1. Add all of the bit flags together 8+4+2+1 (=15) crops all four edges, 8+4 crops only Right & Left, and 2+1 crops only Bottom & Top. DEBUG:=False=No Debug. Set True for debugging info, need DebugView: http://technet.microsoft.com/en-gb/sysinternals/bb545027 Ignore:=0.2, Percentage of darkest pixels to ignore during AutoThresh scan to detect minimum luma pixel of all sampled frames. (ignores noise, as Threshold in YPlaneMin). Matrix:, RGB ONLY. For conversion of RGB to YUV-Y, 0 = Rec601, 1 = Rec709, 2 = PC601, 3 = PC709 Default for RGB is 2(PC601) if clip width <= 720 else 3(PC709) : YUV not used The defaults are for PC601 & PC709 range 0-255. So as to not require different AutoThresh for RGB, if clip c is RGB AND matrix is PC Levels AND Thresh < 0.0 and ScaleAutoThreshRGB=true, then Thresh will be scaled to RGB full range ie Thresh = Thresh * (255.0/(235.0-16.0)) ONLY when AutoThresh (ie Thresh < 0.0, YPlaneMin relative). When +ve Thresh is explicitly supplied (Thresh > 0.0) it is not scaled and assumed to be already correct range TV or PC levels. Baffle:=4, Number of scanlines (h/v) that must break threshold to be considered image (avoids noise). Does not usually need changing. ScaleAutoThreshRGB: bool default True. If true and RGB and Matrix at PC levels, and Thresh -ve (autothresh) then thresh will (after any low samples count scaling) be scaled to PC levels. By default, -ve Auto Thresh is considered to be at TV levels, and so will be scaled to to PC levels to match the matrix setting. If ScaleAutoThreshRGB is False Then autothresh is considered to be at PC levels and not scaled. ScaleAutoThreshYUV: bool default False. If true and YUV and Thresh -ve (autothresh) then thresh will (after any low samples count scaling) be scaled to PC levels. By default, -ve Auto Thresh is considered to be at TV levels, this allows you to change that assumption when source clips are at PC levels. If supplying PC levels clip and PC levels autothresh then leave this setting at false (no scaling). The above seemingly awkward settings are due to having to deal with YUV @ TV levels and RGB @ PC levels with the possibility of YUV @ PC levels. Cropmode: default=2 == CropMore. 1 = CropLess. Range 1 -> 2. 1 (CropLess) crops a little less border if the exact cropping coords do not comply with XMod/YMod/WMod/HMod as described earlier. May leave a little border edge. 2 Default, (CropMore) crops a little extra where exact coords do not comply XMod/YMod/WMod/HMod requirements. You may lose a little of the image edges. Blank: Default False. If true, then Blanks the borders, ie sets border to RGB(0,0,0) or YUV(16,128,128) instead of cropping. Is overridden if Show == true. BlankPC: default false. If Blanking then blanks to YUV(0,128,128) instead of default YUV(16,128,128). Align: Default false. If true, then aligns frames in memory when cropping, for eg SSE2 16-byte alignment required by some filters, particularly smoothing filters (filters following after RoboCrop). See Docs for Crop(). Only Applies if Cropping, ie Blank==false AND Show==false. Show: Default false. If true, then does no cropping, just shows a little info on frame. Overrides both Blank and Align. LogFn: Default "". Filename of Log file. Will output crop coords eg "10 16 700 544". Crop coords will be output whether cropping or not (Blank/Show). LogAppend: Default false. If true then appends log to any existing log file. ATM: Float default 4.0 (0.5 -> 32.0). Silently limited to valid range. ATM allows user to set the DEFAULT AUTOTHRESH massaging minimum. When eg samples = 1, then auto thresholding is of course quite unreliable and so auto thresh would be 'massaged' to -ve(ATM), other values of Samples below 16 will likewise have auto thresh massaged but to a lesser degree, linearly between -ve(ATM) for Samples == 1 and -ve(32.0) for Samples == 16. Previous (Fixed) default for ATM was 0.5, for maximum safety so that a single Samples scan would NOT overcrop. The new ATM arg default of 4.0 is a less paranoid safety setting which should in most cases work well but with a very short clip or eg single image then user might be better off giving the minimum ATM of 0.5. An ATM of 32.0 will switch OFF default auto thresh massaging. So long as your clips are about 6 mins or more (and Samples == default 32) then there will be no auto thresh massaging and current default is unlikely to need changed, with very short clips or reduced Samples count, then you might want to reduce ATM, for maximum paranoia, set ATM=0.5. See Thresh. Cropping will likely fail on END CREDITS ONLY clips, where on black background, and will probably crop off the sides that are no different in average luma to any letterbox borders, if you cannot see the borders, then neither can RoboCrop(), even setting the auto Thresh to eg -1.0 or 0.0 is quite likely to fail. (See RLBT edge bitflags). If cropping too much border, then increase Samples or reduce Thresh or lower ATM if short clip. If not cropping enough border then border is being seen as image, increase Thresh. To speed up, you may want to leave Auto-Thresh alone and reduce samples, but there is danger that it will not detect all borders (overcrop). NOTE, The plugin AutoCrop() uses a Thresh of 40.0 and samples == 5 by default (No AutoThresh), but the base logic is not too dissimilar. Final NOTE, the args to especially note are:- WMod, you might want to supply WMod=4 if using VDubMod (some players might try to download codec), And Laced=False if you always process progressive or deinterlaced, And ATM set between 0.5 and 4.0 if very short clips/single-image. StainlessS Show=true v1.10+ Bottom image above: Left edge, single dots line, other edges a bit wiggly ie cropping moved inwards [CROPMORE] to adhere to X/Y/W/H Mod requirements. See Mediafire in sig.
__________________
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; 7th February 2020 at 06:05. Reason: Update |
12th June 2013, 15:40 | #2 | Link |
Registered User
Join Date: Sep 2008
Posts: 365
|
very interesting plugin.
I usually use applyrange to fix cropping in sources when it's not a static value, like: Code:
ApplyRange(25760,26183,"c_bottom") ApplyRange(26220,27286,"c_bottom") ApplyRange(27394,27605,"c_bottom") ApplyRange(27702,28529,"c_top") function c_top (clip c) { c return crop(0,2,0,0).Spline36Resize(width,height) } function c_bottom (clip c) { c return crop(0,0,0,-4).Spline36Resize(width,height) } function c_top_right (clip c) { c return crop(0,2,-4,0).Spline36Resize(width,height) } function c_right (clip c) { c return crop(0,0,-4,0).Spline36Resize(width,height) } And if yes, is there a way to log in a file all the frames/ranges which where cropped by RoboCrop?
__________________
(i have a tendency to drunk post) |
12th June 2013, 16:16 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Sorry Mastrboy, No.
RoboCrop is a sort of drop in replacement for AutoCrop. Where croppings differ, will pick the outermost cropping (EDIT: that it finds, by default it only samples 24 frames). I did do a little script using GScript and RT_Stats a few months back to fix dynamically changing borders on some anime. I got it working to do the job, but would not say it was complete (I got sick of it, especially as I have zero interest in cartoons). Perhaps you can make use of parts of it, search on "BorderTorture", I think you should get a hit on that (it was a test clip generator, cant remember what I called the actual cropping func). EDIT: See Here:- http://forum.doom9.org/showthread.ph...=bordertorture As I remember, it produced a file of crop coords and a sister fuinc, read them in and did the cropping. EDIT: It might make an interesting little project though, I'll have to think about that for a little while. The previously mentioned anime was interlaced, you got same prob ? I dont really have any source like that, that I can think of, except for one, and that one has scene blends which cause additional problems. hard to tell where the scene change is and where to alter cropping, also, that source is a tube flv file so lousy quality to begin with.
__________________
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 June 2013 at 16:40. |
13th June 2013, 15:49 | #5 | Link |
Registered User
Join Date: Sep 2008
Posts: 365
|
It's related to anime indeed, but not specifically interlaced anime, I have noticed it on different anime's usually created around 2000-2003. Usually it's only about 2-4px borders, so not very noticeable. But when noticed, you can't "un-notice" it :P
__________________
(i have a tendency to drunk post) |
13th June 2013, 23:37 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This world is plagued by perfectionists.
I personally miss the days when you could accuse someone of being witch, and next day you could burn them. Good times. EDIT: I'll see what I can do with a plugin to generate list of crops.
__________________
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 June 2013 at 09:37. |
14th June 2013, 20:56 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
From the link previously given, perhaps of some use. Just need to give clip trims, will auto crop and resize.
EDIT:- SCRIPT REMOVED, See Next post. Perhaps use ConvertToYV24() beforehand.
__________________
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 June 2013 at 18:45. |
17th June 2013, 01:48 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Mastrboy,
Perhaps handy for Dynamic cropping of Progressive stuff. Script removed, see posts #14 to #16
__________________
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; 19th June 2013 at 17:27. |
17th June 2013, 18:36 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Previous post script updated.
__________________
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 June 2013, 04:42 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
RoboCrop v0.10, update. see 1st post.
Small mod for Auto Thresh Massaging Code:
Here AUTOTHRESH Thresh massaging occurs in sequence:- 1 ) if Thresh == DEFAULT AUTOTHRESH (-32.0, defaulted OR user supplied): Let FrameRange = FrameEnd-FrameStart+1 (after skipping titles and end Credits, also Samples limited to FrameRange). Samples_massage = (Samples>=12) ? 1.0 : (Samples-1) * (1.0/(12-1)) Range_massage = (FrameRange >= 1000) ? 1.0 : (FrameRange-1) * (1.0/(1000-1)) Thresh = -(((Samples_massage * Range_massage) * 31.5) + 0.5) The adjustment to Auto Thresh is to reduce the possibility of overcropping on eg a dark low 'Samples' clip, or where source FrameRange (ie temporal frame set) is too small to take a reliable sample from. Resulting massaged Thresh will range between -0.5 and -32.0. Although massaging is intended to reduce overcropping, it could result in not cropping enough border (less disastrous), its a bit of a balancing act really. 2 ) If RGB AND PC matrix(default) AND ScaleAutoThreshRGB==True(default) then Thresh= Thresh*(255.0/(235-16)) 3 ) If YUV AND ScaleAutoThreshYUV==True(default=false) then Thresh= Thresh*(255.0/(235-16)) On synthetic BorderTorture created clip, source had several 18 frame scenes which did not previously crop well, now crops spot on. clip was a sort of photo shoot with black backdrops which made it difficult to find cropping on an 18 frame scene. Also, scene change in DynaCrop script does not get fooled by single white frame flash photography (was already flash proof). Really happy how it is performing. Now I would like to know how DynaCrop (and by extension RoboCrop) performs on non synthetic dynamic borders. EDIT: Mastrboy, I'll add a crop log to DynaCrop(), perhaps in form "Trim(s,e).Crop(x,y,-w,-h)" or maybe "Vnnn=Trim(s,e).Crop(x,y,-w,-h)" Or other, Any preference ?
__________________
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 June 2013 at 14:11. |
18th June 2013, 21:54 | #12 | Link |
Registered User
Join Date: Sep 2008
Posts: 365
|
A lot happened in this thread when I wasn't looking.
Only preference I have is that it logs by ranges, and not single frames, unless of course there is a single frame which needs cropping. Now I only have to find those sources which had these issues and test...
__________________
(i have a tendency to drunk post) |
19th June 2013, 09:09 | #13 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Change of mind, Ill implement user configured log, something like
Code:
"V_NNN_=Trim(_S_,_E_).Crop(_X_,_Y_,_-W_,_-H_)" or "V_NNN_=Trim(_S_,_E_).Crop(_X_,_Y_,_W_,_H_)"
__________________
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 ??? |
19th June 2013, 16:46 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Update to RoboCrop v0.20 see first post.
Added args, BlankPC, LogFn, LogAppend. Changed, range massage switch on frames to below 1500 (from 1000). Code:
Range_massage = (FrameRange >= 1500) ? 1.0 : (FrameRange-1) * (1.0/(1500-1)) MakeBorderTortureClip.avs Code:
# MakeBorderTortureClip.avs Function MakeBorderTortureClip(clip c,String "fn") { # TESTING ONLY # Make a torture test clip using trims file made by SC_MakeTrimFile() {MUST USE SAME SOURCE FILE AS SC_MakeTrimFile}. # Use resulting clip as input to DynaCrop(). # Input clip should have plenty of scene changes WITHOUT Blended Scene Transitions. # Edges will be cropped and synthetic borders added to original size. # Requires RT_Stats v1.18 for RT_ColorSpaceXMod/YMod. c myName="MakeBorderTortureClip: " fn=Default(fn,"TrimFile.Txt") # input filename Assert(Exist(fn),myName+"File Not Found "+fn) c2=0 oldcx=0 oldcy=0 oldcw=0 oldch=0 XMod=RT_ColorSpaceXMod() YMod=RT_ColorSpaceYMod(Laced=false) MX=32/XMod MY=32/YMod GSCript(""" Lines=RT_FileQueryLines(fn) # Total lines in text file SS=RT_ReadTxtFromFile(fn) # Complete text file of trims. For(n=0,Lines-1) { S=RT_TxtGetLine(SS,Line=n) # Get the trim line S=RT_StrReplace(S,Chr(9)," ") # Convert any TAB to SPACE S=Lcase(RT_StrReplaceDeep(S," "," ")) # Convert Multiple SPACE to single SPACE Start=RT_NumberValue(S) # trim start S=MidStr(S,FindStr(S," ")+1) End=RT_NumberValue(S) # trim end t=Trim(Start,End) b=true while(b || (cx==oldcx && cy==oldcy && cw==oldcw && ch==oldch)) { # Make sure some change at every trim cx=Rand(MX+1)*XMod cy=Rand(MY+1)*YMOD cw=Rand(MX+1)*XMod ch=Rand(MY+1)*YMod b=false } t=t.Crop(cx,cy,-cw,-ch).AddBorders(cx,cy,cw,ch) # create fake borders c2 = (c2.isClip) ? c2++t : t old_cx=cx oldcy=cy oldcw=cw oldch=ch # REM for next time } """) return c2 } Code:
# MakeBorderTortureClip_Client.avs Import("DynaCrop.avs") Import("MakeBorderTortureClip.avs") AVISource("D:\AVS\TEST.avi") # TESTING ONLY ON GOOD CLIP WITHOUT BORDERS and NO blended Scene transitions. #ConvertToYV24() # v2.6 optional, MOD 1 Torture clip and cropping Return SC_ShowMetrics() # Show metrics to get best Threshold 'th'. #Return SC_MakeTrimFile() # Make Trims file for MakeBorderTortureClip/DynaCrop, Must Play all way through. ### MUST use SC_MakeTrimFile() to make trims file BEFORE below used. CROPTHRESH = -32.0 # AUTOMATIC Thresholding, See RoboCrop. SHOW=True #Return MakeBorderTortureClip().DynaCrop(CropThresh=CROPTHRESH,show=SHOW).ConvertToYV12() # Show croppings #MakeBorderTortureClip() # MAKE A SOURCE TORTURE CLIP for DynaCrop_Client test #ConvertToYV12()
__________________
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; 19th June 2013 at 16:52. |
19th June 2013, 16:47 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Also see previous post, RoboCrop Update.
DynaCrop.AVS Code:
###################### # DynaCrop.AVS v1.01 - Script, by StainlessS. # Crop dynamically changing borders from PROGRESSIVE clip. Requires GScript, Grunt, RT_Stats v1.18, RoboCrop v0.20. # Will NOT Work well with blended scene transitions. ###################### Function SC_ShowMetrics(clip c,float "th",float "th2",int "x",int "y",int "w",int "h",bool "fast") { # For Setting th (and less often th2) for SC_MakeTrimFile(). # Above th is Scene Change (Curr->Next). # th2 governs NOT SCENE CHANGE decisions Prev->Curr and Next->(Next+1). Should be less than th. Default 0.8 * th. # x,y,w,h sets border to ignore crud. # Metric used sort of like:- mt_lutxy(mt_polish("((x-y)/4)^2")).AverageLuma() c th=Float(Default(th,80.0)) # About 80.0 seems good for fast/slow motion th2=Float(Default(th2,0.8*th)) # Default th2 set 0.8 * th x=default(x,16) y=default(y,16) w=default(w,-16) h=default(h,-16) # avoid crud Fast=Default(Fast,True) Global SCM_B=0.0 Global SCM_C=0.0 Global SCM_sc=False Global SCM_Prev=-2 # Init vars, SCM_Prev=-2 forces initalize ScriptClip(""" # If jumped about, get values for Previous frame, else keep same. NotNext = (current_frame!=SCM_Prev+1) Global SCM_A=(NotNext)? RT_LumaSceneChange(Last,Last,n=current_frame-2,n2=current_frame-1,x=x,y=y,w=w,h=h) : SCM_A Global SCM_B=(NotNext)? RT_LumaSceneChange(Last,Last,n=current_frame-1,n2=current_frame ,x=x,y=y,w=w,h=h) : SCM_B Global SCM_C=(NotNext)? RT_LumaSceneChange(Last,Last,n=current_frame, n2=current_frame+1,x=x,y=y,w=w,h=h) : SCM_C psc=(NotNext) ? (SCM_A<th2 && SCM_B>=th && SCM_C<th2) : SCM_SC # Pass the parcel Global SCM_A=SCM_B Global SCM_B=SCM_C Global SCM_C=RT_LumaSceneChange(Last,Last,n=current_frame+1,n2=current_frame+2,x=x,y=y,w=w,h=h) # diff(next,next+1) # Prev->Curr NOT Scene Change AND Curr->Next IS Scene Change AND Next->(Next+1) NOT Scene Change Global SCM_SC=((SCM_A<th2 && SCM_B>=th && SCM_C<th2) || current_frame==FrameCount()-1) # Last frame in scene ? Subtitle(String(current_frame)+"] "+String(SCM_A,"%6.2f")+" "+String(SCM_B,"%6.2f")+" "+String(SCM_C,"%6.2f")+\ "\nTh="+String(th,"%.1f")+" Th2="+String(th2,"%.1f"),lsp=0) (SCM_SC) ? Subtitle("END OF SCENE", align=1,size=30) : NOP (psc||current_frame==0) ? Subtitle("START OF SCENE",align=3,size=30) : NOP # 1st frame in scene, Previous was Last frame in scene Global SCM_Prev=current_frame Return Last """,args="th,th2,x,y,w,h") # Needs Grunt for args return ((Fast)?AssumeFPS(250.0):Last).KillAudio() } Function SC_MakeTrimFile(clip c,float "th",float "th2",int "x",int "y",int "w",int "h",bool "fast",String "Fn") { # Must play all way through, no jumping about. Set th using SC_ShowMetrics() # Creates output file, list of trims for DynaCrop() {ALSO for MakeBorderTortureClip() to create a TEST clip} # Above th is Scene Change (Curr->Next). # th2 governs NOT SCENE CHANGE decisions Prev->Curr and Next->(Next+1). Should be less than th. Default 0.8 * th. # x,y,w,h sets border to ignore crud. # Metric used sort of like:- mt_lutxy(mt_polish("((x-y)/4)^2")).AverageLuma() c myName="SC_MakeTrimFile: " th=Float(Default(th,80.0)) # About 80.0 seems good for fast/slow motion th2=Float(Default(th2,0.8*th)) # Default th2 set 0.8 * th x=default(x,16) y=default(y,16) w=default(w,-16) h=default(h,-16) # avoid crud Fast=Default(Fast,True) Fn=Default(Fn,"TrimFile.Txt") (Exist(Fn)) ? RT_FileDelete(Fn) : NOP # Delete existing Global SCM_B=0.0 Global SCM_C=0.0 Global SCM_Prev=-1 Global SCM_Start=0 Global SCM_NotNext=false # Init vars ScriptClip(""" Global SCM_NotNext = (current_frame!=SCM_Prev+1 || SCM_NotNext) # Lock NotNext global if error (SCM_NotNext && Exist(Fn)) ? RT_FileDelete(Fn) : NOP # Spank user for jumping about :) Assert(SCM_NotNext==false,myName+"Cannot seek whilst making trims file "+fn) # Message on frame ONLY, no abort # Pass the parcel Global SCM_A=SCM_B Global SCM_B=SCM_C Global SCM_C=RT_LumaSceneChange(Last,Last,n=current_frame+1,n2=current_frame+2,x=x,y=y,w=w,h=h) # Prev->Curr NOT Scene Change AND Curr->Next IS Scene Change AND Next->(Next+1) NOT Scene Change SC=((SCM_A<th2 && SCM_B>=th && SCM_C<th2) || current_frame==FrameCount()-1) (SC && !SCM_NotNext) ? RT_TxtWriteFile(String(SCM_Start)+" "+String(current_frame),Fn,append=True) : NOP Global SCM_Start = (SC) ? current_frame + 1 : SCM_Start Global SCM_Prev=current_frame Return Last """,args="th,th2,x,y,w,h,fn,myName") # Needs Grunt for args return ((Fast)?AssumeFPS(250.0):Last).KillAudio() } Function DynaCrop(clip c,String "fn",int "W",int "H",String "Resizer",Float "CropThresh",bool "Show",String "LogFn",String "LogTMPT",bool "Debug") { # Auto crop list of trims in filename 'fn' and resize to WxH using 'Resizer' <Default = "Spline64Resize(_W_,_H_)"> # CropThresh is RoboCrop thresh. Show is RoboCrop Show. # LogFn default "DynaCrop.log". User configurable output log file name. # LogTMPT Log Template, Default="V_NNNN_ = Trim(_S_,_E_).Crop(_CX_,_CY_,_-CW_,_-CH_)._RSZ_"+(9)+Chr(9)+"# Crop_W= _CW_ Crop_H= _CH_" # Default produces eg "V0000 = Trim(0,215).Crop(2,4,-14,-6).Spline64Resize(640,400) # Crop_W= 624 Crop_H= 390" # Requires RoboCrop v0.20 for RoboCrop output LogFile, to get crop coords. ######################################### # Log TEMPLATE Replacements # "_NNNN_" = trim number, 0 relative # "_S_" = Start frame Number, "_E_" = End frame number # "_CX_", "_CY_", "_CW_","_CH_", Crop x,y,w,h, "_-CW_" and "_-CH_" are -ve crop width and height relative # "_IW_", "_IH_" = Input clip width and height. # "_W_", "_H_" = Resize width and height. # "_RSZ_" = The resizer, defaulted or otherwise. ######################################### c myName="DynaCrop:" c2 = 0 fn=Default(fn,"TrimFile.Txt") # input filename _W_=Default(W,width) _H_=Default(H,height) Resizer=Default(Resizer,"Spline64Resize(_W_,_H_)") # Resizer to use TResizer="t."+Resizer LogTMPT=Default(LogTMPT,"V_NNNN_ = Trim(_S_,_E_).Crop(_CX_,_CY_,_-CW_,_-CH_)._RSZ_"+Chr(9)+Chr(9)+"# Crop_W= _CW_ Crop_H= _CH_" ) LogFn=Default(LogFn,"DynaCrop.log") Debug=Default(Debug,false) Assert(Exist(fn),myName+" File Not Found "+fn) (Exist(LogFn)) ? RT_FileDelete(LogFn) : NOP # Delete existing Log Lines=RT_FileQueryLines(fn) # Total lines in text file SS=RT_ReadTxtFromFile(fn) # Read complete text file into string EOL=Chr(10) FND="_RSZ_"+EOL+"_NNNN_"+EOL+"_S_"+EOL+"_E_"+EOL+"_CX_"+EOL+"_CY_"+EOL+"_CW_"+EOL+"_CH_"+EOL+"_-CW_"+EOL+"_-CH_"+EOL+"_W_"+EOL+ \ "_H_"+EOL+"_IW_"+EOL+"_IH_"+EOL TmpLog="DynaCropTmp~.log" (Exist(TmpLog)) ? RT_FileDelete(TmpLog) : NOP # Delete existing TmpLog GSCript(""" for(n=0,Lines-1) { S=RT_TxtGetLine(SS,Line=n) # Get the trim line S=RT_StrReplace(S,Chr(9)," ") # Convert any TAB to SPACE S=Lcase(RT_StrReplaceDeep(S," "," ")) # Convert Multiple SPACE to single SPACE Start=RT_NumberValue(S) S=MidStr(S,FindStr(S," ")+1) End=RT_NumberValue(S) t=Trim(Start,End) # Get current trim t=t.RoboCrop(thresh=CROPTHRESH,laced=False,show=Show,debug=Debug,LogFn=TmpLog,LogAppend=false) if(LogFn!="" && Exist(TmpLog)) { ts= RT_ReadTxtFromFile(TmpLog) Crop_x=RT_NumberValue(ts) ts=MidStr(ts,FindStr(ts," ")+1) Crop_y=RT_NumberValue(ts) ts=MidStr(ts,FindStr(ts," ")+1) Crop_w=RT_NumberValue(ts) ts=MidStr(ts,FindStr(ts," ")+1) Crop_h=RT_NumberValue(ts) REP = \ Resizer + EOL + \ RT_NumberString(n,width=4) + EOL + \ RT_NumberString(Start) + EOL + \ RT_NumberString(End) + EOL + \ RT_NumberString(crop_x) + EOL + \ RT_NumberString(crop_y) + EOL + \ RT_NumberString(crop_w) + EOL + \ RT_NumberString(crop_h) + EOL + \ RT_NumberString(crop_w -(Width - crop_x)) + EOL + \ RT_NumberString(crop_h -(Height - crop_y)) + EOL + \ RT_NumberString(_W_) + EOL + \ RT_NumberString(_H_) + EOL + \ RT_NumberString(Width) + EOL + \ RT_NumberString(Height) + EOL LOG=RT_StrReplaceMulti(LogTMPT,FND,REP) RT_TxtWriteFile(LOG,LogFn,append=True) } t=Eval(TResizer) # Resize using optional resizer c2 = (c2.isClip) ? c2++t : t # Splice } (Exist(TmpLog)) ? RT_FileDelete(TmpLog) : NOP # Delete temp Log """) return c2 } DynaCrop_Client.avs Code:
# DynaCrop_Client.avs Import("DynaCrop.avs") #AVISource("D:\AVS\TEST.avi") AVISource("D:\AVS\BORDERTORTURE.avi") # Pre-Prepared TORTURE test clip #ConvertToYV24() # Optional v2.6, MOD 1 crop coords Return SC_ShowMetrics().ConvertToYV12() # Show metrics to get best Threshold 'th', use bofore SC_MakeTrimFile(). #Return SC_MakeTrimFile().ConvertToYV12() # Make Trims file for DynaCrop(), Must Play all way through. ### MUST use SC_MakeTrimFile() to make trims file BEFORE below used. CROPTHRESH = -32.0 # AUTOMATIC Thresholding, See RoboCrop. SHOW=True # SHOW WHAT WHAT WILL BE CROPPED DEBUG=False # RoboCrop Debug #Return DynaCrop(CropThresh=CROPTHRESH,show=SHOW,debug=DEBUG).ConvertToYV12() DynaSplice.avs Code:
# DynaSplice.avs # Joins trims file generated as DEFAULT DynaCrop logfile. Function SpliceTrimsString(String VideoString,int maxim,int "Wid") { Wid=Default(Wid,4) GSCript(""" S="" for(i =0,maxim) { if(S!="") { S=RT_StrAddStr(S,"++") } S=RT_StrAddStr(S,VideoString,RT_NumberString(i,width=wid)) # RT_StrAddStr, Avoid v2.58 bug } """) return S } AVISource("D:\AVS\BORDERTORTURE.avi") # Pre-Prepared TORTURE test clip #ConvertToYV24() # v2.6 optional, Mod 1 Cropping TRIMSFILE="Dynacrop.log" # Created by DynaCrop default logging. TRIMS=RT_ReadTxtFromFile(TRIMSFILE) # Or Import() Lines=RT_TxtQueryLines(TRIMS) # Total lines in text file (Or RT_FileQueryLines) SPLICE=SpliceTrimsString("V",Lines-1) # Zero Relative Eval(TRIMS) # Eval trims,crop,resize Eval(SPLICE) # Splice trims ConvertToYV12()
__________________
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 June 2013 at 03:35. Reason: Update |
19th June 2013, 16:51 | #16 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Split post due to 16kb limit. See two previous posts.
Trims file Generated by SC_MakeTrimFile() Code:
0 215 216 233 234 334 335 442 443 520 521 637 638 711 712 798 799 816 817 843 844 1018 1019 1131 1132 1298 1299 1329 1330 1450 1451 1569 1570 1744 1745 1856 1857 1917 1918 2010 2011 2055 2056 2118 2119 2236 2237 2392 2393 2473 2474 2723 2724 3410 3411 3505 3506 3608 3609 3684 3685 3769 3770 4143 4144 4212 4213 4685 4686 5202 5203 5449 5450 5791 5792 5822 Code:
V0000 = Trim(0,215).Crop(8,20,-31,-1).Spline64Resize(640,400) # Crop_W= 601 Crop_H= 379 V0001 = Trim(216,233).Crop(29,16,-27,-21).Spline64Resize(640,400) # Crop_W= 584 Crop_H= 363 V0002 = Trim(234,334).Crop(1,11,-29,-29).Spline64Resize(640,400) # Crop_W= 610 Crop_H= 360 V0003 = Trim(335,442).Crop(16,30,-28,-29).Spline64Resize(640,400) # Crop_W= 596 Crop_H= 341 V0004 = Trim(443,520).Crop(25,29,-9,-24).Spline64Resize(640,400) # Crop_W= 606 Crop_H= 347 V0005 = Trim(521,637).Crop(18,18,-8,-21).Spline64Resize(640,400) # Crop_W= 614 Crop_H= 361 V0006 = Trim(638,711).Crop(28,7,-30,-5).Spline64Resize(640,400) # Crop_W= 582 Crop_H= 388 V0007 = Trim(712,798).Crop(17,29,-2,-12).Spline64Resize(640,400) # Crop_W= 621 Crop_H= 359 V0008 = Trim(799,816).Crop(20,21,-21,-13).Spline64Resize(640,400) # Crop_W= 599 Crop_H= 366 V0009 = Trim(817,843).Crop(26,31,-7,-27).Spline64Resize(640,400) # Crop_W= 607 Crop_H= 342 V0010 = Trim(844,1018).Crop(26,18,-5,-6).Spline64Resize(640,400) # Crop_W= 609 Crop_H= 376 V0011 = Trim(1019,1131).Crop(18,11,-27,-22).Spline64Resize(640,400) # Crop_W= 595 Crop_H= 367 V0012 = Trim(1132,1298).Crop(5,4,-5,-23).Spline64Resize(640,400) # Crop_W= 630 Crop_H= 373 V0013 = Trim(1299,1329).Crop(25,21,-6,-22).Spline64Resize(640,400) # Crop_W= 609 Crop_H= 357 V0014 = Trim(1330,1450).Crop(11,6,-7,-19).Spline64Resize(640,400) # Crop_W= 622 Crop_H= 375 V0015 = Trim(1451,1569).Crop(7,32,-14,-27).Spline64Resize(640,400) # Crop_W= 619 Crop_H= 341 V0016 = Trim(1570,1744).Crop(24,10,-31,-32).Spline64Resize(640,400) # Crop_W= 585 Crop_H= 358 V0017 = Trim(1745,1856).Crop(25,10,-23,-12).Spline64Resize(640,400) # Crop_W= 592 Crop_H= 378 V0018 = Trim(1857,1917).Crop(17,30,-16,-5).Spline64Resize(640,400) # Crop_W= 607 Crop_H= 365 V0019 = Trim(1918,2010).Crop(24,15,-6,-17).Spline64Resize(640,400) # Crop_W= 610 Crop_H= 368 V0020 = Trim(2011,2055).Crop(27,17,-27,-22).Spline64Resize(640,400) # Crop_W= 586 Crop_H= 361 V0021 = Trim(2056,2118).Crop(12,26,-16,-17).Spline64Resize(640,400) # Crop_W= 612 Crop_H= 357 V0022 = Trim(2119,2236).Crop(5,7,-15,0).Spline64Resize(640,400) # Crop_W= 620 Crop_H= 393 V0023 = Trim(2237,2392).Crop(8,4,-26,-22).Spline64Resize(640,400) # Crop_W= 606 Crop_H= 374 V0024 = Trim(2393,2473).Crop(14,3,-27,-8).Spline64Resize(640,400) # Crop_W= 599 Crop_H= 389 V0025 = Trim(2474,2723).Crop(15,29,-19,-24).Spline64Resize(640,400) # Crop_W= 606 Crop_H= 347 V0026 = Trim(2724,3410).Crop(0,30,-18,-29).Spline64Resize(640,400) # Crop_W= 622 Crop_H= 341 V0027 = Trim(3411,3505).Crop(26,12,-5,-2).Spline64Resize(640,400) # Crop_W= 609 Crop_H= 386 V0028 = Trim(3506,3608).Crop(29,31,0,-21).Spline64Resize(640,400) # Crop_W= 611 Crop_H= 348 V0029 = Trim(3609,3684).Crop(14,30,-15,-12).Spline64Resize(640,400) # Crop_W= 611 Crop_H= 358 V0030 = Trim(3685,3769).Crop(28,24,-20,-24).Spline64Resize(640,400) # Crop_W= 592 Crop_H= 352 V0031 = Trim(3770,4143).Crop(14,17,-27,-31).Spline64Resize(640,400) # Crop_W= 599 Crop_H= 352 V0032 = Trim(4144,4212).Crop(5,7,-26,-28).Spline64Resize(640,400) # Crop_W= 609 Crop_H= 365 V0033 = Trim(4213,4685).Crop(12,10,-7,-31).Spline64Resize(640,400) # Crop_W= 621 Crop_H= 359 V0034 = Trim(4686,5202).Crop(21,29,-22,-18).Spline64Resize(640,400) # Crop_W= 597 Crop_H= 353 V0035 = Trim(5203,5449).Crop(13,11,0,-21).Spline64Resize(640,400) # Crop_W= 627 Crop_H= 368 V0036 = Trim(5450,5791).Crop(29,32,-1,-23).Spline64Resize(640,400) # Crop_W= 610 Crop_H= 345 V0037 = Trim(5792,5822).Crop(32,9,-20,-31).Spline64Resize(640,400) # Crop_W= 588 Crop_H= 360 Trims file generated by SC_MakeTrimFile() produces 1st file above. EDIT: Found a fairly popular DVD that SC_MakeTrimFile fails on quite badly, X-Men II. The lady in the blue rubber naked suit (forgot her name), has different cropping whenever she is on screen, so I thought I would try the Dynacrop thing, and SC_MakeTrimFile is way off recognizing many scene changes. Some scene changes require a th of about 16.0 (default 80.0) so is a long way off. Going to have to add chroma to scene change detection or figure out a better way of doing it.
__________________
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 June 2013 at 04:04. |
21st June 2013, 18:34 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Here, just an experiment to see if we understood how SCSelect works.
Code:
Avisource("D:\avs\test.avi") # RemoveDirt's SCSelect(clip input, clip scene_begin, clip scene_end, clip global_motion, float dfactor, bool debug, bool planar) Function SCSelect_Like(clip dclip,clip Start,clip End,clip Motion, float "dfactor",bool "debug") { # Start, End, Motion MUST all be same, dclip can be other colorspace/size (unlike SCSelect). dfactor=Float(Default(dfactor,4.0)) debug=Default(debug,false) Global SCM_A=0.0 Global SCM_B=0.0 Global SCM_SC=0 Global SCM_Prev=-1 Motion.ScriptClip(""" NotNext = (current_frame!=SCM_Prev+1) Global SCM_A=(NotNext)? RT_LumaDifference(dclip,dclip,n=current_frame-1,n2=current_frame) : SCM_B Global SCM_B= RT_LumaDifference(dclip,dclip,n=current_frame,n2=current_frame+1) # 0 = Start of scene, 1 = End of scene, 2 = Global motion Global SCM_SC=(current_frame==FrameCount-1)?1:(SCM_A>dfactor*SCM_B || current_frame==0)?0:(SCM_B>dfactor*SCM_A)?1:2 (SCM_SC==0) ? Start : (SCM_SC==1) ? End : Last # Choose Start, End or Motion(ie Last) (debug)?RT_Subtitle("%d ] %6.2f %6.2f SC=%d",current_frame,SCM_A,SCM_B,SCM_SC):NOP Global SCM_Prev=current_frame Return Last """,args="dfactor,Start,End,Dclip,debug") # Needs Grunt for args return Last } Start=Subtitle("START OF SCENE",align=3,size=30) End=Subtitle("END OF SCENE", align=1,size=30) Motion=Subtitle("GLOBAL MOTION",align=5,size=30) L=SCSelect_Like(Last,Start,End,Motion,debug=true) R=SCSelect(Last,Start,End,Motion) StackHorizontal(L,R) EDIT: It's not what I could call reliable, unmatched start/end scene, completely messes up on flash photography. I'm quite surprised that people use SCSelect at all.
__________________
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 September 2013 at 11:51. |
10th July 2013, 22:54 | #18 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
RoboCrop v0.21, Update, see 1st post.
Changed default samples to 32, modified Thresh Massaging, generally a bit more paranoia.
__________________
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 ??? |
11th September 2013, 00:04 | #19 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
RoboCrop v1.00, beta status removed (Atm arg added). See 1st post.
EDIT: current RT_Stats zip contains updates to previous given scripts eg DynaCrop.avs.
__________________
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 September 2013 at 17:37. |
23rd November 2013, 18:45 | #20 | Link |
Registered User
Join Date: Feb 2002
Location: Charlotte, NC USA
Posts: 1,984
|
Mediafire link is a 404. Did you intend to have an updated script set there?
I am looking for a way to autocrop frames such as the attached screenshot. Preferred method would be a scan of an entire file with the minimal crop values returned. Seems the entire stream should be checked due to the variable cropping mentioned above. Results will be used to generate encoder scripts with video bitrate a function of post-cropped frame-size. My hope is to use RoboCrop in a pre-scan to generate crop values for each file in the queue, preserving field order and block sizes so crap and frame would be the result. Output from RoboCrop would probably go into a file with a format similar to: filename cropx1 cropx2 cropy1 cropy2 framewidth frameheight or something similar which can be easily parsed by a batch file. End result of my process will be a job queue of various frame sizes, rates and source codecs which can be loaded into Hybrid encoding GUI for a "encode all in directory to a target quality/size" process. Another example of this type of unwanted junk is at: http://forum.doom9.org/showthread.php?p=1651430#post1651430 Notice how close the noise is to the desired video data. Perhaps a grayscale vs. chroma determination would help. I assume this is extra junk that DirecTV uses for the guide data or extra information for a show, maybe it's the bitmap for the recorded show. Background to this project is at: http://forum.doom9.org/showthread.php?t=169673
__________________
Reclusive fart. Collecting Military, Trains, Cooking, Woodworking, Fighting Illini, Auburn Tigers Last edited by FredThompson; 23rd November 2013 at 19:43. |
Tags |
autocrop, crop |
Thread Tools | Search this Thread |
Display Modes | |
|
|