Border Control

My first VirtualDub filter and also now available as a native Avisynth plugin!!

It is designed to allow you to manipulate the regions at the top, bottom and sides of a frame.

This might be a useful option if you are capturing video for use in say a fixed VCD format. If you crop your video to get rid of rubbish (say from VHS capture) you normally have to add a solid border or resize to get the clip to the right dimensions for your MPEG encoder.

I've heard from others that MPEG coders don't like solid borders because although they compress OK, the transistion between the picture and the border often causes noticable artifacts (unless the borders are a multiple of 16pixels).

Resizing can be undesirable at times, especially if the material is interlaced.

I made this filter for 2 reasons - 1: to test the above theory and see what happens, 2: It was easy to start doing at the start! (Relativly speaking, as someone who'd never programmed in C/C++ before but can access Avery Lee's, Ben Rudiak-Gould's, Jim Casaburi's, Gunnar Thalin's and Donald Graft's source code)

Thanks to the above - especially Don for getting me going in writing filters in the 1st place and Avery for his patience in explaining the basics to a novice.

VirtualDub

V2.35 18th August 2003

A few bux fixes and introduced ability to use non-black borders :-) Thanks to Antonio Foranna for sone useful code to overcome the parameter limit and T Cook for pointing out some of the bugs.

I really hope it fully works now!


V2.31 5th Jan 2003
Bug fix so that filter can be used in batch jobs. I started introducing border colour but I've run out of parameters (seems VirtualDub has a limit of 16), so the options are greyed out at the moment. please let me know if this option is needed.

Download Border Control 2.35

Version History

V2.2 beta1 12th Feb 2002
Filter now processes corners in a much better manner.

V2.0 Alpha 2 17th October 2001
Filter now processes the sides as well as top and bottom and now called Border Control.

V1.0 24th October 2000
Added ability to stretch the top and bottom instead of just smearing. (This was my objective when I started the filter :-)

V0.4 - 23rd OCtober 2000

The filter now allows you to set a solid black border (if anyone wants colour - email me).  This should be set in increments of 16 if final compression is MPEG for VCD.  Other compression methods are happy with 8,4 or 2 (but I don't know which).

You can now set the fade to black region seperately from the smear region (I find a couple more lines over the smear region is about best myself).

Both the smear and fade regions stop at the border region.

10th October 2000 - Added facility to fade the smear region to black which disguises it better.

25th Sept 2000 - Added preview and user friendly setting controls - thanks to Donald for these - known bug - Cancel doesn't work properly - Donalds does, so I must have copied it wrong somewhere.





Avisynth

I started an Avisynth version in September 2002 -my first efforts at dealing with YUY2 colourspace- thanks to Donald Graft (as usual :-) and the others at Doom9 Avisynth Forum for educating me.

Note:The left and right parameters get doubled by the filter as I haven't sorted out how to deal properly with having 1 chroma sample for very 2 luminace ones yet :-(

It performs the same functions as the VirtualDub version in that you can set a black border, set a border region to be faded out and you can "smear" the border to save having to crop and resize the whole frame for the sake of a few pixels. Each border (top,bottom.left and right) can be manipulated independantly.

Syntax

#Example
LoadPlugin("BorderControl")
AVISource("Test.avi")
BorderControl(YBB=16,YTS=32)

This would put a solid black border at the bottom and smear some lines at the top of the picture. The plugins accepts up to 16 parameters, 4 for each border
There are 4 prefixes: YB,YT,XL and XR for bottom,top,left and right borders.

There are 4 suffixes: B for Border - this sets the amount of solid border, F for Fade, S for Smear and SF for SmearFactor.

Increasing SmearFactor (having first set the Smear value correctly) can help disguise the smear region at the expense of increasing the area being processed. I suggest using even values for YTSF and YBSF when dealing with interlaced material.

So the parameters are
BorderControl(clip,YBB, YBF, YBS, YBSF, YTB, YTF, YTS, YTSF, XLB, XLF, XLS, XLSF, XRB, XRF, XRS, XRSF)

I suggest you don't use them all at once :-)

Download

Download Version 1.4 for Avisynth

Version History

V1.4 - 16th Feb 2003 - Works with YV12 colourspace as well as YUY2.

V1.3 - 11th Feb 2003 - Recompiled for Avisynth 2.5

V1.1 - Changed algorithim for the top and bottom use of SmearFactor- should work better with interlaced material - let me know if you don't like the change!

V1.0 - 1st release

Source Code
All source code here is provided under the GPL license. This means you are free to use and distribute the software and program code for no fee. This also means you are free and encouraged to improve and expand upon the source code, but only as long as you make your modified version also under the GPL, and thus free software with access to the source code for anyone. The source code compiles under Visual C++ 6.0 with SP4. If there is a problem with the source code distribution, please do let me know.

Please email me or post to rec.video.desktop if you have any queries/comments/ideas/bug reports 

Copyright Simon Walters siwalters@hotmail.com



1