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. |
29th June 2014, 17:17 | #1 | Link |
Registered User
Join Date: Feb 2009
Location: USA
Posts: 676
|
Script for A/B splitscreen compare?
I'm not sure what the term I'm looking for is, but I want to make a clip for my brother to review, for a Blu Ray I am working on cleaning up for him (grain removal)
I don't want to do a simple side-by-side. I would like to do a full video frame (1920x1080) with a splitscreen type effect, where the left half of the frame is the original, and the right half is filtered. |
29th June 2014, 17:59 | #3 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
I helps to have a black border between the two clips. Crop each clip to (half-width - 4), then add an 8-pix border in the middle.
It's also good to "pan" the cropped image if the area of interest is off center. I've had this script a long time and it's one I still use a lot Code:
################################## ### make side-by-side split clip (for comparison or preview) ## crop input images to fit in original width ## ## @ S - sound source [default = A] ## @ border - border subtracted from clips [default = 8] ## @ pan - range = -1.0 to +1.0: -1.0=left, 0.0=center, +1.0=right; [default = 0.0] ## @ wid - output width [default = input width] ## function UUStackTwoAcrossCropped(clip A, clip B, clip "S", \ int "border", float "pan", int "wid") { S = Default(S, A) inWid = Default(wid, A.Width) inHgt = Min(A.Height, B.Height) border = _uumod(4, Default(border, 8)) border2 = Int(border / 2) pan = Min(Max(-1.0, Float(Default(pan, 0.0))), 1.0) * 0.5 cropWid = _uumod(2, Float(inWid) / 2.0) A = A.UUSize(cropWid-border2, inHgt) B = B.UUSize(cropWid-border2, inHgt) A = A.AddBorders(0, 0, border2, 0) B = B.AddBorders(border2, 0, 0, 0) A = StackHorizontal(A, B).UUSize(inWid, inHgt) return (S.IsClip==false) ? A \ : (S.AudioChannels == 0) ? A \ : AudioDub(A, S) } ################################## ### crop or add borders to ensure clip is a certain size # function UUSize(clip C, int wid, int hgt) { bdrWid = (wid - C.Width) bdrHgt = (hgt - C.Height) bdrLt = Abs(Round(Float(bdrWid) / 2.0)) bdrLt = Sign(bdrWid) * (bdrLt + (bdrLt % 2)) bdrTp = Abs(Round(Float(bdrHgt) / 2.0)) bdrTp = Sign(bdrHgt) * (bdrTp + (bdrTp % 2)) bdrRt = (bdrWid - bdrLt) bdrBt = (bdrHgt - bdrTp) C = C.AddBorders( \ ((bdrLt > 0) ? bdrLt : 0), \ ((bdrTp > 0) ? bdrTp : 0), \ ((bdrRt > 0) ? bdrRt : 0), \ ((bdrBt > 0) ? bdrBt : 0)) C = C.Crop( \ ((bdrLt < 0) ? -bdrLt : 0), \ ((bdrTp < 0) ? -bdrTp : 0), \ ((bdrRt < 0) ? bdrRt : wid), \ ((bdrBt < 0) ? bdrBt : hgt)) return C } ################################## ## return argument 'f' as integer and ensure it is Mod 'm' ## ## @ m - mod value ## @ f - input (may be positive or negative) ## @ z - always mod towards zero after rounding (default true) ## ## Examples: ## _uumod(2, 3.4) == 2 ## _uumod(2, 3.6) == 4 ## _uumod(2, -3.4) == -2 ## _uumod(2, -3.6) == -4 ## ## _uumod(2, 3) == 2 ## _uumod(2, 3, false) == 4 ## _uumod(2, -3) == -2 ## _uumod(2, -3, false) == -4 ## function _uumod(int m, float f, bool "z") { m = Max(1, m) mult = Default(z, true) ? -1 : 1 fsgn = Sign(f) i = Round(Abs(f)) return fsgn * Max(0, i + mult * (i % m)) } Last edited by raffriff42; 30th June 2014 at 05:01. Reason: UUSize: bugfix |
30th June 2014, 19:07 | #5 | Link |
Anime addict
Join Date: Feb 2009
Location: Spain
Posts: 673
|
I use this:
A=Import("E:\xxx.avs").\ subtitle(string("Original")).Crop(0,0,-width/2,0) B=Import("E:\yyy.avs").\ subtitle(string("Modificado"),align=9).Crop(2+width/2,0,0,0).AddBorders(2, 0, 0, 0,$00FFFF00) Stackhorizontal(A,B)
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite |
30th June 2014, 21:17 | #6 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Because width() is used, it will only work if the return value from xxx.avs is the same as the final value of 'last' in that file. Similarly with yyy.avs. To make it work independently of how xxx.avs and yyy.avs are written, it would be better to use: Import("E:\xxx.avs") A = subtitle(string("Original")).Crop(0,0,-width/2,0) Import("E:\yyy.avs") B = subtitle(string("Modificado"),align=9).Crop(2+width/2,0,0,0).AddBorders(2, 0, 0, 0,$00FFFF00) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|