RemoveBorders
I've been playing around today and whipped something together you might have fun with. It's the conceptual opposite of AddBorders: instead of surrounding the frame with black, it removes black borders from the source.
It tries to be accurate by sampling a number of frames over the course of the clip then taking the most common "border size" for each edge. More info -- slightly more, anyway ;) -- is available in the readme. I'm hoping to expand this into an Avisynth version of FitCD... As usual, you can get it from my web site, to which you'll find a link below. First, run it with no parameters (i.e. RemoveBorders()) and see if that works for you. Let me know if you have any problems. |
Hey SansGrip,
Sounds like AutoCrop(true,1,1,0,0,0,0,40,10) where 10 is the number of frames samples, true is display mode, width multiplied by 1, height multiplied by 1, etc. I used it to get full screen, but it would not give the correct aspect ratio like FitCD. :D -black prince |
Quote:
RemoveBorders() and it'll eventually do everything FitCD does -- at least with regard to resizing ;). |
Quote:
-kwag |
@SansGrip,
SansGrip wrote: Quote:
I thought you said it would be difficult to duplicate FitCD as a filter :) That would be fantastic though :D -black prince |
Quote:
RemoveBorders() BilinearResize(..., ...) instead of Crop(..., ..., ..., ...) BilinearResize(..., ...) In future versions it'll do the resizing too :). |
This looks VERY promising SansGrip :D
So this will basically remove FitCD from the ballgame 8O ( You should call it: AutoFit : :wink: ) -kwag |
Quote:
Quote:
|
Quote:
|
@SansGrip,
Quote:
Maybe AutoGrip could use some ideas from this :idea: -black prince |
Quote:
|
Quote:
Even RoboCrop is great :mrgreen: |
Thanks.
Lets see SansGrip oppinion. |
First try... Error... Illegal something.... can't remember...
Second try... It worked... did'nt touch anything... but I have a thick green line on the lower part of the screen... |
@SansGrip,
I created a avs script called RoboFit with automatic aspect ratio: RoboFit.avs: LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2DEC\MPEG2DEC2.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2DEC\MPEG2DEC.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\LegalClip\LegalClip.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\Blockbuster\Blockbuster.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\FluxSmooth\FluxSmooth.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\Sampler\Sampler.dll") LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\RemoveBorders\RemoveBorders.dll") mpeg2source("D:\Temp\movie.d2v") LegalClip() RemoveBorders() # # Get aspect ratio # Import("E:\DVD Backup\1 - DVD2KVCD\0 - Utilities\Avisynth\aspect_ratio.avs") ResizeMaintainAspectWidth(496,"BilinearResize") # Blockbuster(method="noise",variance=.5,seed=1) FluxSmooth() LegalClip() #Sampler() Aspect_Ratio.avs: function ResizeMaintainAspectWidth(clip c,int newwidth,string resizefn) { nh=floor(eval(string(c.height)+". * "+string(newwidth)+". / "+string(c.width)+".")) return eval(resizefn+"(c,"+string(newwidth)+","+string(nh )+")") } Tmpgenc gives me a resolution of 496x327, where as manually it came to 496x336. Of course Tmpgenc takes care of borders. :D I just filled in the width, 496 in red in RoboFit and the function created the proper height to keep aspect ratio. It's, 327, off by 9 to come to 336. The formula needs tweaking or maybe it's correct. :?: Using preview in Tmpgenc, it looks good. TV-overscan is accounted for by using 496 as width. :D -black prince |
Ah! black prince really getting to be a real "Hard Core" programmer on AviSynth :D
That script is cool :mrgreen: -kwag |
That formula won't be as accurate as FitCD (since FitCD uses the pixel aspect ratio of the source and target rather than simply going by frame size). I'm also not sure how it works with anamorphic material, which needs special handling.
I'm working on RemoveBorders's big brother right now (I called it GripFit but I like RoboCrop a lot better -- I'd buy that for a dollar! :mrgreen:). It guesses the (hopefully) correct pixel aspect ratios from the original and desired frame sizes and also attempts to use a sensible default for whether the source is anamophic or not (if it thinks the clip is from a DVD it treats it as anamorphic by default, otherwise it treats it as non-anamorphic). I'm not too far away from first release, maybe a day or two :). |
Just a quick update --
I have RoboCrop (:mrgreen:) successfully guessing both the source and destination pixel aspect ratios for a number of sources and targets, NTSC and PAL. Right now it crops existing borders, resizes (with an adjustment for anamorphic sources) and adds borders back in to make the final frame size. Brief tests indicate (at least to the eye) that it's preserving aspect ratio correctly. The source is very messy, though (since it kind of evolved from RemoveBorders) and I need to rewrite it. I also need to optimize the algorithm somewhat, since at the moment it crops, resizes, crops again if necessary, then adds borders. I want to get rid of that second crop. In addition I have to implement height rounding like FitCD does. And finally I'll need to make sure that there are a good number of options (e.g. rounding values, whether or not to add borders -- what would be nice is if you could run it multiple times, once with mode="resize" where it resizes but doesn't add borders, then again later with mode="borders" to finish the job -- and so on). I would say I'm probably a few days away from a release, but it's looking very promising :). |
You Guys are really incredible... You guys are the man!!!
|
I am willing to see the baby...
:ole: Gaudi |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.