View Single Post
Old 28th January 2020, 07:38   #1  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Rotation: New script!

EDIT:Hours and hours and I didn't give up.
Script for camera rotation around x and y axes in the attachment. You need to enter FoV, direction and amount of the rotation ... all in degrees.

Basic usage:
Code:
FoV=65
deg_dir=30
deg_amt=10

ColorBars().Trim(0,1000).Killaudio()

RotateCamera(FoV, deg_dir, deg_amt, add_borders=-512)
Script example:
Code:
borders=240
FoV=65
dir_speed=5.0
amt_speed=0.5

ColorBars(pixel_type="YV12").Trim(0,10000).Killaudio()
AddBorders(borders,borders,borders,borders,$000000)
ScriptClip("""
RotateCamera(FoV, dir_speed*current_frame, amt_speed*current_frame, has_borders=borders, info=true, qq=4)
ConvertToYV12
""")
Another script:
Code:
tested_frame=3167

#### camera
FoV=62.55934

#### script
layers=8
base_dir_step=45



################## setup amount
# borders for amount 2
maxamt=8.0
max_borders=160
min_borders=80

# borders for amount 3
#maxamt=3.0
#max_borders=80
#min_borders=40

# borders for amount 4
#maxamt=4.0
#max_borders=120
#min_borders=60



##### precalc
frcnt=floor(layers*(layers+1)*180/base_dir_step)
amt_step=maxamt/layers

#clip
a=LSMASHVideoSource("....",format="RGB32").AddBorders(max_borders,max_borders,max_borders,max_borders,$FF00FF)
c0=a.Trim(tested_frame,-1).Loop(frcnt+1)

c0.ScriptClip("""
c=last
cf=current_frame-1
lvl=(cf<0) ? 0 : floor((1+sqrt(1+4*cf*base_dir_step/180))/2)
dir=(cf<0) ? 0 : cf*base_dir_step/lvl-(lvl-1)*180
amt=lvl*amt_step
c.RotateCamera(FoV, dir, amt, has_borders=max_borders, info=false, qq=4, lock_central=true)
(1==1) ? last : last.Subtitle("current_frame = "+string(current_frame)+"\n" +\
	 "layers        = "+string(layers)+"\n" +\
	 "frcnt         = "+string(frcnt)+"\n" +\
	 "base_dir_step = "+string(base_dir_step)+"\n" +\
	 "lvl           = "+string(lvl)+"\n" +\
	 "dir           = "+string(dir)+"\n" +\
	 "amt           = "+string(amt)+"\n" +\
	 "amt_step      = "+string(amt_step)+"\n" \
	,lsp=0)
#ConvertToYV12
""")

Crop(max_borders-min_borders,max_borders-min_borders,-(max_borders-min_borders),-(max_borders-min_borders))

Warp needed
Attached Files
File Type: zip Rotations.0.2.avsi.zip (2.3 KB, 36 views)

Last edited by redfordxx; 6th February 2020 at 14:36. Reason: Heureka!
redfordxx is offline   Reply With Quote