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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 | Link |
|
Cost Effective
Join Date: Nov 2007
Posts: 64
|
Pan and Scan: Widescreen to Fullscreen / Mobile / Weirdo AR Modification
I am converting widescreen films to a near to 4:3 frame. I must maintain the AR and I cannot letterbox the content as the destination device has a miniature screen so I am using a combination of crop and pan to move between points of action within this frame.
This is an example of how I am doing it so far. Code:
Import("ANocturne_Source_ntsc_2p0.avs")
Main
#Source Frame Info
global cHeight = float(Main.Height)
global cWidth = float(Main.Width)
global sourcePAR = TrueAR / cWidth * cHeight
#Destination Frame Info
global destWidth = 368
global destHeight = 288
global destPAR = 1
global destFrameAR=float(destWidth)/destHeight * destPAR
#Amount of width to Crop for no height Crop
global toBeCropped = cWidth - (destFrameAR * cHeight / sourcePAR)
#LeftFocus
function rightFocus(clip c, int "left", int "top", int "right", int "bottom" )
{
r = Default (right, 0)
l = Default (left , Round(toBeCropped)-r)
t = Default (top,0)
b = Default (bottom,0)
return c.Spline36Resize(destWidth,destHeight,l ,t,-r,-b)
}
#RightFocus
function leftFocus(clip c, int "left", int "top", int "right", int "bottom" )
{
l = Default (left , 0)
r = Default (right, Round(ToBeCropped-l))
t = Default (top,0)
b = Default (bottom,0)
return c.Spline36Resize(destWidth,destHeight,l ,t,-r,-b)
}
#CenterFocus
function centerFocus(clip c, int "left", int "top", int "right", int "bottom" )
{
l = Default (left , Round(toBeCropped/2))
r = Default (right, Round(toBeCropped/2))
t = Default (top,0)
b = Default (bottom,0)
return c.Spline36Resize(destWidth,destHeight,l ,t,-r,-b)
}
a = Main.Trim(0,143).rightFocus(right=6)
b = Main.Trim(144,194)
b = Animate(0,50,"BlackmanResize", b,destWidth,destHeight,234,0,-6,0, Main,destWidth,destHeight,120,0,-120,0)
c = Main.Trim(195,1881).centerFocus()
d = Main.Trim(1882,Main.framecount).leftFocus(left=6,top=8,bottom=12)
a+b+c+d
I was thinking of creating a more general purpose function that will do the grunt work for me. This is what I am thinking of. It's slightly all over the place (just words, no code, but probably still full of mistakes). If you have any suggestions on a better logic then let me know. Mostly I am wondering how to handle cases where someone chooses contradictory arguments, like focus=center, cropleft =40% width. And Whether to throw an error or override the crop arguments when they do not allow the correct AR. Stuff like that. Code:
function CropToAspect()
{
# ARGS
# Clip
# Source Frame Dimensions (global?)
# Source Display AR (global?)
# Destination Frame Dimensions (global?)
# Destination Display AR (global?)
#OPTIONAL ARGS
# focus [left, center, right] default = center
# looseAxis [horizontal, vertical, left, right, up, down, fixed] default = horizontal
# leftCrop, topCrop, rightCrop, bottomCrop, default= 0, defaults modified by focus
# mode [percentage, pixel] default = pixel
# focus acts as quasi-quickmode for horizontal crop
# focus = left / center / right -> Crop Left Right to fit AR taking into account args
# focus = left => if left crop specified, value overrides focus default (0)
# focus = right => if right crop specified, value overrides focus default (0)
# focus = center => if right or left crop specified and >> calculated right or left crop value
# value overrides calculated value, recalculate based on fixed left or right value
# if both values >> caluclated Values, override center focus / quickmode
# Crop Left XOR Crop Right ONLY => Assume Full Height, Crop Other Side to fit AR
# (Crop Left AND Crop Right) ONLY => Crop Height across top and bottom to fit AR, if not possible, modify according to variableAxis
# (Crop Top AND Bottom) AND (Right XOR Left) => Crop horizontal to fit AR if possible, if not, adjust crop values along variableAxis
# (Crop Top XOR Bottom) AND (Right XOR Left) => fix full height/width depending on looseAxis, crop accordingly
#ERRORS
# Crop > FrameDimensions
# Cannot Crop to AR with specified arguments
}
Edit: It would probably be easier and make more sense if I set a centre point rather than crop values, or just used zoooooom. Last edited by Umamio; 21st October 2008 at 23:14. |
|
|
|
|
|
#2 | Link |
|
Resize Abuser
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
|
KenBurnsEffect Does everything you need... Everything!
__________________
Mine: KenBurnsEffect/ZoomBox CutFrames Helped: DissolveAGG ColorBalance LQ Animation Fixer |
|
|
|
![]() |
|
|